Update coordinator typing (3) [g-n] (#68463)
parent
354fc4c1ae
commit
0d29b7cbb3
homeassistant/components
gios
gogogate2
gree
intellifire
iotawatt
ipp
launch_library
lookin
moehlenhoff_alpha2
nina
nsw_fuel_station
nzbget
|
@ -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__(
|
||||
|
|
|
@ -66,7 +66,7 @@ class DeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
self.api = api
|
||||
|
||||
|
||||
class GoGoGate2Entity(CoordinatorEntity):
|
||||
class GoGoGate2Entity(CoordinatorEntity[DeviceDataUpdateCoordinator]):
|
||||
"""Base class for gogogate2 entities."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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__(
|
||||
|
|
|
@ -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__(
|
||||
|
|
Loading…
Reference in New Issue