TASK:
I have Sonoff Relay.
I have motion sensor.
I have remote button.
There are two modes:
Motion sensor goes on and Sonoff Relay turns on too. Motion sensor goes off and Sonoff Relay turns off too.
That is ok. No problem.
Sometimes I want to use remote button to forbid Sonoff Relay turns off by motion sensor.
I press remote button → Sonoff Relay will turn on and will be turned on till next press of remote button instead of motion sensor states.
How to do so?
My idea was to create some new state, as example SUPERlight=“on/off”. Pressing remote button will turn on Sonoff Relay and will change SUPERlight state to “on”.
In automation for motion sensors will be condition: work only when SUPERlight state=“off”.
How to create new state?
The same I could do with global variable. How to create global variable?
Or maybe you give me some other idea of programming specific of home assistant. Thanks for reading this!
Create an input_boolean called input_boolean.kukhnia to serve as an indicator when the switch was turned on by the button. When input_boolean.kukhnia is on, the automation will not allow the motion sensor to control the switch.
Here is a single automation that controls the switch using the motion sensor and button as triggers and controls the switch based on the input_boolean’s state.