Node-Red switch logic not working

I am trying to do a simple holiday lights automation using binary sensors, but I do not seem to be getting the right output from the switch.

I have the 6 holidays input to the switch. If I make it a holiday, I get the correct output, but I have a seventh input (non-holiday) that it should choose if none of the holidays are happening.

By all the reading I have done, if I choose "stopping after first match" and put the seventh leg at the bottom I should be good, but it always outputs the chosen holiday AND the non-holiday input.

Is there something else I am supposed to do?
I have also tried "Otherwise" under the sequence rules with no output at all.

Because messages ALWAYS arrive from different wires at different times.

In other words, each msg going IN to the switch contains its own payload.

  1. st patricks day goes to switch as {payload: "STP"} - so comes out of pin 3
  2. other day goes to switch as {payload: "OTHER"} - so comes out of pin 7

Thanks @Steve-Mcl, your thoughts on what i should change to get the desired output?

You may need to join the messages as an array , with a join node and a timeout, and possible use contains option in the switch node.

or

Rather than use "OTHER" there is an option for otherwise, click chevron next to equals, Also have you selected "Stop after first match" at the bottom of the switch config. You would then remove the HA node for "OTHER" as you would use otherwise if no match.

So if no match it would go to otherwise.

Thank you very much @E1cid, I did figure this out with the info below.
I know its probably crude, but with my testing, it works.

I may be wrong, is the switch node even required in that flow?

Thank you again. you are correct, and not only did I just learn something, but that made it much cleaner.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.