mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
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:
parent
906c906653
commit
60c06732b1
@ -9,6 +9,7 @@ from typing import Any
|
|||||||
from incomfortclient import Heater as InComfortHeater
|
from incomfortclient import Heater as InComfortHeater
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
@ -32,6 +33,7 @@ SENSOR_TYPES: tuple[IncomfortBinarySensorEntityDescription, ...] = (
|
|||||||
IncomfortBinarySensorEntityDescription(
|
IncomfortBinarySensorEntityDescription(
|
||||||
key="failed",
|
key="failed",
|
||||||
name="Fault",
|
name="Fault",
|
||||||
|
device_class=BinarySensorDeviceClass.PROBLEM,
|
||||||
value_key="is_failed",
|
value_key="is_failed",
|
||||||
extra_state_attributes_fn=lambda status: {"fault_code": status["fault_code"]},
|
extra_state_attributes_fn=lambda status: {"fault_code": status["fault_code"]},
|
||||||
),
|
),
|
||||||
|
@ -11,6 +11,7 @@ from homeassistant.components.sensor import (
|
|||||||
SensorDeviceClass,
|
SensorDeviceClass,
|
||||||
SensorEntity,
|
SensorEntity,
|
||||||
SensorEntityDescription,
|
SensorEntityDescription,
|
||||||
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.const import UnitOfPressure, UnitOfTemperature
|
from homeassistant.const import UnitOfPressure, UnitOfTemperature
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
@ -42,6 +43,7 @@ SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
|
|||||||
key="cv_pressure",
|
key="cv_pressure",
|
||||||
name=INCOMFORT_PRESSURE,
|
name=INCOMFORT_PRESSURE,
|
||||||
device_class=SensorDeviceClass.PRESSURE,
|
device_class=SensorDeviceClass.PRESSURE,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=UnitOfPressure.BAR,
|
native_unit_of_measurement=UnitOfPressure.BAR,
|
||||||
value_key="pressure",
|
value_key="pressure",
|
||||||
),
|
),
|
||||||
@ -49,6 +51,7 @@ SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
|
|||||||
key="cv_temp",
|
key="cv_temp",
|
||||||
name=INCOMFORT_HEATER_TEMP,
|
name=INCOMFORT_HEATER_TEMP,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
extra_key="is_pumping",
|
extra_key="is_pumping",
|
||||||
value_key="heater_temp",
|
value_key="heater_temp",
|
||||||
@ -57,6 +60,7 @@ SENSOR_TYPES: tuple[IncomfortSensorEntityDescription, ...] = (
|
|||||||
key="tap_temp",
|
key="tap_temp",
|
||||||
name=INCOMFORT_TAP_TEMP,
|
name=INCOMFORT_TAP_TEMP,
|
||||||
device_class=SensorDeviceClass.TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||||
extra_key="is_tapping",
|
extra_key="is_tapping",
|
||||||
value_key="tap_temp",
|
value_key="tap_temp",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
'name': None,
|
'name': None,
|
||||||
'options': dict({
|
'options': dict({
|
||||||
}),
|
}),
|
||||||
'original_device_class': None,
|
'original_device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>,
|
||||||
'original_icon': None,
|
'original_icon': None,
|
||||||
'original_name': 'Fault',
|
'original_name': 'Fault',
|
||||||
'platform': 'incomfort',
|
'platform': 'incomfort',
|
||||||
@ -35,6 +35,7 @@
|
|||||||
# name: test_setup_platform[binary_sensor.boiler_fault-state]
|
# name: test_setup_platform[binary_sensor.boiler_fault-state]
|
||||||
StateSnapshot({
|
StateSnapshot({
|
||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
|
'device_class': 'problem',
|
||||||
'fault_code': None,
|
'fault_code': None,
|
||||||
'friendly_name': 'Boiler Fault',
|
'friendly_name': 'Boiler Fault',
|
||||||
}),
|
}),
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
'aliases': set({
|
'aliases': set({
|
||||||
}),
|
}),
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'capabilities': None,
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
'device_class': None,
|
'device_class': None,
|
||||||
'device_id': <ANY>,
|
'device_id': <ANY>,
|
||||||
@ -37,6 +39,7 @@
|
|||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'device_class': 'pressure',
|
'device_class': 'pressure',
|
||||||
'friendly_name': 'Boiler CV Pressure',
|
'friendly_name': 'Boiler CV Pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
'unit_of_measurement': <UnitOfPressure.BAR: 'bar'>,
|
'unit_of_measurement': <UnitOfPressure.BAR: 'bar'>,
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
@ -52,7 +55,9 @@
|
|||||||
'aliases': set({
|
'aliases': set({
|
||||||
}),
|
}),
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'capabilities': None,
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
'device_class': None,
|
'device_class': None,
|
||||||
'device_id': <ANY>,
|
'device_id': <ANY>,
|
||||||
@ -86,6 +91,7 @@
|
|||||||
'device_class': 'temperature',
|
'device_class': 'temperature',
|
||||||
'friendly_name': 'Boiler CV Temp',
|
'friendly_name': 'Boiler CV Temp',
|
||||||
'is_pumping': False,
|
'is_pumping': False,
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
@ -101,7 +107,9 @@
|
|||||||
'aliases': set({
|
'aliases': set({
|
||||||
}),
|
}),
|
||||||
'area_id': None,
|
'area_id': None,
|
||||||
'capabilities': None,
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
'config_entry_id': <ANY>,
|
'config_entry_id': <ANY>,
|
||||||
'device_class': None,
|
'device_class': None,
|
||||||
'device_id': <ANY>,
|
'device_id': <ANY>,
|
||||||
@ -135,6 +143,7 @@
|
|||||||
'device_class': 'temperature',
|
'device_class': 'temperature',
|
||||||
'friendly_name': 'Boiler Tap Temp',
|
'friendly_name': 'Boiler Tap Temp',
|
||||||
'is_tapping': False,
|
'is_tapping': False,
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user