I try to explain better ....
For each light in my house I have physical smart switch Vimar .....
Another example, in my kitchen I have 2 light, 1 tv, 1 coffee machine and 1 tablet ....
At lunchtime, on the tablet dashboard I press the button "LUNCH TIME" and with a function I turn-on tv, coffee machine and before to turn-on the two light I read the variables; if the variables are "OFF" I send the command "ON".
Well, I wanted to know if there is a way to do without the variables ......
So if the light is off you turn it on. What do you do if the light is already on? If you do nothing then just send the On command anyway, it should not matter if the light is already on.
I use Join nodes for tackling problems like this, rather than flow/global context. You can feed the current state into a Join node, and also the On/OFF request and then in the output of the Join node you have the current state and the request. See this article in the cookbook for an example of how to join messages into one object.