Update coordinator typing (6) [t-v] (#68466)
This commit is contained in:
parent
0d29b7cbb3
commit
add741d789
25 changed files with 39 additions and 70 deletions
|
@ -94,11 +94,9 @@ async def async_setup_platform(
|
|||
)
|
||||
|
||||
|
||||
class TautulliSensor(CoordinatorEntity, SensorEntity):
|
||||
class TautulliSensor(CoordinatorEntity[TautulliDataUpdateCoordinator], SensorEntity):
|
||||
"""Representation of a Tautulli sensor."""
|
||||
|
||||
coordinator: TautulliDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: TautulliDataUpdateCoordinator,
|
||||
|
|
|
@ -92,11 +92,9 @@ class ToloSaunaUpdateCoordinator(DataUpdateCoordinator[ToloSaunaData]):
|
|||
return ToloSaunaData(status, settings)
|
||||
|
||||
|
||||
class ToloSaunaCoordinatorEntity(CoordinatorEntity):
|
||||
class ToloSaunaCoordinatorEntity(CoordinatorEntity[ToloSaunaUpdateCoordinator]):
|
||||
"""CoordinatorEntity for TOLO Sauna."""
|
||||
|
||||
coordinator: ToloSaunaUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self, coordinator: ToloSaunaUpdateCoordinator, entry: ConfigEntry
|
||||
) -> None:
|
||||
|
|
|
@ -316,7 +316,7 @@ class TomorrowioDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
raise UpdateFailed from error
|
||||
|
||||
|
||||
class TomorrowioEntity(CoordinatorEntity):
|
||||
class TomorrowioEntity(CoordinatorEntity[TomorrowioDataUpdateCoordinator]):
|
||||
"""Base Tomorrow.io Entity."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -10,11 +10,9 @@ from .const import DOMAIN
|
|||
from .coordinator import ToonDataUpdateCoordinator
|
||||
|
||||
|
||||
class ToonEntity(CoordinatorEntity):
|
||||
class ToonEntity(CoordinatorEntity[ToonDataUpdateCoordinator]):
|
||||
"""Defines a base Toon entity."""
|
||||
|
||||
coordinator: ToonDataUpdateCoordinator
|
||||
|
||||
|
||||
class ToonDisplayDeviceEntity(ToonEntity):
|
||||
"""Defines a Toon display device entity."""
|
||||
|
|
|
@ -30,11 +30,9 @@ def async_refresh_after(
|
|||
return _async_wrap
|
||||
|
||||
|
||||
class CoordinatedTPLinkEntity(CoordinatorEntity):
|
||||
class CoordinatedTPLinkEntity(CoordinatorEntity[TPLinkDataUpdateCoordinator]):
|
||||
"""Common base class for all coordinated tplink entities."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self, device: SmartDevice, coordinator: TPLinkDataUpdateCoordinator
|
||||
) -> None:
|
||||
|
|
|
@ -49,7 +49,6 @@ async def async_setup_entry(
|
|||
class TPLinkSmartBulb(CoordinatedTPLinkEntity, LightEntity):
|
||||
"""Representation of a TPLink Smart Bulb."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
device: SmartBulb
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -140,7 +140,6 @@ async def async_setup_entry(
|
|||
class SmartPlugSensor(CoordinatedTPLinkEntity, SensorEntity):
|
||||
"""Representation of a TPLink Smart Plug energy sensor."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
entity_description: TPLinkSensorEntityDescription
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -47,7 +47,6 @@ async def async_setup_entry(
|
|||
class SmartPlugLedSwitch(CoordinatedTPLinkEntity, SwitchEntity):
|
||||
"""Representation of switch for the LED of a TPLink Smart Plug."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
device: SmartPlug
|
||||
|
||||
_attr_entity_category = EntityCategory.CONFIG
|
||||
|
@ -85,8 +84,6 @@ class SmartPlugLedSwitch(CoordinatedTPLinkEntity, SwitchEntity):
|
|||
class SmartPlugSwitch(CoordinatedTPLinkEntity, SwitchEntity):
|
||||
"""Representation of a TPLink Smart Plug switch."""
|
||||
|
||||
coordinator: TPLinkDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
device: SmartDevice,
|
||||
|
|
|
@ -37,11 +37,9 @@ def handle_error(
|
|||
return wrapper
|
||||
|
||||
|
||||
class TradfriBaseEntity(CoordinatorEntity):
|
||||
class TradfriBaseEntity(CoordinatorEntity[TradfriDeviceDataUpdateCoordinator]):
|
||||
"""Base Tradfri device."""
|
||||
|
||||
coordinator: TradfriDeviceDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
device_coordinator: TradfriDeviceDataUpdateCoordinator,
|
||||
|
|
|
@ -78,7 +78,7 @@ async def async_setup_entry(
|
|||
async_add_entities(entities)
|
||||
|
||||
|
||||
class TradfriGroup(CoordinatorEntity, LightEntity):
|
||||
class TradfriGroup(CoordinatorEntity[TradfriGroupDataUpdateCoordinator], LightEntity):
|
||||
"""The platform class for light groups required by hass."""
|
||||
|
||||
_attr_supported_features = SUPPORTED_GROUP_FEATURES
|
||||
|
|
|
@ -174,7 +174,7 @@ async def async_unload_entry(hass: HomeAssistant, config_entry: ConfigEntry) ->
|
|||
return unload_ok
|
||||
|
||||
|
||||
class UpCloudServerEntity(CoordinatorEntity):
|
||||
class UpCloudServerEntity(CoordinatorEntity[UpCloudDataUpdateCoordinator]):
|
||||
"""Entity class for UpCloud servers."""
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -235,10 +235,9 @@ class UpnpDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
}
|
||||
|
||||
|
||||
class UpnpEntity(CoordinatorEntity):
|
||||
class UpnpEntity(CoordinatorEntity[UpnpDataUpdateCoordinator]):
|
||||
"""Base class for UPnP/IGD entities."""
|
||||
|
||||
coordinator: UpnpDataUpdateCoordinator
|
||||
entity_description: UpnpSensorEntityDescription | UpnpBinarySensorEntityDescription
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -11,11 +11,10 @@ from . import UptimeRobotDataUpdateCoordinator
|
|||
from .const import ATTR_TARGET, ATTRIBUTION, DOMAIN
|
||||
|
||||
|
||||
class UptimeRobotEntity(CoordinatorEntity):
|
||||
class UptimeRobotEntity(CoordinatorEntity[UptimeRobotDataUpdateCoordinator]):
|
||||
"""Base UptimeRobot entity."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
coordinator: UptimeRobotDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -131,11 +131,9 @@ class ValloxState:
|
|||
return next_filter_change_date
|
||||
|
||||
|
||||
class ValloxDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
class ValloxDataUpdateCoordinator(DataUpdateCoordinator[ValloxState]):
|
||||
"""The DataUpdateCoordinator for Vallox."""
|
||||
|
||||
data: ValloxState
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up the integration from configuration.yaml (DEPRECATED)."""
|
||||
|
|
|
@ -16,11 +16,12 @@ from . import ValloxDataUpdateCoordinator
|
|||
from .const import DOMAIN
|
||||
|
||||
|
||||
class ValloxBinarySensor(CoordinatorEntity, BinarySensorEntity):
|
||||
class ValloxBinarySensor(
|
||||
CoordinatorEntity[ValloxDataUpdateCoordinator], BinarySensorEntity
|
||||
):
|
||||
"""Representation of a Vallox binary sensor."""
|
||||
|
||||
entity_description: ValloxBinarySensorEntityDescription
|
||||
coordinator: ValloxDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -80,11 +80,9 @@ async def async_setup_entry(
|
|||
async_add_entities([device])
|
||||
|
||||
|
||||
class ValloxFan(CoordinatorEntity, FanEntity):
|
||||
class ValloxFan(CoordinatorEntity[ValloxDataUpdateCoordinator], FanEntity):
|
||||
"""Representation of the fan."""
|
||||
|
||||
coordinator: ValloxDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name: str,
|
||||
|
|
|
@ -32,11 +32,10 @@ from .const import (
|
|||
)
|
||||
|
||||
|
||||
class ValloxSensor(CoordinatorEntity, SensorEntity):
|
||||
class ValloxSensor(CoordinatorEntity[ValloxDataUpdateCoordinator], SensorEntity):
|
||||
"""Representation of a Vallox sensor."""
|
||||
|
||||
entity_description: ValloxSensorEntityDescription
|
||||
coordinator: ValloxDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
|
|
@ -126,11 +126,9 @@ class VenstarDataUpdateCoordinator(update_coordinator.DataUpdateCoordinator):
|
|||
return None
|
||||
|
||||
|
||||
class VenstarEntity(CoordinatorEntity):
|
||||
class VenstarEntity(CoordinatorEntity[VenstarDataUpdateCoordinator]):
|
||||
"""Representation of a Venstar entity."""
|
||||
|
||||
coordinator: VenstarDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
venstar_data_coordinator: VenstarDataUpdateCoordinator,
|
||||
|
|
|
@ -30,11 +30,11 @@ async def async_setup_entry(
|
|||
async_add_entities([VerisureAlarm(coordinator=hass.data[DOMAIN][entry.entry_id])])
|
||||
|
||||
|
||||
class VerisureAlarm(CoordinatorEntity, AlarmControlPanelEntity):
|
||||
class VerisureAlarm(
|
||||
CoordinatorEntity[VerisureDataUpdateCoordinator], AlarmControlPanelEntity
|
||||
):
|
||||
"""Representation of a Verisure alarm status."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
_attr_code_format = FORMAT_NUMBER
|
||||
_attr_name = "Verisure Alarm"
|
||||
_attr_supported_features = SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY
|
||||
|
|
|
@ -33,11 +33,11 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class VerisureDoorWindowSensor(CoordinatorEntity, BinarySensorEntity):
|
||||
class VerisureDoorWindowSensor(
|
||||
CoordinatorEntity[VerisureDataUpdateCoordinator], BinarySensorEntity
|
||||
):
|
||||
"""Representation of a Verisure door window sensor."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
_attr_device_class = BinarySensorDeviceClass.OPENING
|
||||
|
||||
def __init__(
|
||||
|
@ -79,11 +79,11 @@ class VerisureDoorWindowSensor(CoordinatorEntity, BinarySensorEntity):
|
|||
)
|
||||
|
||||
|
||||
class VerisureEthernetStatus(CoordinatorEntity, BinarySensorEntity):
|
||||
class VerisureEthernetStatus(
|
||||
CoordinatorEntity[VerisureDataUpdateCoordinator], BinarySensorEntity
|
||||
):
|
||||
"""Representation of a Verisure VBOX internet status."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
_attr_name = "Verisure Ethernet status"
|
||||
_attr_device_class = BinarySensorDeviceClass.CONNECTIVITY
|
||||
_attr_entity_category = EntityCategory.DIAGNOSTIC
|
||||
|
|
|
@ -43,11 +43,9 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class VerisureSmartcam(CoordinatorEntity, Camera):
|
||||
class VerisureSmartcam(CoordinatorEntity[VerisureDataUpdateCoordinator], Camera):
|
||||
"""Representation of a Verisure camera."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: VerisureDataUpdateCoordinator,
|
||||
|
|
|
@ -55,11 +55,9 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class VerisureDoorlock(CoordinatorEntity, LockEntity):
|
||||
class VerisureDoorlock(CoordinatorEntity[VerisureDataUpdateCoordinator], LockEntity):
|
||||
"""Representation of a Verisure doorlock."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
|
||||
) -> None:
|
||||
|
|
|
@ -45,11 +45,11 @@ async def async_setup_entry(
|
|||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class VerisureThermometer(CoordinatorEntity, SensorEntity):
|
||||
class VerisureThermometer(
|
||||
CoordinatorEntity[VerisureDataUpdateCoordinator], SensorEntity
|
||||
):
|
||||
"""Representation of a Verisure thermometer."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
_attr_device_class = SensorDeviceClass.TEMPERATURE
|
||||
_attr_native_unit_of_measurement = TEMP_CELSIUS
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
@ -100,11 +100,11 @@ class VerisureThermometer(CoordinatorEntity, SensorEntity):
|
|||
)
|
||||
|
||||
|
||||
class VerisureHygrometer(CoordinatorEntity, SensorEntity):
|
||||
class VerisureHygrometer(
|
||||
CoordinatorEntity[VerisureDataUpdateCoordinator], SensorEntity
|
||||
):
|
||||
"""Representation of a Verisure hygrometer."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
_attr_device_class = SensorDeviceClass.HUMIDITY
|
||||
_attr_native_unit_of_measurement = PERCENTAGE
|
||||
_attr_state_class = SensorStateClass.MEASUREMENT
|
||||
|
@ -155,11 +155,11 @@ class VerisureHygrometer(CoordinatorEntity, SensorEntity):
|
|||
)
|
||||
|
||||
|
||||
class VerisureMouseDetection(CoordinatorEntity, SensorEntity):
|
||||
class VerisureMouseDetection(
|
||||
CoordinatorEntity[VerisureDataUpdateCoordinator], SensorEntity
|
||||
):
|
||||
"""Representation of a Verisure mouse detector."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
_attr_native_unit_of_measurement = "Mice"
|
||||
|
||||
def __init__(
|
||||
|
|
|
@ -27,11 +27,9 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
|
||||
class VerisureSmartplug(CoordinatorEntity, SwitchEntity):
|
||||
class VerisureSmartplug(CoordinatorEntity[VerisureDataUpdateCoordinator], SwitchEntity):
|
||||
"""Representation of a Verisure smartplug."""
|
||||
|
||||
coordinator: VerisureDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self, coordinator: VerisureDataUpdateCoordinator, serial_number: str
|
||||
) -> None:
|
||||
|
|
|
@ -8,7 +8,7 @@ from .const import DOMAIN, HOME_ASSISTANT
|
|||
from .coordinator import VersionDataUpdateCoordinator
|
||||
|
||||
|
||||
class VersionEntity(CoordinatorEntity):
|
||||
class VersionEntity(CoordinatorEntity[VersionDataUpdateCoordinator]):
|
||||
"""Common entity class for Version integration."""
|
||||
|
||||
_attr_device_info = DeviceInfo(
|
||||
|
@ -18,8 +18,6 @@ class VersionEntity(CoordinatorEntity):
|
|||
entry_type=DeviceEntryType.SERVICE,
|
||||
)
|
||||
|
||||
coordinator: VersionDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: VersionDataUpdateCoordinator,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue