Add state and device class to incomfort (#118877)

* Add state and device class to incomfort

* Add state and device class to incomfort
This commit is contained in:
Joost Lekkerkerker 2024-06-05 16:06:23 +02:00 committed by GitHub
parent 906c906653
commit 60c06732b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 4 deletions

View file

@ -9,6 +9,7 @@ from typing import Any
from incomfortclient import Heater as InComfortHeater
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
@ -32,6 +33,7 @@ SENSOR_TYPES: tuple[IncomfortBinarySensorEntityDescription, ...] = (
IncomfortBinarySensorEntityDescription(
key="failed",
name="Fault",
device_class=BinarySensorDeviceClass.PROBLEM,
value_key="is_failed",
extra_state_attributes_fn=lambda status: {"fault_code": status["fault_code"]},
),

View file

@ -11,6 +11,7 @@ from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import UnitOfPressure, UnitOfTemperature
from homeassistant.core import HomeAssistant
@ -42,6 +43,7 @@ SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
key="cv_pressure",
name=INCOMFORT_PRESSURE,
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPressure.BAR,
value_key="pressure",
),
@ -49,6 +51,7 @@ SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
key="cv_temp",
name=INCOMFORT_HEATER_TEMP,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
extra_key="is_pumping",
value_key="heater_temp",
@ -57,6 +60,7 @@ SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
key="tap_temp",
name=INCOMFORT_TAP_TEMP,
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
extra_key="is_tapping",
value_key="tap_temp",

View file

@ -21,7 +21,7 @@
'name': None,
'options': dict({
}),
'original_device_class': None,
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
'original_icon': None,
'original_name': 'Fault',
'platform': 'incomfort',
@ -35,6 +35,7 @@
# name: test_setup_platform[binary_sensor.boiler_fault-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'problem',
'fault_code': None,
'friendly_name': 'Boiler Fault',
}),

View file

@ -4,7 +4,9 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
@ -37,6 +39,7 @@
'attributes': ReadOnlyDict({
'device_class': 'pressure',
'friendly_name': 'Boiler CV Pressure',
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfPressure.BAR: 'bar'>,
}),
'context': <ANY>,
@ -52,7 +55,9 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
@ -86,6 +91,7 @@
'device_class': 'temperature',
'friendly_name': 'Boiler CV Temp',
'is_pumping': False,
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,
@ -101,7 +107,9 @@
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'capabilities': dict({
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
@ -135,6 +143,7 @@
'device_class': 'temperature',
'friendly_name': 'Boiler Tap Temp',
'is_tapping': False,
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
}),
'context': <ANY>,