I am new and a little lost.
I have a script that turns on a water valve, starts a timer, waits for timer, turns off all valves, advances to the next valve. Right now, limited to 4 valves but will expand when working better.
Water is available about 50% of the time. There is an automation that triggers on (no water), pauses the timer and closes all valves. A second automation triggers on (water present) and starts the timer. I want to open the valve that was open, to finish the zone. I don’t see a way of knowing what valve was open.
I program in BASIC, there I would have a global variable loaded in the script and read in the automation. I can’t see how variables work. I have read on the subject in several places. Thanks for your ideas.
You need to rethink how you are doing this. It is a bad idea to wait in an automation for long lengths of time. These can be easily interrupted and you may end up with your water left on.
Instead of waiting in the automation for the timer to expire write another automation that triggers when the timer expires.
As for determining which was the last switch turned on, one way would be to use an input select helper. This is your “global variable”. Create it to have options that indicate which irrigation switch is on.
You can set the selected option in your automations.
Thanks for the help.
I am using Timer_Helper and checking the Restore Box. I have tested powering down for one minute while the timer is running. Also tested restart and updating and the timer keeps running. That I have tested at length.
Thanks again, I am learning about Input Select.
Yes, you are right. When I had the irrigation system running in Automations it restarts where it left off. When I moved it to Scripts it does not restart. Maybe I will go back to eWeLink, and use HA as a human interface. Thanks.