mirror of
https://github.com/home-assistant/core.git
synced 2026-10-07 06:50:41 -04:00
Mark mapping sensors as enum for nibe heatpump (#184117)
This commit is contained in:
@@ -249,7 +249,10 @@ class Sensor(CoilEntity, SensorEntity):
|
||||
if state_class := NATURE_TO_STATE_CLASS.get(coil.nature):
|
||||
self._attr_state_class = state_class
|
||||
|
||||
if not coil.mappings:
|
||||
if coil.mappings:
|
||||
self._attr_device_class = SensorDeviceClass.ENUM
|
||||
self._attr_options = list(coil.mappings.values())
|
||||
else:
|
||||
self._attr_suggested_display_precision = ceil(log10(abs(coil.factor)))
|
||||
|
||||
@override
|
||||
|
||||
@@ -232,7 +232,15 @@
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.OPTIONS: 'options'>: list([
|
||||
'OFF',
|
||||
'STARTING',
|
||||
'ON',
|
||||
'10-DAY MODE',
|
||||
'CALIBRATION',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
@@ -251,7 +259,7 @@
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Supply Pump State EP14',
|
||||
'platform': 'nibe_heatpump',
|
||||
@@ -266,7 +274,15 @@
|
||||
# name: test_entities[Model.F1155-data0][sensor.supply_pump_state_ep14_43431-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'enum',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'F1155 Supply Pump State EP14',
|
||||
<SensorEntityCapabilityAttribute.OPTIONS: 'options'>: list([
|
||||
'OFF',
|
||||
'STARTING',
|
||||
'ON',
|
||||
'10-DAY MODE',
|
||||
'CALIBRATION',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.supply_pump_state_ep14_43431',
|
||||
|
||||
Reference in New Issue
Block a user