From d0409e719b707355ff6ad434cae44a291782b077 Mon Sep 17 00:00:00 2001 From: theorlangur Date: Wed, 27 Dec 2023 21:16:03 +0100 Subject: [PATCH] Add ZHA configuration number entity to set/get thermostat cluster local temperature offset (#105765) --- .../zha/core/cluster_handlers/hvac.py | 1 + homeassistant/components/zha/number.py | 19 +++++++++++++++++++ homeassistant/components/zha/strings.json | 3 +++ 3 files changed, 23 insertions(+) diff --git a/homeassistant/components/zha/core/cluster_handlers/hvac.py b/homeassistant/components/zha/core/cluster_handlers/hvac.py index dad3ee5eb4d..5e41785a6d8 100644 --- a/homeassistant/components/zha/core/cluster_handlers/hvac.py +++ b/homeassistant/components/zha/core/cluster_handlers/hvac.py @@ -110,6 +110,7 @@ class ThermostatClusterHandler(ClusterHandler): "max_heat_setpoint_limit": True, "min_cool_setpoint_limit": True, "min_heat_setpoint_limit": True, + "local_temperature_calibration": True, } @property diff --git a/homeassistant/components/zha/number.py b/homeassistant/components/zha/number.py index 53d79d2d35f..24964d7a154 100644 --- a/homeassistant/components/zha/number.py +++ b/homeassistant/components/zha/number.py @@ -20,6 +20,7 @@ from .core.const import ( CLUSTER_HANDLER_COLOR, CLUSTER_HANDLER_INOVELLI, CLUSTER_HANDLER_LEVEL, + CLUSTER_HANDLER_THERMOSTAT, SIGNAL_ADD_ENTITIES, SIGNAL_ATTR_UPDATED, ) @@ -947,3 +948,21 @@ class AqaraThermostatAwayTemp(ZHANumberConfigurationEntity): _attr_mode: NumberMode = NumberMode.SLIDER _attr_native_unit_of_measurement: str = UnitOfTemperature.CELSIUS _attr_icon: str = ICONS[0] + + +@CONFIG_DIAGNOSTIC_MATCH(cluster_handler_names=CLUSTER_HANDLER_THERMOSTAT) +# pylint: disable-next=hass-invalid-inheritance # needs fixing +class ThermostatLocalTempCalibration(ZHANumberConfigurationEntity): + """Local temperature calibration.""" + + _unique_id_suffix = "local_temperature_calibration" + _attr_native_min_value: float = -2.5 + _attr_native_max_value: float = 2.5 + _attr_native_step: float = 0.1 + _attr_multiplier: float = 0.1 + _attribute_name = "local_temperature_calibration" + _attr_translation_key: str = "local_temperature_calibration" + + _attr_mode: NumberMode = NumberMode.SLIDER + _attr_native_unit_of_measurement: str = UnitOfTemperature.CELSIUS + _attr_icon: str = ICONS[0] diff --git a/homeassistant/components/zha/strings.json b/homeassistant/components/zha/strings.json index 00d24fbc82e..8909af8a5ba 100644 --- a/homeassistant/components/zha/strings.json +++ b/homeassistant/components/zha/strings.json @@ -724,6 +724,9 @@ }, "quick_start_time": { "name": "Quick start time" + }, + "local_temperature_calibration": { + "name": "Local temperature offset" } }, "select": {