mirror of
https://github.com/home-assistant/core
synced 2024-07-21 10:44:07 +00:00
Fix class name and deprecation version (#120570)
This commit is contained in:
parent
66a803e56c
commit
294e1d4fc4
|
@ -20,7 +20,7 @@ SCAN_INTERVAL = timedelta(seconds=20)
|
|||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class pyLoadData:
|
||||
class PyLoadData:
|
||||
"""Data from pyLoad."""
|
||||
|
||||
pause: bool
|
||||
|
@ -34,7 +34,7 @@ class pyLoadData:
|
|||
free_space: int
|
||||
|
||||
|
||||
class PyLoadCoordinator(DataUpdateCoordinator[pyLoadData]):
|
||||
class PyLoadCoordinator(DataUpdateCoordinator[PyLoadData]):
|
||||
"""pyLoad coordinator."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
@ -50,12 +50,12 @@ class PyLoadCoordinator(DataUpdateCoordinator[pyLoadData]):
|
|||
self.pyload = pyload
|
||||
self.version: str | None = None
|
||||
|
||||
async def _async_update_data(self) -> pyLoadData:
|
||||
async def _async_update_data(self) -> PyLoadData:
|
||||
"""Fetch data from API endpoint."""
|
||||
try:
|
||||
if not self.version:
|
||||
self.version = await self.pyload.version()
|
||||
return pyLoadData(
|
||||
return PyLoadData(
|
||||
**await self.pyload.get_status(),
|
||||
free_space=await self.pyload.free_space(),
|
||||
)
|
||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
|
|||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import PyLoadConfigEntry
|
||||
from .coordinator import pyLoadData
|
||||
from .coordinator import PyLoadData
|
||||
|
||||
TO_REDACT = {CONF_USERNAME, CONF_PASSWORD, CONF_HOST}
|
||||
|
||||
|
@ -19,7 +19,7 @@ async def async_get_config_entry_diagnostics(
|
|||
hass: HomeAssistant, config_entry: PyLoadConfigEntry
|
||||
) -> dict[str, Any]:
|
||||
"""Return diagnostics for a config entry."""
|
||||
pyload_data: pyLoadData = config_entry.runtime_data.data
|
||||
pyload_data: PyLoadData = config_entry.runtime_data.data
|
||||
|
||||
return {
|
||||
"config_entry_data": async_redact_data(dict(config_entry.data), TO_REDACT),
|
||||
|
|
|
@ -43,7 +43,7 @@ from .const import (
|
|||
ISSUE_PLACEHOLDER,
|
||||
UNIT_DOWNLOADS,
|
||||
)
|
||||
from .coordinator import pyLoadData
|
||||
from .coordinator import PyLoadData
|
||||
from .entity import BasePyLoadEntity
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ class PyLoadSensorEntity(StrEnum):
|
|||
class PyLoadSensorEntityDescription(SensorEntityDescription):
|
||||
"""Describes pyLoad switch entity."""
|
||||
|
||||
value_fn: Callable[[pyLoadData], StateType]
|
||||
value_fn: Callable[[PyLoadData], StateType]
|
||||
|
||||
|
||||
SENSOR_DESCRIPTIONS: tuple[PyLoadSensorEntityDescription, ...] = (
|
||||
|
@ -142,7 +142,7 @@ async def async_setup_platform(
|
|||
f"deprecated_yaml_{DOMAIN}",
|
||||
is_fixable=False,
|
||||
issue_domain=DOMAIN,
|
||||
breaks_in_ha_version="2025.2.0",
|
||||
breaks_in_ha_version="2025.1.0",
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_yaml",
|
||||
translation_placeholders={
|
||||
|
@ -155,7 +155,7 @@ async def async_setup_platform(
|
|||
hass,
|
||||
DOMAIN,
|
||||
f"deprecated_yaml_import_issue_{error}",
|
||||
breaks_in_ha_version="2025.2.0",
|
||||
breaks_in_ha_version="2025.1.0",
|
||||
is_fixable=False,
|
||||
issue_domain=DOMAIN,
|
||||
severity=IssueSeverity.WARNING,
|
||||
|
|
|
@ -18,7 +18,7 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import PyLoadConfigEntry
|
||||
from .coordinator import pyLoadData
|
||||
from .coordinator import PyLoadData
|
||||
from .entity import BasePyLoadEntity
|
||||
|
||||
|
||||
|
@ -36,7 +36,7 @@ class PyLoadSwitchEntityDescription(SwitchEntityDescription):
|
|||
turn_on_fn: Callable[[PyLoadAPI], Awaitable[Any]]
|
||||
turn_off_fn: Callable[[PyLoadAPI], Awaitable[Any]]
|
||||
toggle_fn: Callable[[PyLoadAPI], Awaitable[Any]]
|
||||
value_fn: Callable[[pyLoadData], bool]
|
||||
value_fn: Callable[[PyLoadData], bool]
|
||||
|
||||
|
||||
SENSOR_DESCRIPTIONS: tuple[PyLoadSwitchEntityDescription, ...] = (
|
||||
|
|
Loading…
Reference in a new issue