I have a power limit that I don’t want to exceed for too long. In my 2023 Homey Pro scenario I have three 3kW water boilers which I can switch off for some period to keep my system below this power limit.
When the limit is exceeded I want Boiler1 to be switched off immediately.
If my limit is still exceeded 5 minutes later I want Boiler2 to be switched off
If my limit is still exceeded after another 5 minutes I want Boiler3 to be switched off
How can I achieve this most elegantly using one or three flows?
To switch the boilers ON again (as the power situation may have changed) I plan to put this in their THEN statement:
Boiler-x switch OFF
Delay 60 minutes
Boiler-x switch ON
How can I be absolutely sure that the Delay statement will be maintained and executed (to switch boilers ON again), even if after a power cut?
Does it exist an elegant solution to ‘if Device-x has been switched off for more than 60 minutes’ (then switch it ON again) which I could run every 70 minutes? Just in case IF the above delay statement never executed as expected….
I use the term ‘elegant’ in both questions because there surely are numerous solutions to the above scenarios, but I would like to learn how to write clean and effective code for my Homey…
Timers implemented by Chronograph survive Homey resets. AFAIK a timer like that is the only way to implement your requirement. It’s best done using an advanced flow so all your flows are in one place.
However, I have never used Advanced Flows, so if anyone here mind to write an AF example for the above scenario I would be VERY grateful - which also could be expressed though Paypal
I stongly suggest you find out more about advanced flows. They are a significant benefit to using Homey. There’s an old, but still valid, tutorial here. It includes some examples that might be useful to you.
Here’s a simplified version of a flow I use to monitor charging of my eBike. When the flow starts it kicks off a Tuya automation that should start the bike’s charger and turn it off after 3.5 hours. It also starts a chronograph timer set to four hours.
When Homey detects the charge has turned off, it stops the timer.
If, however, the timer expires (after four hours) and Homey hasn’t seen the charger turn off (maybe there’s been a connection issue) it sends me an alert.