I have 4 entities in Home assistant that I need to switch a switch when they all change state

Hi guys, I use Home assistant, I have 2 entities that are phones and show either Home or away and 2 entities that either show Kitchen or not_home
I need ro create a group or 2 groups that when all 4 items show away or not_home the node triggers and then i can switch a switch I think that makes sense

Have you asked in the Home Assistant forum?

no I haven't tbh

I dont know how HA nodes work at all but if the messages they emit have a topic (or you can add a topic) then you should be able to gather all statuses into a single payload object using a join node (in object mode). Once the separate message payloads have been combined into a single payload object, it is very easy to compare the values in JSONata or a function node.

See this article in the cookbook for an example of how to join messages into one object.

Hi Keith, Welcome back to the forum

Most of the guys on here do not use HA and as such will not have all the state nodes etc from the Webhooks contrib nodes in their palette.

Have a look from last week there was a longish thread i ws helping someone on - who essentially wanted to do the same as you

He had 4 doors - if ANY of them were open then a light needed to be turned on and stay on until they were all closed.

Have a look at that as i got him to to use the Current State node and install the Node-red-Contrib Boolean ultimate package.

Post up some screenshots of what you have already and also your flow and i will see what i can do to help

Craig

cheers i'll take a look