Check if state of other entity has changed

Hi all,
I’m a bit stuck on how to do the following:
I’ve got a two-way switch connected to a shelly Ix3, so I basically have two boolean states.
Now, whenever I flip switch A, i’d like light A to toggle.
And, whenever i flip switch B, i’d like light B to toggle.
However, when i flip them both at the same time (which means within x milliseconds after each other), i’d like to do any other action, let’s call this action C.

For that, i was thinking something like:
When A is switched, check current state of B (Bstate1). Then after x milliseconds, check B again (Bstate2). If it hasn’t changed, this was a single A switch. If B is different then before (Bstate2 != Bstate1), then call action C.
Offcourse the same would apply for switch B in regards to A.

Anyone an idea on how to fix this in Node-Red?

wait until node.
That means you trigger on one switch then enter wait until node and here you wait for the other switch.
This node has two outputs, if the other switch got true/on/what you want, or if you reached the timeout which you set at x milliseconds.

1 Like