Skip to content

Commit

Permalink
Update climate.py
Browse files Browse the repository at this point in the history
Only validate when data was received 😦
  • Loading branch information
aceindy authored Apr 15, 2023
1 parent d0149ac commit 13abfe8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions custom_components/duepi_evo/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,13 @@ async def get_data(self, support_setpoint) -> None:
error_code_decimal = int(data_from_server[1:5], 16)
error_code = (self._error_code_map[error_code_decimal] if error_code_decimal < 15 else str(error_code_decimal))

# Get Setpoint temperature
# Get & validate target temperature (Setpoint)
sock.send(GET_SETPOINT.encode())
data_from_server = sock.recv(10).decode()
if len(data_from_server) != 0:
target_temperature = int(data_from_server[1:5], 16)

# Validate the returned value
if (target_temperature != 0 and self._min_temp < target_temperature < self._max_temp):
support_setpoint = True
if (target_temperature != 0 and self._min_temp < target_temperature < self._max_temp):
support_setpoint = True

except asyncio.TimeoutError:
_LOGGER.error("Time-out while polling host: %s", self._host)
Expand Down

0 comments on commit 13abfe8

Please sign in to comment.