From 539a469a8bcb51235210e3305ba7971a1ed559c3 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Mon, 21 Mar 2022 15:24:05 +0100 Subject: [PATCH] Update coordinator typing (5) [r-s] (#68465) --- homeassistant/components/rainforest_eagle/sensor.py | 4 +--- homeassistant/components/rituals_perfume_genie/entity.py | 4 +--- homeassistant/components/roku/entity.py | 4 +--- homeassistant/components/screenlogic/__init__.py | 4 +--- homeassistant/components/sensibo/entity.py | 4 +--- homeassistant/components/sharkiq/vacuum.py | 4 +--- homeassistant/components/solarlog/sensor.py | 4 ++-- homeassistant/components/speedtestdotnet/sensor.py | 5 +++-- homeassistant/components/steamist/entity.py | 4 +--- homeassistant/components/surepetcare/entity.py | 2 +- homeassistant/components/surepetcare/lock.py | 2 -- homeassistant/components/switchbot/binary_sensor.py | 2 -- homeassistant/components/switchbot/cover.py | 1 - homeassistant/components/switchbot/entity.py | 2 +- homeassistant/components/switchbot/sensor.py | 2 -- homeassistant/components/switchbot/switch.py | 1 - homeassistant/components/switcher_kis/sensor.py | 4 +++- homeassistant/components/switcher_kis/switch.py | 4 +++- homeassistant/components/synology_dsm/__init__.py | 4 +++- homeassistant/components/system_bridge/__init__.py | 2 +- homeassistant/components/system_bridge/binary_sensor.py | 1 - homeassistant/components/system_bridge/sensor.py | 1 - 22 files changed, 24 insertions(+), 41 deletions(-) diff --git a/homeassistant/components/rainforest_eagle/sensor.py b/homeassistant/components/rainforest_eagle/sensor.py index 8f59888603c..a2c336bc5d0 100644 --- a/homeassistant/components/rainforest_eagle/sensor.py +++ b/homeassistant/components/rainforest_eagle/sensor.py @@ -67,11 +67,9 @@ async def async_setup_entry( async_add_entities(entities) -class EagleSensor(CoordinatorEntity, SensorEntity): +class EagleSensor(CoordinatorEntity[EagleDataCoordinator], SensorEntity): """Implementation of the Rainforest Eagle sensor.""" - coordinator: EagleDataCoordinator - def __init__(self, coordinator, entity_description): """Initialize the sensor.""" super().__init__(coordinator) diff --git a/homeassistant/components/rituals_perfume_genie/entity.py b/homeassistant/components/rituals_perfume_genie/entity.py index 3ad71cdad67..e3bf1ef4e63 100644 --- a/homeassistant/components/rituals_perfume_genie/entity.py +++ b/homeassistant/components/rituals_perfume_genie/entity.py @@ -14,11 +14,9 @@ MODEL = "The Perfume Genie" MODEL2 = "The Perfume Genie 2.0" -class DiffuserEntity(CoordinatorEntity): +class DiffuserEntity(CoordinatorEntity[RitualsDataUpdateCoordinator]): """Representation of a diffuser entity.""" - coordinator: RitualsDataUpdateCoordinator - def __init__( self, diffuser: Diffuser, diff --git a/homeassistant/components/roku/entity.py b/homeassistant/components/roku/entity.py index ef969b846aa..39373c96c6a 100644 --- a/homeassistant/components/roku/entity.py +++ b/homeassistant/components/roku/entity.py @@ -9,11 +9,9 @@ from . import RokuDataUpdateCoordinator from .const import DOMAIN -class RokuEntity(CoordinatorEntity): +class RokuEntity(CoordinatorEntity[RokuDataUpdateCoordinator]): """Defines a base Roku entity.""" - coordinator: RokuDataUpdateCoordinator - def __init__( self, *, diff --git a/homeassistant/components/screenlogic/__init__.py b/homeassistant/components/screenlogic/__init__.py index 8580ce8f8fc..fe7d8a79afd 100644 --- a/homeassistant/components/screenlogic/__init__.py +++ b/homeassistant/components/screenlogic/__init__.py @@ -167,11 +167,9 @@ class ScreenlogicDataUpdateCoordinator(DataUpdateCoordinator): raise UpdateFailed(ex) from ex -class ScreenlogicEntity(CoordinatorEntity): +class ScreenlogicEntity(CoordinatorEntity[ScreenlogicDataUpdateCoordinator]): """Base class for all ScreenLogic entities.""" - coordinator: ScreenlogicDataUpdateCoordinator - def __init__(self, coordinator, data_key, enabled=True): """Initialize of the entity.""" super().__init__(coordinator) diff --git a/homeassistant/components/sensibo/entity.py b/homeassistant/components/sensibo/entity.py index a2a2bbf3a0e..bc0e2f49a2a 100644 --- a/homeassistant/components/sensibo/entity.py +++ b/homeassistant/components/sensibo/entity.py @@ -14,11 +14,9 @@ from .const import DOMAIN, LOGGER, SENSIBO_ERRORS, TIMEOUT from .coordinator import MotionSensor, SensiboDataUpdateCoordinator -class SensiboBaseEntity(CoordinatorEntity): +class SensiboBaseEntity(CoordinatorEntity[SensiboDataUpdateCoordinator]): """Representation of a Sensibo entity.""" - coordinator: SensiboDataUpdateCoordinator - def __init__( self, coordinator: SensiboDataUpdateCoordinator, diff --git a/homeassistant/components/sharkiq/vacuum.py b/homeassistant/components/sharkiq/vacuum.py index d9d22eb7a4d..351c0458754 100644 --- a/homeassistant/components/sharkiq/vacuum.py +++ b/homeassistant/components/sharkiq/vacuum.py @@ -84,11 +84,9 @@ async def async_setup_entry( async_add_entities([SharkVacuumEntity(d, coordinator) for d in devices]) -class SharkVacuumEntity(CoordinatorEntity, StateVacuumEntity): +class SharkVacuumEntity(CoordinatorEntity[SharkIqUpdateCoordinator], StateVacuumEntity): """Shark IQ vacuum entity.""" - coordinator: SharkIqUpdateCoordinator - def __init__( self, sharkiq: SharkIqVacuum, coordinator: SharkIqUpdateCoordinator ) -> None: diff --git a/homeassistant/components/solarlog/sensor.py b/homeassistant/components/solarlog/sensor.py index 6269210756c..4180d48cdef 100644 --- a/homeassistant/components/solarlog/sensor.py +++ b/homeassistant/components/solarlog/sensor.py @@ -2,9 +2,9 @@ from homeassistant.components.sensor import SensorEntity from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant -from homeassistant.helpers import update_coordinator from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback +from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import SolarlogData 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.""" entity_description: SolarLogSensorEntityDescription diff --git a/homeassistant/components/speedtestdotnet/sensor.py b/homeassistant/components/speedtestdotnet/sensor.py index aa4cd72f746..4f16c012fa6 100644 --- a/homeassistant/components/speedtestdotnet/sensor.py +++ b/homeassistant/components/speedtestdotnet/sensor.py @@ -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.""" - coordinator: SpeedTestDataCoordinator entity_description: SpeedtestSensorEntityDescription _attr_icon = ICON diff --git a/homeassistant/components/steamist/entity.py b/homeassistant/components/steamist/entity.py index 0a2bc239633..ab104a3074d 100644 --- a/homeassistant/components/steamist/entity.py +++ b/homeassistant/components/steamist/entity.py @@ -13,11 +13,9 @@ from .const import CONF_MODEL from .coordinator import SteamistDataUpdateCoordinator -class SteamistEntity(CoordinatorEntity, Entity): +class SteamistEntity(CoordinatorEntity[SteamistDataUpdateCoordinator], Entity): """Representation of an Steamist entity.""" - coordinator: SteamistDataUpdateCoordinator - def __init__( self, coordinator: SteamistDataUpdateCoordinator, diff --git a/homeassistant/components/surepetcare/entity.py b/homeassistant/components/surepetcare/entity.py index e1faaf07e26..301479c4b95 100644 --- a/homeassistant/components/surepetcare/entity.py +++ b/homeassistant/components/surepetcare/entity.py @@ -13,7 +13,7 @@ from . import SurePetcareDataCoordinator from .const import DOMAIN -class SurePetcareEntity(CoordinatorEntity): +class SurePetcareEntity(CoordinatorEntity[SurePetcareDataCoordinator]): """An implementation for Sure Petcare Entities.""" def __init__( diff --git a/homeassistant/components/surepetcare/lock.py b/homeassistant/components/surepetcare/lock.py index 8ebdd9958f0..3161fa6e0bc 100644 --- a/homeassistant/components/surepetcare/lock.py +++ b/homeassistant/components/surepetcare/lock.py @@ -46,8 +46,6 @@ async def async_setup_entry( class SurePetcareLock(SurePetcareEntity, LockEntity): """A lock implementation for Sure Petcare Entities.""" - coordinator: SurePetcareDataCoordinator - def __init__( self, surepetcare_id: int, diff --git a/homeassistant/components/switchbot/binary_sensor.py b/homeassistant/components/switchbot/binary_sensor.py index c8b3aec4573..c3f88e924ea 100644 --- a/homeassistant/components/switchbot/binary_sensor.py +++ b/homeassistant/components/switchbot/binary_sensor.py @@ -54,8 +54,6 @@ async def async_setup_entry( class SwitchBotBinarySensor(SwitchbotEntity, BinarySensorEntity): """Representation of a Switchbot binary sensor.""" - coordinator: SwitchbotDataUpdateCoordinator - def __init__( self, coordinator: SwitchbotDataUpdateCoordinator, diff --git a/homeassistant/components/switchbot/cover.py b/homeassistant/components/switchbot/cover.py index 9814534ce6d..97ca1aa15bb 100644 --- a/homeassistant/components/switchbot/cover.py +++ b/homeassistant/components/switchbot/cover.py @@ -59,7 +59,6 @@ async def async_setup_entry( class SwitchBotCurtainEntity(SwitchbotEntity, CoverEntity, RestoreEntity): """Representation of a Switchbot.""" - coordinator: SwitchbotDataUpdateCoordinator _attr_device_class = CoverDeviceClass.CURTAIN _attr_supported_features = ( SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP | SUPPORT_SET_POSITION diff --git a/homeassistant/components/switchbot/entity.py b/homeassistant/components/switchbot/entity.py index 688cfea6a86..c27c40613c7 100644 --- a/homeassistant/components/switchbot/entity.py +++ b/homeassistant/components/switchbot/entity.py @@ -12,7 +12,7 @@ from .const import MANUFACTURER from .coordinator import SwitchbotDataUpdateCoordinator -class SwitchbotEntity(CoordinatorEntity, Entity): +class SwitchbotEntity(CoordinatorEntity[SwitchbotDataUpdateCoordinator], Entity): """Generic entity encapsulating common features of Switchbot device.""" def __init__( diff --git a/homeassistant/components/switchbot/sensor.py b/homeassistant/components/switchbot/sensor.py index c3afff27654..1ee0276b7ee 100644 --- a/homeassistant/components/switchbot/sensor.py +++ b/homeassistant/components/switchbot/sensor.py @@ -74,8 +74,6 @@ async def async_setup_entry( class SwitchBotSensor(SwitchbotEntity, SensorEntity): """Representation of a Switchbot sensor.""" - coordinator: SwitchbotDataUpdateCoordinator - def __init__( self, coordinator: SwitchbotDataUpdateCoordinator, diff --git a/homeassistant/components/switchbot/switch.py b/homeassistant/components/switchbot/switch.py index 845d27488ad..de66a437dee 100644 --- a/homeassistant/components/switchbot/switch.py +++ b/homeassistant/components/switchbot/switch.py @@ -104,7 +104,6 @@ async def async_setup_entry( class SwitchBotBotEntity(SwitchbotEntity, SwitchEntity, RestoreEntity): """Representation of a Switchbot.""" - coordinator: SwitchbotDataUpdateCoordinator _attr_device_class = SwitchDeviceClass.SWITCH def __init__( diff --git a/homeassistant/components/switcher_kis/sensor.py b/homeassistant/components/switcher_kis/sensor.py index 6b6bf1bec4a..c8dced8663c 100644 --- a/homeassistant/components/switcher_kis/sensor.py +++ b/homeassistant/components/switcher_kis/sensor.py @@ -92,7 +92,9 @@ async def async_setup_entry( ) -class SwitcherSensorEntity(CoordinatorEntity, SensorEntity): +class SwitcherSensorEntity( + CoordinatorEntity[SwitcherDataUpdateCoordinator], SensorEntity +): """Representation of a Switcher sensor entity.""" def __init__( diff --git a/homeassistant/components/switcher_kis/switch.py b/homeassistant/components/switcher_kis/switch.py index 6df841b1e4e..0065038954f 100644 --- a/homeassistant/components/switcher_kis/switch.py +++ b/homeassistant/components/switcher_kis/switch.py @@ -78,7 +78,9 @@ async def async_setup_entry( ) -class SwitcherBaseSwitchEntity(CoordinatorEntity, SwitchEntity): +class SwitcherBaseSwitchEntity( + CoordinatorEntity[SwitcherDataUpdateCoordinator], SwitchEntity +): """Representation of a Switcher switch entity.""" def __init__(self, coordinator: SwitcherDataUpdateCoordinator) -> None: diff --git a/homeassistant/components/synology_dsm/__init__.py b/homeassistant/components/synology_dsm/__init__.py index e07df808198..0503094d1cd 100644 --- a/homeassistant/components/synology_dsm/__init__.py +++ b/homeassistant/components/synology_dsm/__init__.py @@ -227,7 +227,9 @@ async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> Non 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.""" entity_description: SynologyDSMEntityDescription diff --git a/homeassistant/components/system_bridge/__init__.py b/homeassistant/components/system_bridge/__init__.py index 37beb997755..c6edf5b61ea 100644 --- a/homeassistant/components/system_bridge/__init__.py +++ b/homeassistant/components/system_bridge/__init__.py @@ -289,7 +289,7 @@ async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: await hass.config_entries.async_reload(entry.entry_id) -class SystemBridgeEntity(CoordinatorEntity): +class SystemBridgeEntity(CoordinatorEntity[SystemBridgeDataUpdateCoordinator]): """Defines a base System Bridge entity.""" def __init__( diff --git a/homeassistant/components/system_bridge/binary_sensor.py b/homeassistant/components/system_bridge/binary_sensor.py index fca64dc6102..e592c8e82e4 100644 --- a/homeassistant/components/system_bridge/binary_sensor.py +++ b/homeassistant/components/system_bridge/binary_sensor.py @@ -67,7 +67,6 @@ async def async_setup_entry( class SystemBridgeBinarySensor(SystemBridgeDeviceEntity, BinarySensorEntity): """Define a System Bridge binary sensor.""" - coordinator: SystemBridgeDataUpdateCoordinator entity_description: SystemBridgeBinarySensorEntityDescription def __init__( diff --git a/homeassistant/components/system_bridge/sensor.py b/homeassistant/components/system_bridge/sensor.py index c4969e2c14c..e66749820a7 100644 --- a/homeassistant/components/system_bridge/sensor.py +++ b/homeassistant/components/system_bridge/sensor.py @@ -484,7 +484,6 @@ async def async_setup_entry( class SystemBridgeSensor(SystemBridgeDeviceEntity, SensorEntity): """Define a System Bridge sensor.""" - coordinator: SystemBridgeDataUpdateCoordinator entity_description: SystemBridgeSensorEntityDescription def __init__(