forked from peter/volvo2mqtt
Remove done climate timers from "Active schedules" sensor
This commit is contained in:
+7
-1
@@ -138,7 +138,7 @@ def start_climate_timer(d, vin):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if timer_seconds > 0:
|
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())
|
active_schedules[vin]["timers"].append(start_datetime.isoformat())
|
||||||
logging.debug("Climate timer set to " + str(start_datetime))
|
logging.debug("Climate timer set to " + str(start_datetime))
|
||||||
update_car_data()
|
update_car_data()
|
||||||
@@ -184,6 +184,12 @@ def stop_climate(vin):
|
|||||||
update_car_data()
|
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):
|
def start_climate(vin):
|
||||||
global assumed_climate_state, climate_timer, engine_status
|
global assumed_climate_state, climate_timer, engine_status
|
||||||
# Start the api call in another thread for HA performance
|
# Start the api call in another thread for HA performance
|
||||||
|
|||||||
Reference in New Issue
Block a user