1 """Support for an Intergas heater via an InComfort/InTouch Lan2RF gateway."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
8 from incomfortclient
import Heater
as InComfortHeater
13 SensorEntityDescription,
21 from .
import InComfortConfigEntry
22 from .coordinator
import InComfortDataCoordinator
23 from .entity
import IncomfortBoilerEntity
26 @dataclass(frozen=True, kw_only=True)
28 """Describes Incomfort sensor entity."""
31 extra_key: str |
None =
None
34 SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
37 device_class=SensorDeviceClass.PRESSURE,
38 state_class=SensorStateClass.MEASUREMENT,
39 native_unit_of_measurement=UnitOfPressure.BAR,
44 device_class=SensorDeviceClass.TEMPERATURE,
45 state_class=SensorStateClass.MEASUREMENT,
46 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
47 extra_key=
"is_pumping",
48 value_key=
"heater_temp",
52 translation_key=
"tap_temperature",
53 device_class=SensorDeviceClass.TEMPERATURE,
54 state_class=SensorStateClass.MEASUREMENT,
55 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
56 extra_key=
"is_tapping",
64 entry: InComfortConfigEntry,
65 async_add_entities: AddEntitiesCallback,
67 """Set up InComfort/InTouch sensor entities."""
68 incomfort_coordinator = entry.runtime_data
69 heaters = incomfort_coordinator.data.heaters
73 for description
in SENSOR_TYPES
78 """Representation of an InComfort/InTouch sensor device."""
80 entity_description: IncomfortSensorEntityDescription
84 coordinator: InComfortDataCoordinator,
85 heater: InComfortHeater,
86 description: IncomfortSensorEntityDescription,
88 """Initialize the sensor."""
89 super().
__init__(coordinator, heater)
95 """Return the state of the sensor."""
100 """Return the device state attributes."""
103 return {extra_key: self.
_heater_heater.status[extra_key]}
StateType native_value(self)
dict[str, Any]|None extra_state_attributes(self)
None __init__(self, InComfortDataCoordinator coordinator, InComfortHeater heater, IncomfortSensorEntityDescription description)
None async_setup_entry(HomeAssistant hass, InComfortConfigEntry entry, AddEntitiesCallback async_add_entities)