Use one switch to control multiple lights


Hi, i have home assistant with nodered and some sonoff basic flashed with tasmota, i use GPIO pins to control the relays but by switchtopic (mqtt, not directly) and i want to create a flow based in how many times i turn the switch on or off (its a switch not a press button) for example:
on - ceiling light
on/off/on - desk light
is it possible ? i've searched a lot on internet and found anything



If tasmota already in use, then I suggest to replace switch with pushbutton and then you can use the "long press" (HOLD command) option.

1 Like


What about using a Join node with a timeout (you could also use multiple join nodes in parallel with # of message parts / timeout to not have to wait for the timeout before sending). Then feed it to a switch node that evaluates the joined string looking for the combination in question. Something like this:

1 Like


thanks, i have one regular wall switch and one pushbutton attatched to the sonoff basic, the switch is just to be a regular switch like without any sonoff stuff, and the push i've already changed the topic to control another sonoff and im itself
But i want to keep the wall switch and make it "more clever" than just control one light...



Thanks a lot, im going to try it, im a bit newbie on node red automation but i think i can make it, soon i'l give you some feedback
Again thanks, apreciate your help

1 Like


Sorry for taking a while to answer but this was what i've been looking for, thanks !! really appreciate it

1 Like