Multiple inputs into a switch (solved)

I’ve been using HA with node-red for a few months now and have a few basic flows set up, but I’m trying to wrap my head around the best way to do this one:

Trigger (door sensor) --> poll status of 2 people (wife and I) —> the possible outcomes HH AA HA (H-Home A-Away) based on the outcome of this I have three different things I want to happen. What is the best way to set up the first part of this flow? I’m thinking have my EVENT STATE trigger the flow followed by two separate CURRENT STATE nodes for my wife and I. After that I’d assume a SWITCH node would work but not sure how to configure the two payloads into possible switch outputs.

Set the state location for the two current state nodes to something like wife and husband. Then in the switch node do 3 different JSOnata expressions with something like

husband = "home" and wife = "home"
husband = "away" and wife = "away"
husband = "home" and wife = "away"

Ok thanks for the help. So in the state location field do I still leave it as msg. And leave entity location as msg. data?

Yes, leave it as msg. You can actually set msg.data to None unless you plan on using those later in your flow.

Ok I tried getting this to work and havent had any luck. Here is what I have so far:

https://pastebin.com/raw/HqVN9MXm

1 Like

Thanks! That did the trick