Skip to content

Commit

Permalink
Add state and device class to incomfort (home-assistant#118877)
Browse files Browse the repository at this point in the history
* Add state and device class to incomfort

* Add state and device class to incomfort
  • Loading branch information
joostlek authored Jun 5, 2024
1 parent 906c906 commit 60c0673
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions homeassistant/components/incomfort/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from incomfortclient import Heater as InComfortHeater

from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
Expand All @@ -32,6 +33,7 @@ class IncomfortBinarySensorEntityDescription(BinarySensorEntityDescription):
IncomfortBinarySensorEntityDescription(
key="failed",
name="Fault",
device_class=BinarySensorDeviceClass.PROBLEM,
value_key="is_failed",
extra_state_attributes_fn=lambda status: {"fault_code": status["fault_code"]},
),
Expand Down
4 changes: 4 additions & 0 deletions homeassistant/components/incomfort/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import UnitOfPressure, UnitOfTemperature
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -42,13 +43,15 @@ class IncomfortSensorEntityDescription(SensorEntityDescription):
key="cv_pressure",
name=INCOMFORT_PRESSURE,
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPressure.BAR,
value_key="pressure",
),
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",
Expand All @@ -57,6 +60,7 @@ class IncomfortSensorEntityDescription(SensorEntityDescription):
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",
Expand Down
3 changes: 2 additions & 1 deletion tests/components/incomfort/snapshots/test_binary_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
}),
Expand Down
15 changes: 12 additions & 3 deletions tests/components/incomfort/snapshots/test_sensor.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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>,
Expand All @@ -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>,
Expand Down Expand Up @@ -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>,
Expand All @@ -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>,
Expand Down Expand Up @@ -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>,
Expand Down

0 comments on commit 60c0673

Please sign in to comment.