mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +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,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import InComfortConfigEntry
|
||||
from .const import DOMAIN
|
||||
from .coordinator import InComfortDataCoordinator
|
||||
from .entity import IncomfortEntity
|
||||
from .entity import IncomfortBoilerEntity
|
||||
|
||||
|
||||
@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."""
|
||||
|
||||
entity_description: IncomfortBinarySensorEntityDescription
|
||||
@ -67,17 +65,9 @@ class IncomfortBinarySensor(IncomfortEntity, BinarySensorEntity):
|
||||
description: IncomfortBinarySensorEntityDescription,
|
||||
) -> None:
|
||||
"""Initialize the binary sensor."""
|
||||
super().__init__(coordinator)
|
||||
super().__init__(coordinator, heater)
|
||||
self.entity_description = description
|
||||
|
||||
self._heater = heater
|
||||
|
||||
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
|
||||
def is_on(self) -> bool:
|
||||
|
@ -1,7 +1,11 @@
|
||||
"""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 .const import DOMAIN
|
||||
from .coordinator import InComfortDataCoordinator
|
||||
|
||||
|
||||
@ -9,3 +13,17 @@ class IncomfortEntity(CoordinatorEntity[InComfortDataCoordinator]):
|
||||
"""Base class for all InComfort entities."""
|
||||
|
||||
_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.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import StateType
|
||||
|
||||
from . import InComfortConfigEntry
|
||||
from .const import DOMAIN
|
||||
from .coordinator import InComfortDataCoordinator
|
||||
from .entity import IncomfortEntity
|
||||
from .entity import IncomfortBoilerEntity
|
||||
|
||||
INCOMFORT_HEATER_TEMP = "CV Temp"
|
||||
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."""
|
||||
|
||||
entity_description: IncomfortSensorEntityDescription
|
||||
@ -93,17 +91,9 @@ class IncomfortSensor(IncomfortEntity, SensorEntity):
|
||||
description: IncomfortSensorEntityDescription,
|
||||
) -> None:
|
||||
"""Initialize the sensor."""
|
||||
super().__init__(coordinator)
|
||||
super().__init__(coordinator, heater)
|
||||
self.entity_description = description
|
||||
|
||||
self._heater = heater
|
||||
|
||||
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
|
||||
def native_value(self) -> StateType:
|
||||
|
@ -10,13 +10,11 @@ from incomfortclient import Heater as InComfortHeater
|
||||
from homeassistant.components.water_heater import WaterHeaterEntity
|
||||
from homeassistant.const import UnitOfTemperature
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.device_registry import DeviceInfo
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import InComfortConfigEntry
|
||||
from .const import DOMAIN
|
||||
from .coordinator import InComfortDataCoordinator
|
||||
from .entity import IncomfortEntity
|
||||
from .entity import IncomfortBoilerEntity
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -34,7 +32,7 @@ async def async_setup_entry(
|
||||
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."""
|
||||
|
||||
_attr_min_temp = 30.0
|
||||
@ -46,16 +44,8 @@ class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity):
|
||||
self, coordinator: InComfortDataCoordinator, heater: InComfortHeater
|
||||
) -> None:
|
||||
"""Initialize the water_heater device."""
|
||||
super().__init__(coordinator)
|
||||
|
||||
self._heater = heater
|
||||
|
||||
super().__init__(coordinator, heater)
|
||||
self._attr_unique_id = heater.serial_no
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, heater.serial_no)},
|
||||
manufacturer="Intergas",
|
||||
name="Boiler",
|
||||
)
|
||||
|
||||
@property
|
||||
def icon(self) -> str:
|
||||
|
Loading…
x
Reference in New Issue
Block a user