diff --git a/homeassistant/components/vicare/sensor.py b/homeassistant/components/vicare/sensor.py index 41fb2cc34ed3..dd52d40aae22 100644 --- a/homeassistant/components/vicare/sensor.py +++ b/homeassistant/components/vicare/sensor.py @@ -8,6 +8,7 @@ from typing import override from PyViCare.PyViCareDevice import Device as PyViCareDevice from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig +from PyViCare.PyViCareFloorHeating import FloorHeating from PyViCare.PyViCareHeatingDevice import ( HeatingDeviceWithComponent as PyViCareHeatingDeviceComponent, ) @@ -1274,6 +1275,16 @@ CIRCUIT_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( SUPPLY_TEMPERATURE_SENSOR, ) +FLOOR_HEATING_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( + ViCareSensorEntityDescription( + key="active_mode", + translation_key="active_mode", + device_class=SensorDeviceClass.ENUM, + options=["cooling", "heating", "standby"], + value_getter=lambda api: api.getActiveMode(), + ), +) + BURNER_SENSORS: tuple[ViCareSensorEntityDescription, ...] = ( ViCareSensorEntityDescription( key="burner_starts", @@ -1509,6 +1520,18 @@ def _build_entities( for description in GLOBAL_SENSORS if is_supported(description.key, description.value_getter, device.api) ) + # add device-class-specific entities + if isinstance(device.api, FloorHeating): + entities.extend( + ViCareSensor( + description, + get_device_serial(device.api), + device.config, + device.api, + ) + for description in FLOOR_HEATING_SENSORS + if is_supported(description.key, description.value_getter, device.api) + ) # add component entities for component_list, entity_description_list in ( (get_circuits(device.api), CIRCUIT_SENSORS), diff --git a/homeassistant/components/vicare/strings.json b/homeassistant/components/vicare/strings.json index 314dfd44e23f..92e2608b0a8d 100644 --- a/homeassistant/components/vicare/strings.json +++ b/homeassistant/components/vicare/strings.json @@ -161,6 +161,14 @@ } }, "sensor": { + "active_mode": { + "name": "Mode", + "state": { + "cooling": "Cooling", + "heating": "Heating", + "standby": "[%key:common::state::standby%]" + } + }, "boiler_supply_temperature": { "name": "Boiler supply temperature" }, diff --git a/tests/components/vicare/snapshots/test_sensor.ambr b/tests/components/vicare/snapshots/test_sensor.ambr index 186bb6680c3b..c203876e7b35 100644 --- a/tests/components/vicare/snapshots/test_sensor.ambr +++ b/tests/components/vicare/snapshots/test_sensor.ambr @@ -1218,6 +1218,68 @@ 'state': '46', }) # --- +# name: test_all_entities[sensor.model11_mode-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + 'cooling', + 'heating', + 'standby', + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.model11_mode', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Mode', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Mode', + 'platform': 'vicare', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'active_mode', + 'unique_id': 'gateway11_zigbee_################-active_mode', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[sensor.model11_mode-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'enum', + : 'model11 Mode', + : list([ + 'cooling', + 'heating', + 'standby', + ]), + }), + 'context': , + 'entity_id': 'sensor.model11_mode', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'heating', + }) +# --- # name: test_all_entities[sensor.model11_signal_strength-entry] EntityRegistryEntrySnapshot({ 'aliases': list([