And I have another idea for you.
I would say it’s better and more flexible, because it doesn’t require changing the flow with each person added to home.
The idea behind is to count persons matching particular conditions. Counting entities is provided by Get Entities node
Here is the code you can import to your Node-Red:
[ { "id": "ae0f2f18.6cbb7", "type": "ha-get-entities", "z": "bcb4b1c6.803708", "server": "6cdd0bc8.b8e434", "name": "How many persons in house", "rules": [ { "property": "entity_id", "logic": "is", "value": "person\\.*", "valueType": "re" }, { "property": "state", "logic": "is", "value": "home", "valueType": "str" } ], "output_type": "count", "output_empty_results": false, "output_location_type": "msg", "output_location": "payload", "output_results_count": 1, "x": 480, "y": 220, "wires": [ [ "affb329d.8fa8f" ] ] }, { "id": "affb329d.8fa8f", "type": "switch", "z": "bcb4b1c6.803708", "name": "zero or more", "property": "payload", "propertyType": "msg", "rules": [ { "t": "gt", "v": "0", "vt": "str" }, { "t": "eq", "v": "0", "vt": "num" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 710, "y": 220, "wires": [ [ "ee603327.68635" ], [ "fcfa14ef.2feb28" ] ] }, { "id": "d46b853a.df0c78", "type": "server-state-changed", "z": "bcb4b1c6.803708", "name": "Some person state changed", "server": "6cdd0bc8.b8e434", "version": 1, "exposeToHomeAssistant": false, "haConfig": [ { "property": "name", "value": "" }, { "property": "icon", "value": "" } ], "entityidfilter": "person\\.*", "entityidfiltertype": "regex", "outputinitially": true, "state_type": "str", "haltifstate": "", "halt_if_type": "str", "halt_if_compare": "is", "outputs": 1, "output_only_on_state_change": true, "x": 200, "y": 220, "wires": [ [ "ae0f2f18.6cbb7" ] ] }, { "id": "6cdd0bc8.b8e434", "type": "server", "z": "", "name": "Home Assistant" } ]