InventoCasa / ha-advanced-blueprints

Advanced Blueprints combined with pyscript for extra useful automations
139 stars 33 forks source link

Update pv_excess_control.py to improve time trigger management #52

Closed stefan73 closed 4 months ago

stefan73 commented 4 months ago

Old code problems to roubstly have running a time_triggered instance of on_time() running. Often there was no instance and the user was also not able to understand subsequent issues. To fix this the multiplicty of instance copies in a global array, a local trigger variable was removed. The logics of trying to have just one on_time() method running was changed. The control code now gets only executed for the first instance in the dictionary, but all automations have a on_time() instance. This seems robust also if users create and delete automations.

InventoCasa commented 4 months ago

Thanks for the new PR! Will review the changes in the evening today.