mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Introduce incomfort boiler entity (#118861)
This commit is contained in:
parent
8d11279bc9
commit
986d8986a9
@ -13,13 +13,11 @@ from homeassistant.components.binary_sensor import (
|
|||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import InComfortConfigEntry
|
from . import InComfortConfigEntry
|
||||||
from .const import DOMAIN
|
|
||||||
from .coordinator import InComfortDataCoordinator
|
from .coordinator import InComfortDataCoordinator
|
||||||
from .entity import IncomfortEntity
|
from .entity import IncomfortBoilerEntity
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, kw_only=True)
|
@dataclass(frozen=True, kw_only=True)
|
||||||
@ -55,7 +53,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncomfortBinarySensor(IncomfortEntity, BinarySensorEntity):
|
class IncomfortBinarySensor(IncomfortBoilerEntity, BinarySensorEntity):
|
||||||
"""Representation of an InComfort binary sensor."""
|
"""Representation of an InComfort binary sensor."""
|
||||||
|
|
||||||
entity_description: IncomfortBinarySensorEntityDescription
|
entity_description: IncomfortBinarySensorEntityDescription
|
||||||
@ -67,17 +65,9 @@ class IncomfortBinarySensor(IncomfortEntity, BinarySensorEntity):
|
|||||||
description: IncomfortBinarySensorEntityDescription,
|
description: IncomfortBinarySensorEntityDescription,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the binary sensor."""
|
"""Initialize the binary sensor."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator, heater)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
|
|
||||||
self._heater = heater
|
|
||||||
|
|
||||||
self._attr_unique_id = f"{heater.serial_no}_{description.key}"
|
self._attr_unique_id = f"{heater.serial_no}_{description.key}"
|
||||||
self._attr_device_info = DeviceInfo(
|
|
||||||
identifiers={(DOMAIN, heater.serial_no)},
|
|
||||||
manufacturer="Intergas",
|
|
||||||
name="Boiler",
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
"""Common entity classes for InComfort integration."""
|
"""Common entity classes for InComfort integration."""
|
||||||
|
|
||||||
|
from incomfortclient import Heater
|
||||||
|
|
||||||
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
|
from .const import DOMAIN
|
||||||
from .coordinator import InComfortDataCoordinator
|
from .coordinator import InComfortDataCoordinator
|
||||||
|
|
||||||
|
|
||||||
@ -9,3 +13,17 @@ class IncomfortEntity(CoordinatorEntity[InComfortDataCoordinator]):
|
|||||||
"""Base class for all InComfort entities."""
|
"""Base class for all InComfort entities."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
|
|
||||||
|
class IncomfortBoilerEntity(IncomfortEntity):
|
||||||
|
"""Base class for all InComfort boiler entities."""
|
||||||
|
|
||||||
|
def __init__(self, coordinator: InComfortDataCoordinator, heater: Heater) -> None:
|
||||||
|
"""Initialize the boiler entity."""
|
||||||
|
super().__init__(coordinator)
|
||||||
|
self._heater = heater
|
||||||
|
self._attr_device_info = DeviceInfo(
|
||||||
|
identifiers={(DOMAIN, heater.serial_no)},
|
||||||
|
manufacturer="Intergas",
|
||||||
|
name="Boiler",
|
||||||
|
)
|
||||||
|
@ -14,14 +14,12 @@ from homeassistant.components.sensor import (
|
|||||||
)
|
)
|
||||||
from homeassistant.const import UnitOfPressure, UnitOfTemperature
|
from homeassistant.const import UnitOfPressure, UnitOfTemperature
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
|
|
||||||
from . import InComfortConfigEntry
|
from . import InComfortConfigEntry
|
||||||
from .const import DOMAIN
|
|
||||||
from .coordinator import InComfortDataCoordinator
|
from .coordinator import InComfortDataCoordinator
|
||||||
from .entity import IncomfortEntity
|
from .entity import IncomfortBoilerEntity
|
||||||
|
|
||||||
INCOMFORT_HEATER_TEMP = "CV Temp"
|
INCOMFORT_HEATER_TEMP = "CV Temp"
|
||||||
INCOMFORT_PRESSURE = "CV Pressure"
|
INCOMFORT_PRESSURE = "CV Pressure"
|
||||||
@ -81,7 +79,7 @@ async def async_setup_entry(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class IncomfortSensor(IncomfortEntity, SensorEntity):
|
class IncomfortSensor(IncomfortBoilerEntity, SensorEntity):
|
||||||
"""Representation of an InComfort/InTouch sensor device."""
|
"""Representation of an InComfort/InTouch sensor device."""
|
||||||
|
|
||||||
entity_description: IncomfortSensorEntityDescription
|
entity_description: IncomfortSensorEntityDescription
|
||||||
@ -93,17 +91,9 @@ class IncomfortSensor(IncomfortEntity, SensorEntity):
|
|||||||
description: IncomfortSensorEntityDescription,
|
description: IncomfortSensorEntityDescription,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator, heater)
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
|
|
||||||
self._heater = heater
|
|
||||||
|
|
||||||
self._attr_unique_id = f"{heater.serial_no}_{description.key}"
|
self._attr_unique_id = f"{heater.serial_no}_{description.key}"
|
||||||
self._attr_device_info = DeviceInfo(
|
|
||||||
identifiers={(DOMAIN, heater.serial_no)},
|
|
||||||
manufacturer="Intergas",
|
|
||||||
name="Boiler",
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType:
|
||||||
|
@ -10,13 +10,11 @@ from incomfortclient import Heater as InComfortHeater
|
|||||||
from homeassistant.components.water_heater import WaterHeaterEntity
|
from homeassistant.components.water_heater import WaterHeaterEntity
|
||||||
from homeassistant.const import UnitOfTemperature
|
from homeassistant.const import UnitOfTemperature
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
|
|
||||||
from . import InComfortConfigEntry
|
from . import InComfortConfigEntry
|
||||||
from .const import DOMAIN
|
|
||||||
from .coordinator import InComfortDataCoordinator
|
from .coordinator import InComfortDataCoordinator
|
||||||
from .entity import IncomfortEntity
|
from .entity import IncomfortBoilerEntity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -34,7 +32,7 @@ async def async_setup_entry(
|
|||||||
async_add_entities(IncomfortWaterHeater(incomfort_coordinator, h) for h in heaters)
|
async_add_entities(IncomfortWaterHeater(incomfort_coordinator, h) for h in heaters)
|
||||||
|
|
||||||
|
|
||||||
class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
|
class IncomfortWaterHeater(IncomfortBoilerEntity, WaterHeaterEntity):
|
||||||
"""Representation of an InComfort/Intouch water_heater device."""
|
"""Representation of an InComfort/Intouch water_heater device."""
|
||||||
|
|
||||||
_attr_min_temp = 30.0
|
_attr_min_temp = 30.0
|
||||||
@ -46,16 +44,8 @@ class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
|
|||||||
self, coordinator: InComfortDataCoordinator, heater: InComfortHeater
|
self, coordinator: InComfortDataCoordinator, heater: InComfortHeater
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the water_heater device."""
|
"""Initialize the water_heater device."""
|
||||||
super().__init__(coordinator)
|
super().__init__(coordinator, heater)
|
||||||
|
|
||||||
self._heater = heater
|
|
||||||
|
|
||||||
self._attr_unique_id = heater.serial_no
|
self._attr_unique_id = heater.serial_no
|
||||||
self._attr_device_info = DeviceInfo(
|
|
||||||
identifiers={(DOMAIN, heater.serial_no)},
|
|
||||||
manufacturer="Intergas",
|
|
||||||
name="Boiler",
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def icon(self) -> str:
|
def icon(self) -> str:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user