Add unit and state_class to heating sensor in ista EcoTrend (#120728)

* Add unit and state_class to heating sensor

* remove constant
This commit is contained in:
Mr. Bubbles 2024-06-28 11:16:13 +02:00 committed by GitHub
parent 6286177041
commit 540da3cac6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 4 deletions

View File

@ -56,6 +56,8 @@ SENSOR_DESCRIPTIONS: tuple[IstaSensorEntityDescription, ...] = (
translation_key=IstaSensorEntity.HEATING, translation_key=IstaSensorEntity.HEATING,
suggested_display_precision=0, suggested_display_precision=0,
consumption_type=IstaConsumptionType.HEATING, consumption_type=IstaConsumptionType.HEATING,
native_unit_of_measurement="units",
state_class=SensorStateClass.TOTAL,
), ),
IstaSensorEntityDescription( IstaSensorEntityDescription(
key=IstaSensorEntity.HEATING_ENERGY, key=IstaSensorEntity.HEATING_ENERGY,

View File

@ -64,7 +64,9 @@
'aliases': set({ 'aliases': set({
}), }),
'area_id': None, 'area_id': None,
'capabilities': None, 'capabilities': dict({
'state_class': <SensorStateClass.TOTAL: 'total'>,
}),
'config_entry_id': <ANY>, 'config_entry_id': <ANY>,
'device_class': None, 'device_class': None,
'device_id': <ANY>, 'device_id': <ANY>,
@ -92,13 +94,15 @@
'supported_features': 0, 'supported_features': 0,
'translation_key': <IstaSensorEntity.HEATING: 'heating'>, 'translation_key': <IstaSensorEntity.HEATING: 'heating'>,
'unique_id': 'eaf5c5c8-889f-4a3c-b68c-e9a676505762_heating', 'unique_id': 'eaf5c5c8-889f-4a3c-b68c-e9a676505762_heating',
'unit_of_measurement': None, 'unit_of_measurement': 'units',
}) })
# --- # ---
# name: test_setup[sensor.bahnhofsstr_1a_heating-state] # name: test_setup[sensor.bahnhofsstr_1a_heating-state]
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'friendly_name': 'Bahnhofsstr. 1A Heating', 'friendly_name': 'Bahnhofsstr. 1A Heating',
'state_class': <SensorStateClass.TOTAL: 'total'>,
'unit_of_measurement': 'units',
}), }),
'context': <ANY>, 'context': <ANY>,
'entity_id': 'sensor.bahnhofsstr_1a_heating', 'entity_id': 'sensor.bahnhofsstr_1a_heating',
@ -491,7 +495,9 @@
'aliases': set({ 'aliases': set({
}), }),
'area_id': None, 'area_id': None,
'capabilities': None, 'capabilities': dict({
'state_class': <SensorStateClass.TOTAL: 'total'>,
}),
'config_entry_id': <ANY>, 'config_entry_id': <ANY>,
'device_class': None, 'device_class': None,
'device_id': <ANY>, 'device_id': <ANY>,
@ -519,13 +525,15 @@
'supported_features': 0, 'supported_features': 0,
'translation_key': <IstaSensorEntity.HEATING: 'heating'>, 'translation_key': <IstaSensorEntity.HEATING: 'heating'>,
'unique_id': '26e93f1a-c828-11ea-87d0-0242ac130003_heating', 'unique_id': '26e93f1a-c828-11ea-87d0-0242ac130003_heating',
'unit_of_measurement': None, 'unit_of_measurement': 'units',
}) })
# --- # ---
# name: test_setup[sensor.luxemburger_str_1_heating-state] # name: test_setup[sensor.luxemburger_str_1_heating-state]
StateSnapshot({ StateSnapshot({
'attributes': ReadOnlyDict({ 'attributes': ReadOnlyDict({
'friendly_name': 'Luxemburger Str. 1 Heating', 'friendly_name': 'Luxemburger Str. 1 Heating',
'state_class': <SensorStateClass.TOTAL: 'total'>,
'unit_of_measurement': 'units',
}), }),
'context': <ANY>, 'context': <ANY>,
'entity_id': 'sensor.luxemburger_str_1_heating', 'entity_id': 'sensor.luxemburger_str_1_heating',