diff --git a/homeassistant/components/gios/sensor.py b/homeassistant/components/gios/sensor.py index ff589d34791..c14a99051e4 100644 --- a/homeassistant/components/gios/sensor.py +++ b/homeassistant/components/gios/sensor.py @@ -69,10 +69,9 @@ async def async_setup_entry( async_add_entities(sensors) -class GiosSensor(CoordinatorEntity, SensorEntity): +class GiosSensor(CoordinatorEntity[GiosDataUpdateCoordinator], SensorEntity): """Define an GIOS sensor.""" - coordinator: GiosDataUpdateCoordinator entity_description: GiosSensorEntityDescription def __init__( diff --git a/homeassistant/components/gogogate2/common.py b/homeassistant/components/gogogate2/common.py index 5d0392e6db2..bfbadf86ee2 100644 --- a/homeassistant/components/gogogate2/common.py +++ b/homeassistant/components/gogogate2/common.py @@ -66,7 +66,7 @@ class DeviceDataUpdateCoordinator(DataUpdateCoordinator): self.api = api -class GoGoGate2Entity(CoordinatorEntity): +class GoGoGate2Entity(CoordinatorEntity[DeviceDataUpdateCoordinator]): """Base class for gogogate2 entities.""" def __init__( diff --git a/homeassistant/components/gree/entity.py b/homeassistant/components/gree/entity.py index 7407a90b4d0..66be66f9dc9 100644 --- a/homeassistant/components/gree/entity.py +++ b/homeassistant/components/gree/entity.py @@ -7,7 +7,7 @@ from .bridge import DeviceDataUpdateCoordinator from .const import DOMAIN -class GreeEntity(CoordinatorEntity): +class GreeEntity(CoordinatorEntity[DeviceDataUpdateCoordinator]): """Generic Gree entity (base class).""" def __init__(self, coordinator: DeviceDataUpdateCoordinator, desc: str) -> None: diff --git a/homeassistant/components/intellifire/entity.py b/homeassistant/components/intellifire/entity.py index eeb5e7b51bd..6d20c015ab9 100644 --- a/homeassistant/components/intellifire/entity.py +++ b/homeassistant/components/intellifire/entity.py @@ -7,10 +7,9 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity from . import IntellifireDataUpdateCoordinator -class IntellifireEntity(CoordinatorEntity): +class IntellifireEntity(CoordinatorEntity[IntellifireDataUpdateCoordinator]): """Define a generic class for Intellifire entities.""" - coordinator: IntellifireDataUpdateCoordinator _attr_attribution = "Data provided by unpublished Intellifire API" def __init__( diff --git a/homeassistant/components/iotawatt/sensor.py b/homeassistant/components/iotawatt/sensor.py index c3c173f778e..8bcf5bfae9a 100644 --- a/homeassistant/components/iotawatt/sensor.py +++ b/homeassistant/components/iotawatt/sensor.py @@ -24,11 +24,12 @@ from homeassistant.const import ( POWER_WATT, ) from homeassistant.core import HomeAssistant, callback -from homeassistant.helpers import entity, entity_registry, update_coordinator +from homeassistant.helpers import entity, entity_registry from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.restore_state import RestoreEntity from homeassistant.helpers.typing import StateType +from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.util import dt from .const import ( @@ -159,11 +160,10 @@ async def async_setup_entry( coordinator.async_add_listener(new_data_received) -class IotaWattSensor(update_coordinator.CoordinatorEntity, SensorEntity): +class IotaWattSensor(CoordinatorEntity[IotawattUpdater], SensorEntity): """Defines a IoTaWatt Energy Sensor.""" entity_description: IotaWattSensorEntityDescription - coordinator: IotawattUpdater def __init__( self, diff --git a/homeassistant/components/ipp/entity.py b/homeassistant/components/ipp/entity.py index 7bd01b4cd12..b2f3a4a1469 100644 --- a/homeassistant/components/ipp/entity.py +++ b/homeassistant/components/ipp/entity.py @@ -8,7 +8,7 @@ from .const import DOMAIN from .coordinator import IPPDataUpdateCoordinator -class IPPEntity(CoordinatorEntity): +class IPPEntity(CoordinatorEntity[IPPDataUpdateCoordinator]): """Defines a base IPP entity.""" def __init__( diff --git a/homeassistant/components/launch_library/sensor.py b/homeassistant/components/launch_library/sensor.py index d468c3a653f..fac62c9bb87 100644 --- a/homeassistant/components/launch_library/sensor.py +++ b/homeassistant/components/launch_library/sensor.py @@ -179,13 +179,14 @@ async def async_setup_entry( ) -class LaunchLibrarySensor(CoordinatorEntity, SensorEntity): +class LaunchLibrarySensor( + CoordinatorEntity[DataUpdateCoordinator[LaunchLibraryData]], SensorEntity +): """Representation of the next launch sensors.""" _attr_attribution = "Data provided by Launch Library." _next_event: Launch | Event | None = None entity_description: LaunchLibrarySensorEntityDescription - coordinator: DataUpdateCoordinator[LaunchLibraryData] def __init__( self, diff --git a/homeassistant/components/lookin/entity.py b/homeassistant/components/lookin/entity.py index 6ff167d86fe..1c641b76f32 100644 --- a/homeassistant/components/lookin/entity.py +++ b/homeassistant/components/lookin/entity.py @@ -52,11 +52,11 @@ class LookinDeviceMixIn: self._lookin_udp_subs = lookin_data.lookin_udp_subs -class LookinDeviceCoordinatorEntity(LookinDeviceMixIn, CoordinatorEntity): +class LookinDeviceCoordinatorEntity( + LookinDeviceMixIn, CoordinatorEntity[LookinDataUpdateCoordinator] +): """A lookin device entity on the device itself that uses the coordinator.""" - coordinator: LookinDataUpdateCoordinator - _attr_should_poll = False def __init__(self, lookin_data: LookinData) -> None: @@ -84,11 +84,11 @@ class LookinEntityMixIn: self._function_names = {function.name for function in self._device.functions} -class LookinCoordinatorEntity(LookinDeviceMixIn, LookinEntityMixIn, CoordinatorEntity): +class LookinCoordinatorEntity( + LookinDeviceMixIn, LookinEntityMixIn, CoordinatorEntity[LookinDataUpdateCoordinator] +): """A lookin device entity for an external device that uses the coordinator.""" - coordinator: LookinDataUpdateCoordinator - _attr_should_poll = False _attr_assumed_state = True diff --git a/homeassistant/components/moehlenhoff_alpha2/climate.py b/homeassistant/components/moehlenhoff_alpha2/climate.py index d99eb0e4c8c..783e2df5967 100644 --- a/homeassistant/components/moehlenhoff_alpha2/climate.py +++ b/homeassistant/components/moehlenhoff_alpha2/climate.py @@ -38,10 +38,9 @@ async def async_setup_entry( # https://developers.home-assistant.io/docs/core/entity/climate/ -class Alpha2Climate(CoordinatorEntity, ClimateEntity): +class Alpha2Climate(CoordinatorEntity[Alpha2BaseCoordinator], ClimateEntity): """Alpha2 ClimateEntity.""" - coordinator: Alpha2BaseCoordinator target_temperature_step = 0.2 _attr_supported_features = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE diff --git a/homeassistant/components/nam/button.py b/homeassistant/components/nam/button.py index f73307d09ce..db5474ec925 100644 --- a/homeassistant/components/nam/button.py +++ b/homeassistant/components/nam/button.py @@ -41,11 +41,9 @@ async def async_setup_entry( async_add_entities(buttons, False) -class NAMButton(CoordinatorEntity, ButtonEntity): +class NAMButton(CoordinatorEntity[NAMDataUpdateCoordinator], ButtonEntity): """Define an Nettigo Air Monitor button.""" - coordinator: NAMDataUpdateCoordinator - def __init__( self, coordinator: NAMDataUpdateCoordinator, diff --git a/homeassistant/components/nam/sensor.py b/homeassistant/components/nam/sensor.py index 88f6008b45f..af729cf9066 100644 --- a/homeassistant/components/nam/sensor.py +++ b/homeassistant/components/nam/sensor.py @@ -58,11 +58,9 @@ async def async_setup_entry( async_add_entities(sensors, False) -class NAMSensor(CoordinatorEntity, SensorEntity): +class NAMSensor(CoordinatorEntity[NAMDataUpdateCoordinator], SensorEntity): """Define an Nettigo Air Monitor sensor.""" - coordinator: NAMDataUpdateCoordinator - def __init__( self, coordinator: NAMDataUpdateCoordinator, diff --git a/homeassistant/components/nina/binary_sensor.py b/homeassistant/components/nina/binary_sensor.py index eca6668d0f5..a4277b2908d 100644 --- a/homeassistant/components/nina/binary_sensor.py +++ b/homeassistant/components/nina/binary_sensor.py @@ -46,7 +46,7 @@ async def async_setup_entry( async_add_entities(entities) -class NINAMessage(CoordinatorEntity, BinarySensorEntity): +class NINAMessage(CoordinatorEntity[NINADataUpdateCoordinator], BinarySensorEntity): """Representation of an NINA warning.""" def __init__( diff --git a/homeassistant/components/nsw_fuel_station/sensor.py b/homeassistant/components/nsw_fuel_station/sensor.py index 2e022a7ec13..82a5e3a59a8 100644 --- a/homeassistant/components/nsw_fuel_station/sensor.py +++ b/homeassistant/components/nsw_fuel_station/sensor.py @@ -83,7 +83,9 @@ def setup_platform( add_entities(entities) -class StationPriceSensor(CoordinatorEntity, SensorEntity): +class StationPriceSensor( + CoordinatorEntity[DataUpdateCoordinator[StationPriceData]], SensorEntity +): """Implementation of a sensor that reports the fuel price for a station.""" def __init__( diff --git a/homeassistant/components/nzbget/__init__.py b/homeassistant/components/nzbget/__init__.py index d9a41c90535..cb906495d58 100644 --- a/homeassistant/components/nzbget/__init__.py +++ b/homeassistant/components/nzbget/__init__.py @@ -154,7 +154,7 @@ async def _async_update_listener(hass: HomeAssistant, entry: ConfigEntry) -> Non await hass.config_entries.async_reload(entry.entry_id) -class NZBGetEntity(CoordinatorEntity): +class NZBGetEntity(CoordinatorEntity[NZBGetDataUpdateCoordinator]): """Defines a base NZBGet entity.""" def __init__(