mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update coordinator typing (5) [r-s] (#68465)
This commit is contained in:
parent
b664bcd007
commit
539a469a8b
@ -67,11 +67,9 @@ async def async_setup_entry(
|
|||||||
async_add_entities(entities)
|
async_add_entities(entities)
|
||||||
|
|
||||||
|
|
||||||
class EagleSensor(CoordinatorEntity, SensorEntity):
|
class EagleSensor(CoordinatorEntity[EagleDataCoordinator], SensorEntity):
|
||||||
"""Implementation of the Rainforest Eagle sensor."""
|
"""Implementation of the Rainforest Eagle sensor."""
|
||||||
|
|
||||||
coordinator: EagleDataCoordinator
|
|
||||||
|
|
||||||
def __init__(self, coordinator, entity_description):
|
def __init__(self, coordinator, entity_description):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
|
@ -14,11 +14,9 @@ MODEL = "The Perfume Genie"
|
|||||||
MODEL2 = "The Perfume Genie 2.0"
|
MODEL2 = "The Perfume Genie 2.0"
|
||||||
|
|
||||||
|
|
||||||
class DiffuserEntity(CoordinatorEntity):
|
class DiffuserEntity(CoordinatorEntity[RitualsDataUpdateCoordinator]):
|
||||||
"""Representation of a diffuser entity."""
|
"""Representation of a diffuser entity."""
|
||||||
|
|
||||||
coordinator: RitualsDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
diffuser: Diffuser,
|
diffuser: Diffuser,
|
||||||
|
@ -9,11 +9,9 @@ from . import RokuDataUpdateCoordinator
|
|||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
class RokuEntity(CoordinatorEntity):
|
class RokuEntity(CoordinatorEntity[RokuDataUpdateCoordinator]):
|
||||||
"""Defines a base Roku entity."""
|
"""Defines a base Roku entity."""
|
||||||
|
|
||||||
coordinator: RokuDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
|
@ -167,11 +167,9 @@ class ScreenlogicDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
raise UpdateFailed(ex) from ex
|
raise UpdateFailed(ex) from ex
|
||||||
|
|
||||||
|
|
||||||
class ScreenlogicEntity(CoordinatorEntity):
|
class ScreenlogicEntity(CoordinatorEntity[ScreenlogicDataUpdateCoordinator]):
|
||||||
"""Base class for all ScreenLogic entities."""
|
"""Base class for all ScreenLogic entities."""
|
||||||
|
|
||||||
coordinator: ScreenlogicDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(self, coordinator, data_key, enabled=True):
|
def __init__(self, coordinator, data_key, enabled=True):
|
||||||
"""Initialize of the entity."""
|
"""Initialize of the entity."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator)
|
||||||
|
@ -14,11 +14,9 @@ from .const import DOMAIN, LOGGER, SENSIBO_ERRORS, TIMEOUT
|
|||||||
from .coordinator import MotionSensor, SensiboDataUpdateCoordinator
|
from .coordinator import MotionSensor, SensiboDataUpdateCoordinator
|
||||||
|
|
||||||
|
|
||||||
class SensiboBaseEntity(CoordinatorEntity):
|
class SensiboBaseEntity(CoordinatorEntity[SensiboDataUpdateCoordinator]):
|
||||||
"""Representation of a Sensibo entity."""
|
"""Representation of a Sensibo entity."""
|
||||||
|
|
||||||
coordinator: SensiboDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: SensiboDataUpdateCoordinator,
|
coordinator: SensiboDataUpdateCoordinator,
|
||||||
|
@ -84,11 +84,9 @@ async def async_setup_entry(
|
|||||||
async_add_entities([SharkVacuumEntity(d, coordinator) for d in devices])
|
async_add_entities([SharkVacuumEntity(d, coordinator) for d in devices])
|
||||||
|
|
||||||
|
|
||||||
class SharkVacuumEntity(CoordinatorEntity, StateVacuumEntity):
|
class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuumEntity):
|
||||||
"""Shark IQ vacuum entity."""
|
"""Shark IQ vacuum entity."""
|
||||||
|
|
||||||
coordinator: SharkIqUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, sharkiq: SharkIqVacuum, coordinator: SharkIqUpdateCoordinator
|
self, sharkiq: SharkIqVacuum, coordinator: SharkIqUpdateCoordinator
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
from homeassistant.components.sensor import SensorEntity
|
from homeassistant.components.sensor import SensorEntity
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import update_coordinator
|
|
||||||
from homeassistant.helpers.entity import DeviceInfo
|
from homeassistant.helpers.entity import DeviceInfo
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from . import SolarlogData
|
from . import SolarlogData
|
||||||
from .const import DOMAIN, SENSOR_TYPES, SolarLogSensorEntityDescription
|
from .const import DOMAIN, SENSOR_TYPES, SolarLogSensorEntityDescription
|
||||||
@ -20,7 +20,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SolarlogSensor(update_coordinator.CoordinatorEntity, SensorEntity):
|
class SolarlogSensor(CoordinatorEntity[SolarlogData], SensorEntity):
|
||||||
"""Representation of a Sensor."""
|
"""Representation of a Sensor."""
|
||||||
|
|
||||||
entity_description: SolarLogSensorEntityDescription
|
entity_description: SolarLogSensorEntityDescription
|
||||||
|
@ -43,10 +43,11 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SpeedtestSensor(CoordinatorEntity, RestoreEntity, SensorEntity):
|
class SpeedtestSensor(
|
||||||
|
CoordinatorEntity[SpeedTestDataCoordinator], RestoreEntity, SensorEntity
|
||||||
|
):
|
||||||
"""Implementation of a speedtest.net sensor."""
|
"""Implementation of a speedtest.net sensor."""
|
||||||
|
|
||||||
coordinator: SpeedTestDataCoordinator
|
|
||||||
entity_description: SpeedtestSensorEntityDescription
|
entity_description: SpeedtestSensorEntityDescription
|
||||||
_attr_icon = ICON
|
_attr_icon = ICON
|
||||||
|
|
||||||
|
@ -13,11 +13,9 @@ from .const import CONF_MODEL
|
|||||||
from .coordinator import SteamistDataUpdateCoordinator
|
from .coordinator import SteamistDataUpdateCoordinator
|
||||||
|
|
||||||
|
|
||||||
class SteamistEntity(CoordinatorEntity, Entity):
|
class SteamistEntity(CoordinatorEntity[SteamistDataUpdateCoordinator], Entity):
|
||||||
"""Representation of an Steamist entity."""
|
"""Representation of an Steamist entity."""
|
||||||
|
|
||||||
coordinator: SteamistDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: SteamistDataUpdateCoordinator,
|
coordinator: SteamistDataUpdateCoordinator,
|
||||||
|
@ -13,7 +13,7 @@ from . import SurePetcareDataCoordinator
|
|||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
class SurePetcareEntity(CoordinatorEntity):
|
class SurePetcareEntity(CoordinatorEntity[SurePetcareDataCoordinator]):
|
||||||
"""An implementation for Sure Petcare Entities."""
|
"""An implementation for Sure Petcare Entities."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -46,8 +46,6 @@ async def async_setup_entry(
|
|||||||
class SurePetcareLock(SurePetcareEntity, LockEntity):
|
class SurePetcareLock(SurePetcareEntity, LockEntity):
|
||||||
"""A lock implementation for Sure Petcare Entities."""
|
"""A lock implementation for Sure Petcare Entities."""
|
||||||
|
|
||||||
coordinator: SurePetcareDataCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
surepetcare_id: int,
|
surepetcare_id: int,
|
||||||
|
@ -54,8 +54,6 @@ async def async_setup_entry(
|
|||||||
class SwitchBotBinarySensor(SwitchbotEntity, BinarySensorEntity):
|
class SwitchBotBinarySensor(SwitchbotEntity, BinarySensorEntity):
|
||||||
"""Representation of a Switchbot binary sensor."""
|
"""Representation of a Switchbot binary sensor."""
|
||||||
|
|
||||||
coordinator: SwitchbotDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: SwitchbotDataUpdateCoordinator,
|
coordinator: SwitchbotDataUpdateCoordinator,
|
||||||
|
@ -59,7 +59,6 @@ async def async_setup_entry(
|
|||||||
class SwitchBotCurtainEntity(SwitchbotEntity, CoverEntity, RestoreEntity):
|
class SwitchBotCurtainEntity(SwitchbotEntity, CoverEntity, RestoreEntity):
|
||||||
"""Representation of a Switchbot."""
|
"""Representation of a Switchbot."""
|
||||||
|
|
||||||
coordinator: SwitchbotDataUpdateCoordinator
|
|
||||||
_attr_device_class = CoverDeviceClass.CURTAIN
|
_attr_device_class = CoverDeviceClass.CURTAIN
|
||||||
_attr_supported_features = (
|
_attr_supported_features = (
|
||||||
SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP | SUPPORT_SET_POSITION
|
SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP | SUPPORT_SET_POSITION
|
||||||
|
@ -12,7 +12,7 @@ from .const import MANUFACTURER
|
|||||||
from .coordinator import SwitchbotDataUpdateCoordinator
|
from .coordinator import SwitchbotDataUpdateCoordinator
|
||||||
|
|
||||||
|
|
||||||
class SwitchbotEntity(CoordinatorEntity, Entity):
|
class SwitchbotEntity(CoordinatorEntity[SwitchbotDataUpdateCoordinator], Entity):
|
||||||
"""Generic entity encapsulating common features of Switchbot device."""
|
"""Generic entity encapsulating common features of Switchbot device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -74,8 +74,6 @@ async def async_setup_entry(
|
|||||||
class SwitchBotSensor(SwitchbotEntity, SensorEntity):
|
class SwitchBotSensor(SwitchbotEntity, SensorEntity):
|
||||||
"""Representation of a Switchbot sensor."""
|
"""Representation of a Switchbot sensor."""
|
||||||
|
|
||||||
coordinator: SwitchbotDataUpdateCoordinator
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: SwitchbotDataUpdateCoordinator,
|
coordinator: SwitchbotDataUpdateCoordinator,
|
||||||
|
@ -104,7 +104,6 @@ async def async_setup_entry(
|
|||||||
class SwitchBotBotEntity(SwitchbotEntity, SwitchEntity, RestoreEntity):
|
class SwitchBotBotEntity(SwitchbotEntity, SwitchEntity, RestoreEntity):
|
||||||
"""Representation of a Switchbot."""
|
"""Representation of a Switchbot."""
|
||||||
|
|
||||||
coordinator: SwitchbotDataUpdateCoordinator
|
|
||||||
_attr_device_class = SwitchDeviceClass.SWITCH
|
_attr_device_class = SwitchDeviceClass.SWITCH
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -92,7 +92,9 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SwitcherSensorEntity(CoordinatorEntity, SensorEntity):
|
class SwitcherSensorEntity(
|
||||||
|
CoordinatorEntity[SwitcherDataUpdateCoordinator], SensorEntity
|
||||||
|
):
|
||||||
"""Representation of a Switcher sensor entity."""
|
"""Representation of a Switcher sensor entity."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -78,7 +78,9 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class SwitcherBaseSwitchEntity(CoordinatorEntity, SwitchEntity):
|
class SwitcherBaseSwitchEntity(
|
||||||
|
CoordinatorEntity[SwitcherDataUpdateCoordinator], SwitchEntity
|
||||||
|
):
|
||||||
"""Representation of a Switcher switch entity."""
|
"""Representation of a Switcher switch entity."""
|
||||||
|
|
||||||
def __init__(self, coordinator: SwitcherDataUpdateCoordinator) -> None:
|
def __init__(self, coordinator: SwitcherDataUpdateCoordinator) -> None:
|
||||||
|
@ -227,7 +227,9 @@ async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> Non
|
|||||||
await hass.config_entries.async_reload(entry.entry_id)
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
class SynologyDSMBaseEntity(CoordinatorEntity):
|
class SynologyDSMBaseEntity(
|
||||||
|
CoordinatorEntity[DataUpdateCoordinator[dict[str, dict[str, Any]]]]
|
||||||
|
):
|
||||||
"""Representation of a Synology NAS entry."""
|
"""Representation of a Synology NAS entry."""
|
||||||
|
|
||||||
entity_description: SynologyDSMEntityDescription
|
entity_description: SynologyDSMEntityDescription
|
||||||
|
@ -289,7 +289,7 @@ async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|||||||
await hass.config_entries.async_reload(entry.entry_id)
|
await hass.config_entries.async_reload(entry.entry_id)
|
||||||
|
|
||||||
|
|
||||||
class SystemBridgeEntity(CoordinatorEntity):
|
class SystemBridgeEntity(CoordinatorEntity[SystemBridgeDataUpdateCoordinator]):
|
||||||
"""Defines a base System Bridge entity."""
|
"""Defines a base System Bridge entity."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -67,7 +67,6 @@ async def async_setup_entry(
|
|||||||
class SystemBridgeBinarySensor(SystemBridgeDeviceEntity, BinarySensorEntity):
|
class SystemBridgeBinarySensor(SystemBridgeDeviceEntity, BinarySensorEntity):
|
||||||
"""Define a System Bridge binary sensor."""
|
"""Define a System Bridge binary sensor."""
|
||||||
|
|
||||||
coordinator: SystemBridgeDataUpdateCoordinator
|
|
||||||
entity_description: SystemBridgeBinarySensorEntityDescription
|
entity_description: SystemBridgeBinarySensorEntityDescription
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -484,7 +484,6 @@ async def async_setup_entry(
|
|||||||
class SystemBridgeSensor(SystemBridgeDeviceEntity, SensorEntity):
|
class SystemBridgeSensor(SystemBridgeDeviceEntity, SensorEntity):
|
||||||
"""Define a System Bridge sensor."""
|
"""Define a System Bridge sensor."""
|
||||||
|
|
||||||
coordinator: SystemBridgeDataUpdateCoordinator
|
|
||||||
entity_description: SystemBridgeSensorEntityDescription
|
entity_description: SystemBridgeSensorEntityDescription
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user