mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Add active mode sensor for ViCare FloorHeating devices (#170103)
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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"
|
||||
},
|
||||
|
||||
@@ -1218,6 +1218,68 @@
|
||||
'state': '46',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.model11_mode-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<SensorEntityCapabilityAttribute.OPTIONS: 'options'>: list([
|
||||
'cooling',
|
||||
'heating',
|
||||
'standby',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.model11_mode',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Mode',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENUM: 'enum'>,
|
||||
'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({
|
||||
<EntityStateAttribute.DEVICE_CLASS: 'device_class'>: 'enum',
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'model11 Mode',
|
||||
<SensorEntityCapabilityAttribute.OPTIONS: 'options'>: list([
|
||||
'cooling',
|
||||
'heating',
|
||||
'standby',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.model11_mode',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'heating',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.model11_signal_strength-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
|
||||
Reference in New Issue
Block a user