mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Update coordinator typing (1) [a-c] (#68442)
This commit is contained in:
parent
40d4495ed0
commit
1072aff017
@ -58,11 +58,12 @@ async def async_setup_entry(
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class AccuWeatherSensor(CoordinatorEntity, SensorEntity):
|
||||
class AccuWeatherSensor(
|
||||
CoordinatorEntity[AccuWeatherDataUpdateCoordinator], SensorEntity
|
||||
):
|
||||
"""Define an AccuWeather entity."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
coordinator: AccuWeatherDataUpdateCoordinator
|
||||
entity_description: AccuWeatherSensorDescription
|
||||
|
||||
def __init__(
|
||||
|
@ -56,11 +56,11 @@ async def async_setup_entry(
|
||||
async_add_entities([AccuWeatherEntity(name, coordinator)])
|
||||
|
||||
|
||||
class AccuWeatherEntity(CoordinatorEntity, WeatherEntity):
|
||||
class AccuWeatherEntity(
|
||||
CoordinatorEntity[AccuWeatherDataUpdateCoordinator], WeatherEntity
|
||||
):
|
||||
"""Define an AccuWeather entity."""
|
||||
|
||||
coordinator: AccuWeatherDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self, name: str, coordinator: AccuWeatherDataUpdateCoordinator
|
||||
) -> None:
|
||||
|
@ -64,7 +64,7 @@ async def async_setup_entry(
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AbstractAemetSensor(CoordinatorEntity, SensorEntity):
|
||||
class AbstractAemetSensor(CoordinatorEntity[WeatherUpdateCoordinator], SensorEntity):
|
||||
"""Abstract class for an AEMET OpenData sensor."""
|
||||
|
||||
_attr_extra_state_attributes = {ATTR_ATTRIBUTION: ATTRIBUTION}
|
||||
|
@ -43,7 +43,7 @@ async def async_setup_entry(
|
||||
async_add_entities(entities, False)
|
||||
|
||||
|
||||
class AemetWeather(CoordinatorEntity, WeatherEntity):
|
||||
class AemetWeather(CoordinatorEntity[WeatherUpdateCoordinator], WeatherEntity):
|
||||
"""Implementation of an AEMET OpenData sensor."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
|
@ -134,10 +134,9 @@ async def async_setup_entry(
|
||||
async_add_entities(sensors, False)
|
||||
|
||||
|
||||
class AirlySensor(CoordinatorEntity, SensorEntity):
|
||||
class AirlySensor(CoordinatorEntity[AirlyDataUpdateCoordinator], SensorEntity):
|
||||
"""Define an Airly sensor."""
|
||||
|
||||
coordinator: AirlyDataUpdateCoordinator
|
||||
entity_description: AirlySensorEntityDescription
|
||||
|
||||
def __init__(
|
||||
|
@ -70,11 +70,9 @@ async def async_setup_entry(
|
||||
async_add_entities(entities, False)
|
||||
|
||||
|
||||
class AirNowSensor(CoordinatorEntity, SensorEntity):
|
||||
class AirNowSensor(CoordinatorEntity[AirNowDataUpdateCoordinator], SensorEntity):
|
||||
"""Define an AirNow sensor."""
|
||||
|
||||
coordinator: AirNowDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: AirNowDataUpdateCoordinator,
|
||||
|
@ -20,7 +20,7 @@ from .coordinator import AirzoneUpdateCoordinator
|
||||
PLATFORMS: list[Platform] = [Platform.SENSOR]
|
||||
|
||||
|
||||
class AirzoneEntity(CoordinatorEntity):
|
||||
class AirzoneEntity(CoordinatorEntity[AirzoneUpdateCoordinator]):
|
||||
"""Define an Airzone entity."""
|
||||
|
||||
def __init__(
|
||||
|
@ -24,7 +24,9 @@ PRICE_SPIKE_ICONS = {
|
||||
}
|
||||
|
||||
|
||||
class AmberPriceGridSensor(CoordinatorEntity, BinarySensorEntity):
|
||||
class AmberPriceGridSensor(
|
||||
CoordinatorEntity[AmberUpdateCoordinator], BinarySensorEntity
|
||||
):
|
||||
"""Sensor to show single grid binary values."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
|
@ -51,7 +51,7 @@ def friendly_channel_type(channel_type: str) -> str:
|
||||
return "General"
|
||||
|
||||
|
||||
class AmberSensor(CoordinatorEntity, SensorEntity):
|
||||
class AmberSensor(CoordinatorEntity[AmberUpdateCoordinator], SensorEntity):
|
||||
"""Amber Base Sensor."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
@ -180,7 +180,7 @@ class AmberPriceDescriptorSensor(AmberSensor):
|
||||
return self.coordinator.data[self.entity_description.key][self.channel_type]
|
||||
|
||||
|
||||
class AmberGridSensor(CoordinatorEntity, SensorEntity):
|
||||
class AmberGridSensor(CoordinatorEntity[AmberUpdateCoordinator], SensorEntity):
|
||||
"""Sensor to show single grid specific values."""
|
||||
|
||||
_attr_attribution = ATTRIBUTION
|
||||
|
@ -8,11 +8,9 @@ from . import AsekoDataUpdateCoordinator
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
class AsekoEntity(CoordinatorEntity):
|
||||
class AsekoEntity(CoordinatorEntity[AsekoDataUpdateCoordinator]):
|
||||
"""Representation of an aseko entity."""
|
||||
|
||||
coordinator: AsekoDataUpdateCoordinator
|
||||
|
||||
def __init__(self, unit: Unit, coordinator: AsekoDataUpdateCoordinator) -> None:
|
||||
"""Initialize the aseko entity."""
|
||||
super().__init__(coordinator)
|
||||
|
@ -118,7 +118,7 @@ class AuroraDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
raise UpdateFailed(f"Error updating from NOAA: {error}") from error
|
||||
|
||||
|
||||
class AuroraEntity(CoordinatorEntity):
|
||||
class AuroraEntity(CoordinatorEntity[AuroraDataUpdateCoordinator]):
|
||||
"""Implementation of the base Aurora Entity."""
|
||||
|
||||
_attr_extra_state_attributes = {"attribution": ATTRIBUTION}
|
||||
|
@ -102,7 +102,7 @@ async def async_setup_entry(
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
class AwairSensor(CoordinatorEntity, SensorEntity):
|
||||
class AwairSensor(CoordinatorEntity[AwairDataUpdateCoordinator], SensorEntity):
|
||||
"""Defines an Awair sensor entity."""
|
||||
|
||||
entity_description: AwairSensorEntityDescription
|
||||
|
@ -94,10 +94,9 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
return unload_ok
|
||||
|
||||
|
||||
class AzureDevOpsEntity(CoordinatorEntity):
|
||||
class AzureDevOpsEntity(CoordinatorEntity[DataUpdateCoordinator[list[DevOpsBuild]]]):
|
||||
"""Defines a base Azure DevOps entity."""
|
||||
|
||||
coordinator: DataUpdateCoordinator[list[DevOpsBuild]]
|
||||
entity_description: AzureDevOpsEntityDescription
|
||||
|
||||
def __init__(
|
||||
|
@ -67,10 +67,9 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class BraviaTVMediaPlayer(CoordinatorEntity, MediaPlayerEntity):
|
||||
class BraviaTVMediaPlayer(CoordinatorEntity[BraviaTVCoordinator], MediaPlayerEntity):
|
||||
"""Representation of a Bravia TV Media Player."""
|
||||
|
||||
coordinator: BraviaTVCoordinator
|
||||
_attr_device_class = MediaPlayerDeviceClass.TV
|
||||
_attr_supported_features = SUPPORT_BRAVIA
|
||||
|
||||
|
@ -37,11 +37,9 @@ async def async_setup_entry(
|
||||
)
|
||||
|
||||
|
||||
class BraviaTVRemote(CoordinatorEntity, RemoteEntity):
|
||||
class BraviaTVRemote(CoordinatorEntity[BraviaTVCoordinator], RemoteEntity):
|
||||
"""Representation of a Bravia TV Remote."""
|
||||
|
||||
coordinator: BraviaTVCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: BraviaTVCoordinator,
|
||||
|
@ -48,10 +48,11 @@ async def async_setup_entry(
|
||||
async_add_entities(alarms, True)
|
||||
|
||||
|
||||
class CanaryAlarm(CoordinatorEntity, AlarmControlPanelEntity):
|
||||
class CanaryAlarm(
|
||||
CoordinatorEntity[CanaryDataUpdateCoordinator], AlarmControlPanelEntity
|
||||
):
|
||||
"""Representation of a Canary alarm control panel."""
|
||||
|
||||
coordinator: CanaryDataUpdateCoordinator
|
||||
_attr_supported_features = (
|
||||
SUPPORT_ALARM_ARM_HOME | SUPPORT_ALARM_ARM_AWAY | SUPPORT_ALARM_ARM_NIGHT
|
||||
)
|
||||
|
@ -78,11 +78,9 @@ async def async_setup_entry(
|
||||
async_add_entities(cameras, True)
|
||||
|
||||
|
||||
class CanaryCamera(CoordinatorEntity, Camera):
|
||||
class CanaryCamera(CoordinatorEntity[CanaryDataUpdateCoordinator], Camera):
|
||||
"""An implementation of a Canary security camera."""
|
||||
|
||||
coordinator: CanaryDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
|
@ -76,11 +76,9 @@ async def async_setup_entry(
|
||||
async_add_entities(sensors, True)
|
||||
|
||||
|
||||
class CanarySensor(CoordinatorEntity, SensorEntity):
|
||||
class CanarySensor(CoordinatorEntity[CanaryDataUpdateCoordinator], SensorEntity):
|
||||
"""Representation of a Canary sensor."""
|
||||
|
||||
coordinator: CanaryDataUpdateCoordinator
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
coordinator: CanaryDataUpdateCoordinator,
|
||||
|
@ -273,7 +273,7 @@ class ClimaCellDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
return data
|
||||
|
||||
|
||||
class ClimaCellEntity(CoordinatorEntity):
|
||||
class ClimaCellEntity(CoordinatorEntity[ClimaCellDataUpdateCoordinator]):
|
||||
"""Base ClimaCell Entity."""
|
||||
|
||||
def __init__(
|
||||
|
Loading…
x
Reference in New Issue
Block a user