From eadd101cb707c790369ff6d8b14856839496ddc1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Collin Date: Mon, 14 Oct 2024 17:23:58 +0000 Subject: [PATCH] FIX #518 TypeError: unsupported operand type(s) for -: 'int' and 'NoneType' --- 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 @@ async def end_climate_changed(changes: bool): 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