InventoCasa / ha-advanced-blueprints

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

Switch off lower prio appliances to switch on higher prio appliances #72

Open Maik7 opened 3 months ago

Maik7 commented 3 months ago

55

Maik7 commented 3 months ago

thanks this looks good, just noted some typos, may be worth noting that there will be a spike in power over the produced power before the lower priority ones are turned off

:-) Yes, but in general this is the normal behavior of this script. An appliance is switched off, if the produced power isn't sufficient. And many appliances do not need the full power directly after being switched on. And the lower prioritized appliances will be switched off only a few ms later. Therefore I think it is better this way, than to wait one minute before switching on.

Thank you very much for your suggestions, all of them are now in this PR.

Maik7 commented 3 months ago

just 2 typos

Thank you :-)

carlossg commented 3 months ago

One thing that I noticed that is not going to work well. If you have devices with no power measurement that are not consuming at the time then the algorithm will overestimate how much power can be freed, then turn on the higher priority appliance just to turn it off in the next minute, and so on. I wonder if we should be conservative and when inst.actual_power is None do not assume that power is reducible