Skip to content

Commit

Permalink
climate: Return None for current temperature if not returned by device
Browse files Browse the repository at this point in the history
Current code will fall-back to raw value of the SET_TEMP property if the
device does not return a valid, but that has two problems:
- the value can be also unavailable and end up displayed as -3,
- SET_TEMP is the currently set temperature, so displaying it as the
  current room temperature can be confusing to the user.

Fix this by simply returning None if the device does not return the
current room temperature.
  • Loading branch information
tom3q committed Feb 12, 2024
1 parent 7d4c9d2 commit 663a009
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions custom_components/echonetlite/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,8 @@ def device_info(self):
def _set_attrs(self):
"""current temperature."""
_val = self._connector._update_data.get(ENL_HVAC_ROOM_TEMP)
if _val != None and _val != 126:
self._attr_current_temperature = _val
else:
_val = self._connector._update_data.get(ENL_HVAC_SET_TEMP)
if _val == 126:
_val = None
self._attr_current_temperature = _val

"""temperature we try to reach."""
Expand Down

0 comments on commit 663a009

Please sign in to comment.