InventoCasa / ha-advanced-blueprints

Advanced Blueprints combined with pyscript for extra useful automations
166 stars 35 forks source link

Error line 246 #57

Open SebM31 opened 5 months ago

SebM31 commented 5 months ago

HI, I a newbie in HA so could you excuse me if my question is silly. I installed and configure your blueprint to optimise my PV panels on my water heater consommation but it doesn't work. in the log file I found this repeated all the time. Could you help me to correct my problem ?

2024-04-07 17:25:07.870 ERROR (MainThread) [custom_components.pyscript.file.pv_excess_control.on_time] Exception in <file.pv_excess_control.on_time> line 246: first_item = next(iter(PvExcessControl.instances.values())) ^ RuntimeError: coroutine raised StopIteration

Thanks

Maik7 commented 4 months ago

Hi, I had the same issue. These messages appear as long as you do not have added any automation. Or all automations you have added are killed.

To fix this bug you need to add

            if not PvExcessControl.instances:  
                return on_time  

before line 246 in pv_excess_control.py first_item = next(iter(PvExcessControl.instances.values()))

But this means, that the error message does not point to the root cause, why your automation is not running. But maybe after the fix you will see the relevant error message.