From a530051bbd7d846d6672310bf293b6635529595a Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Mon, 14 Oct 2024 19:29:34 +0200 Subject: [PATCH] FIX #518 TypeError: unsupported operand type(s) for -: 'int' and 'NoneType' (#559) Co-authored-by: Jean-Marc Collin --- custom_components/versatile_thermostat/thermostat_climate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/versatile_thermostat/thermostat_climate.py b/custom_components/versatile_thermostat/thermostat_climate.py index fb4cefa..24b6366 100644 --- a/custom_components/versatile_thermostat/thermostat_climate.py +++ b/custom_components/versatile_thermostat/thermostat_climate.py @@ -692,8 +692,9 @@ class ThermostatOverClimate(BaseThermostat[UnderlyingClimate]): else None ) + last_sent_temperature = under.last_sent_temperature or 0 under_temp_diff = ( - (new_target_temp - under.last_sent_temperature) if new_target_temp else 0 + (new_target_temp - last_sent_temperature) if new_target_temp else 0 ) if -1 < under_temp_diff < 1: under_temp_diff = 0