Master presence status based on Input Selects

I have two input_selects set up to indicate my wife’s and my presence, for instance “input_select.john_presence” and “input_select.jane_presence”.

These can be values “Home”, “Away”, “Just Arrived” and “Just Left”.

I’m trying to create Master presence input select drop down based on the values of these two input_selects in Node Red. But I can’t figure out how to do some kind of AND function on the state change of them and generate an output to set the Master Presence input_select.

For instance if “input_select.john_presence” = “home” AND “input_select.jane_presence” = “home” then set an input_select.master_presence or even a sensor (if you can create a sensor from NR - maybe a device tracker?) to home or away.

The goal is to be able to trigger automatons based on the master presence.

Does that make sense at all? lol.

Use a group in HA might be the easiest. And then watch for state changes of that in NR

Won’t that just create a group for my two input_selects and display them? Rather then let me create a new entity based on their states? The group itself won’t have a state, IOW. It’ll just show my two entities in the group.

Since I’m using Lovelace the only thing I use groups for is their logic of combining entities.

The group page has good info

Here’s the first line, “Groups allow the user to combine multiple entities into one.”
I give them view: false.
Note the “all” attribute that means that they all must be the same value for the group to be that value, i.e. all true for the group to be true. The standard functionality is that only one needs to be true for the group to be true. I don’t use the all attribute for my purposes.

However, now that I reread your original post. I’m not sure a group is the best way to go. I guess because of all the options each family member has the group may not AND to the one you want – i.e. one member is home and another is away, might AND to away or something weird. Maybe just chain two current state nodes? If input_select.A is “home” then check input_select.B for “home”. Use the halt-if parameter or a switch node after the first if you need more than 2 outputs. Or write a function node…

I made this up for someone a while back.

[{"id":"c10b02d6.4c222","type":"trigger-state","z":"5eb3594f.d294b8","name":"Home / Away","server":"ef067c6f.620e6","entityid":"^input_select\\.(homer|marge)$","entityidfiltertype":"regex","debugenabled":false,"constraints":[{"id":"thlima8vpbf","targetType":"entity_id","targetValue":"input_select.marge","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"includes","comparatorValueDatatype":"list","comparatorValue":"Away,Extended Away"},{"id":"152z09ugs5i","targetType":"entity_id","targetValue":"input_select.homer","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"includes","comparatorValueDatatype":"list","comparatorValue":"Away,Extended Away"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":true,"state_type":"str","x":102,"y":608,"wires":[["73a4c8b0.fa7ef8"],["bc41061e.20e958"]]},{"id":"73a4c8b0.fa7ef8","type":"change","z":"5eb3594f.d294b8","name":"off","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"service\": \"turn_off\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":306,"y":608,"wires":[["bc41061e.20e958"]]},{"id":"bc41061e.20e958","type":"api-call-service","z":"5eb3594f.d294b8","name":"","server":"ef067c6f.620e6","service_domain":"input_boolean","service":"turn_on","data":"{\"entity_id\":\"input_boolean.master_presence\"}","render_data":false,"mergecontext":"","output_location":"payload","output_location_type":"msg","x":376,"y":656,"wires":[[]]}]

edit:
here’s the original post "condition" with 3 input_selects

Regarding presence detection and NR…

…why not just use the person component to create a global variable that’s set when NR starts and periodically (every minute or so) to test to see if the conditions are met, all in NR, without using any additional input selects, etc.? Then, base all of your NR automations off of this variable…no?

For example:

[{"id":"6bd45b24.a35b84","type":"inject","z":"37b43f9e.7e99","name":"Presence Detection","topic":"","payload":"","payloadType":"date","repeat":"30","crontab":"","once":true,"onceDelay":"5","x":245,"y":435,"wires":[["1fd0c5cb.fd4c8a"]]},{"id":"1fd0c5cb.fd4c8a","type":"api-render-template","z":"37b43f9e.7e99","name":"Who's Home?","server":"453178ab.f3be18","template":"{% if is_state('person.homer','home') == True %}\n{% set homer = 1 %}\n{% else %}\n{% set homer = 0 %}\n{% endif %}\n{% if is_state('person.marge','home') == True %}\n{% set marge = 1 %}\n{% else %}\n{% set marge = 0 %}\n{% endif %}\n{{ ([homer, marge] | join) }}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":265,"y":494,"wires":[["a4a79fa1.a1cef"]]},{"id":"a4a79fa1.a1cef","type":"switch","z":"37b43f9e.7e99","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"00","vt":"str"},{"t":"eq","v":"01","vt":"str"},{"t":"eq","v":"10","vt":"str"},{"t":"eq","v":"11","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":474,"y":495,"wires":[[],[],[],[]]},{"id":"453178ab.f3be18","type":"server","z":"","name":"Home Assistant"}]

thank you so much for your code.