From 13abfe8fb8843a3f78b0418654cadb06a740fa62 Mon Sep 17 00:00:00 2001 From: aceindy Date: Sat, 15 Apr 2023 14:12:33 +0200 Subject: [PATCH] Update climate.py Only validate when data was received :frowning: --- custom_components/duepi_evo/climate.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/custom_components/duepi_evo/climate.py b/custom_components/duepi_evo/climate.py index 21c3292..7b15cf7 100644 --- a/custom_components/duepi_evo/climate.py +++ b/custom_components/duepi_evo/climate.py @@ -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)