I am trying to make an automation that triggers when a reptile light is on for x hours. Depending on the season (autumn-12 hours, summer-14 hours, winter-10 hours, spring-10 hours). I created four separate automation that should trigger at those intervals and check the season… if the season matches, it turns off the reptile light. I cannot get this automation to run reliably for some reason. See a sample automation below. Any suggestions?
So while it is possible to wait long periods of time in a wait or delay, it is generally not recommended. This is because HA restarts and many other possible things can happen which interrupt this 'wait’ and then it hangs as you describe.
The suggested method is have a trigger or an automation for turning it on, and another trigger or another automation for turning it off.
Your trigger happens, then waits 12 hours, so id HA reboots or there is some kind of interruption, the trigger resets.
You may want to look at a time pattern for these, they work differently…
I came to the conclusion that the “for” parameter doesn’t always trigger an automation. I used your suggested code and made us of a helper. Looks like it works as intended. Much appreciated!