Skip to content

Commit

Permalink
Add support for outdoor_temperature in Thermostat cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
zagor committed Sep 6, 2024
1 parent c6edfd4 commit e6db9ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions zha/application/platforms/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Check warning on line 188 in zha/application/platforms/climate/__init__.py

View check run for this annotation

Codecov / codecov/patch

zha/application/platforms/climate/__init__.py#L188

Added line #L188 was not covered by tests

@property
def fan_mode(self) -> str | None:
"""Return current FAN mode."""
Expand Down
5 changes: 5 additions & 0 deletions zha/zigbee/cluster_handlers/hvac.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit e6db9ae

Please sign in to comment.