mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Use generic in iaqualink entity (#144989)
This commit is contained in:
parent
7410b8778a
commit
82a9e67b7e
@ -34,7 +34,9 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkBinarySensor(AqualinkEntity, BinarySensorEntity):
|
class HassAqualinkBinarySensor(
|
||||||
|
AqualinkEntity[AqualinkBinarySensor], BinarySensorEntity
|
||||||
|
):
|
||||||
"""Representation of a binary sensor."""
|
"""Representation of a binary sensor."""
|
||||||
|
|
||||||
def __init__(self, dev: AqualinkBinarySensor) -> None:
|
def __init__(self, dev: AqualinkBinarySensor) -> None:
|
||||||
|
@ -42,7 +42,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkThermostat(AqualinkEntity, ClimateEntity):
|
class HassAqualinkThermostat(AqualinkEntity[AqualinkThermostat], ClimateEntity):
|
||||||
"""Representation of a thermostat."""
|
"""Representation of a thermostat."""
|
||||||
|
|
||||||
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
|
_attr_hvac_modes = [HVACMode.HEAT, HVACMode.OFF]
|
||||||
|
@ -11,7 +11,7 @@ from homeassistant.helpers.entity import Entity
|
|||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
class AqualinkEntity(Entity):
|
class AqualinkEntity[AqualinkDeviceT: AqualinkDevice](Entity):
|
||||||
"""Abstract class for all Aqualink platforms.
|
"""Abstract class for all Aqualink platforms.
|
||||||
|
|
||||||
Entity state is updated via the interval timer within the integration.
|
Entity state is updated via the interval timer within the integration.
|
||||||
@ -23,7 +23,7 @@ class AqualinkEntity(Entity):
|
|||||||
|
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(self, dev: AqualinkDevice) -> None:
|
def __init__(self, dev: AqualinkDeviceT) -> None:
|
||||||
"""Initialize the entity."""
|
"""Initialize the entity."""
|
||||||
self.dev = dev
|
self.dev = dev
|
||||||
self._attr_unique_id = f"{dev.system.serial}_{dev.name}"
|
self._attr_unique_id = f"{dev.system.serial}_{dev.name}"
|
||||||
|
@ -38,7 +38,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkLight(AqualinkEntity, LightEntity):
|
class HassAqualinkLight(AqualinkEntity[AqualinkLight], LightEntity):
|
||||||
"""Representation of a light."""
|
"""Representation of a light."""
|
||||||
|
|
||||||
def __init__(self, dev: AqualinkLight) -> None:
|
def __init__(self, dev: AqualinkLight) -> None:
|
||||||
|
@ -32,7 +32,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkSensor(AqualinkEntity, SensorEntity):
|
class HassAqualinkSensor(AqualinkEntity[AqualinkSensor], SensorEntity):
|
||||||
"""Representation of a sensor."""
|
"""Representation of a sensor."""
|
||||||
|
|
||||||
def __init__(self, dev: AqualinkSensor) -> None:
|
def __init__(self, dev: AqualinkSensor) -> None:
|
||||||
|
@ -31,7 +31,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class HassAqualinkSwitch(AqualinkEntity, SwitchEntity):
|
class HassAqualinkSwitch(AqualinkEntity[AqualinkSwitch], SwitchEntity):
|
||||||
"""Representation of a switch."""
|
"""Representation of a switch."""
|
||||||
|
|
||||||
def __init__(self, dev: AqualinkSwitch) -> None:
|
def __init__(self, dev: AqualinkSwitch) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user