Remove done climate timers from "Active schedules" sensor

This commit is contained in:
Linus Dietz
2023-07-31 08:56:16 +02:00
parent f5c8d06aa1
commit d49afa5bed
+7 -1
View File
@@ -138,7 +138,7 @@ def start_climate_timer(d, vin):
return None
if timer_seconds > 0:
Timer(timer_seconds, start_climate, (vin, )).start()
Timer(timer_seconds, activate_climate_timer, (vin, start_datetime.isoformat(), )).start()
active_schedules[vin]["timers"].append(start_datetime.isoformat())
logging.debug("Climate timer set to " + str(start_datetime))
update_car_data()
@@ -184,6 +184,12 @@ def stop_climate(vin):
update_car_data()
def activate_climate_timer(vin, start_time):
start_climate(vin)
active_schedules[vin]["timers"].remove(start_time)
update_car_data()
def start_climate(vin):
global assumed_climate_state, climate_timer, engine_status
# Start the api call in another thread for HA performance