I’m trying trying to find a way to set a boolean in the action of a certain automation, so that the value of that boolean can be used as a condition in another automation. I’ll describe the scenario I’m using this in, as there may be another way to accomplish what I want.
I have a movement sensor and a relay switch that controls a light (both ZWave but I don’t think that matters in this case). The switch can also be operated with a wall push button. What I want is that when the sensor notices movement, the light goes on (but only when it’s dark outside, although I don’t think this condition matters for my current problem). I also want this light to go off after one minute. However, when the light is manually turned out (i.e. with the wall push button), it should not turn off after a minute.
The way I have set up the ‘turn off after a minute’ is that I have two automations: one turns on the light when movement is detected, another is activated by the ‘light comes on’ event of the light and (with a delay of one minute) turns that light off. So far so good.
But now when I turn on the light with the wall push button, that second automation is also run and the light is turned off again. So my idea is - if I set a boolean in the first automation, then I can check if that boolean is true in the second automation, and I’ll only in that case turn the light off. If I turn it off, I’ll also return the boolean to a “false” state.
I can’t find a way to set a ‘global variable’ that will let me do this though. As mentioned, maybe there is a more HA-idiomatic way to reaching my goal. Thank you.