Homey Community Forum

Issue with toggle action in light flow

well, so I got a toggle action, triggered by pressing a button, that switches several lights (zigbee, lifx) on or off. But then I also got a motion sensor which turns on one pair of lights (lifx).
Now, if I press the button to switch on all lights it switches off the pair that has been switched on before.
I was wondering if there’s something like a flow card with “Do nothing” or how else I can avoid this behavior.
I also created an extra flow that tells if “button pressed” and “light is On” then “Switch On” but this looks not very elegant. I’m pretty sure I’m missing something…

An ideas how to improve this.

The more elegant solution is: “button pressed” and “light is OFF”, then “switch on”. Explanation: If the light is already on then nothing is done (“Do nothing”).
But I think that is the way to go.

aha, thanks i’ll try this one

Note: The flow only works to turn on lights. If single lights are already on, they will stay on.
To turn off all lights, additional flows and a variable are needed if this is to be done with only one button.

I’m using the toggle action for it and it works/ed except if some lights were already on
image

The not so helpful but true answer would be: avoid toggle buttons. Separate on and off buttons have the great advantage that the user can reveal his/her true intent to Homey. Turn on the other lights as well as the lifx, or turn everything off.

If you insist on using togglebuttons, it depends on what you want to happen. One way may be to not toggle the lifx if the motion sensor is armed (detects motion).

If toggle button is pressed and no motion is detected then toggle the lifx

I’m a little bit confused, because you said that you made an extra flow.
As @Edwin_D already said, to toggle the lamps will definitely not work. If you push the button to toggle ALL lights (this is the action card you use), lights are on will go off and lights are off will go on. That’s it. That’s the meaning of the action card.

Maybe this is a solution:

Flow 1
When…
– On/off button was pressed
And…
– Variable “Lights on/off” is NO
Then…
– Set variable “Lights on/off” to YES
Else…
– Set variable “Lights on/off” to NO

Flow 2
When…
– Variable “Lights on/off” has changed
And…
– Variable “Lights on/off” is YES
Then…
– Switch on all lamps
Else…
– Switch off all lamps

But of course, it depends a little bit of your goal.

thanks for the input, let me revisit this after work

So, I’m reading this suggestion but can’t get my head around what the benefit of using a variable is.

My use case is that I’d like to use a toggle button (Ikea remote) for a bigger number of bulbs and sometimes a group of lights is ON due to a motion sensor and I want them to stay ON in this case. So, ideally, I can tell a flow to keep those ON that are already ON.

The variable is used to switch ALL lamps on, independent of if lamps have already been switched on. The toggle function you are using would turn off lamps that are already on. And that is not what you want. And if you push the Ikea remote again, ALL lamps will be switched off.
Btw, I suggest to try the flows instead of just reading it.

You can also use the variable to “disable/stop” the flows that automatically turn off the lights after a certain time (when the motion alarm has gone off). But you’re not providing much details, sorry.

thanks, I’m away from Home(y) atm - will check later

Finally I tried it, and it works! Only the final step “Switching off” doesn’t work. It stays with “Switch on all lamps”.

Please share your flows to have a look on it.

had the wrong variable in use, it works now.
I’m just not sure if other flows which turn on all lights are affected. I got a few flows which change the light color and dim state and switch on all lights…

I don’t know either, because I don’t know how you build your flows… :man_shrugging:t3:

I still don’t understand your recipe 100%, before I didn’t even know there’s “Else”. I will spend some time and then see if I can build on it. Thanks very much for the enlightenment anyway :slight_smile: