From e6db9ae209a61886604142001fa6d3ee12790be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Fri, 6 Sep 2024 20:57:22 +0200 Subject: [PATCH] Add support for outdoor_temperature in Thermostat cluster --- zha/application/platforms/climate/__init__.py | 8 ++++++++ zha/zigbee/cluster_handlers/hvac.py | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/zha/application/platforms/climate/__init__.py b/zha/application/platforms/climate/__init__.py index a297a432..c0ba9851 100644 --- a/zha/application/platforms/climate/__init__.py +++ b/zha/application/platforms/climate/__init__.py @@ -150,6 +150,7 @@ def state(self) -> dict[str, Any]: response = super().state response["current_temperature"] = self.current_temperature + response["outdoor_temperature"] = self.outdoor_temperature response["target_temperature"] = self.target_temperature response["target_temperature_high"] = self.target_temperature_high response["target_temperature_low"] = self.target_temperature_low @@ -179,6 +180,13 @@ def current_temperature(self): return None return self._thermostat_cluster_handler.local_temperature / ZCL_TEMP + @property + def outdoor_temperature(self): + """Return the outdoor temperature.""" + if self._thermostat_cluster_handler.outdoor_temperature is None: + return None + return self._thermostat_cluster_handler.outdoor_temperature / ZCL_TEMP + @property def fan_mode(self) -> str | None: """Return current FAN mode.""" diff --git a/zha/zigbee/cluster_handlers/hvac.py b/zha/zigbee/cluster_handlers/hvac.py index 4e8e849c..17d07eb4 100644 --- a/zha/zigbee/cluster_handlers/hvac.py +++ b/zha/zigbee/cluster_handlers/hvac.py @@ -208,6 +208,11 @@ def local_temperature(self) -> int | None: """Thermostat temperature.""" return self.cluster.get(Thermostat.AttributeDefs.local_temperature.name) + @property + def outdoor_temperature(self) -> int | None: + """Thermostat outdoor temperature.""" + return self.cluster.get(Thermostat.AttributeDefs.outdoor_temperature.name) + @property def occupancy(self) -> int | None: """Is occupancy detected."""