How to create an AND or OR event state?

If my son is leaving the house I do start an timer.
I’m using a state node to test if he is leaving the house


How to start a timer if my son is leaving AND my doughter in law did leave allready the house?
Or other way around my daughter in law is leaving and my son left already?

so in general, you need to start a timer at the moment when no one of them remaining in the house?

yes
after 3 minutes the light switches off in there room after both are away

I’m using similar pattern, quickly mocked up one for you. Not tested though.

The idea is to:

  1. define persons list (as regular expression), see first two nodes: person\.(name1|name2)
  2. react on state change of any of them (home or not home)
  3. count how many of those persons are at home (0 or more)
  4. if zero, start delay, otherwise, reset delay
  5. if delay node still handles some message after a time, it will pass it to service node turning the lights off

hope it will work for you. Idea is clean and pretty neat especially in case of more persons (no need to create net of connections to check multiple persons)
but there might be some mistakes since it’s not tested.

[{"id":"6b942e5f.ffe45","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"283bf8c2.72ca08","type":"ha-get-entities","z":"6b942e5f.ffe45","server":"6cdd0bc8.b8e434","name":"How many persons in house","rules":[{"property":"entity_id","logic":"is","value":"person\\.(name1|name2)","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":520,"y":220,"wires":[["ee918ced.20c918"]]},{"id":"ee918ced.20c918","type":"switch","z":"6b942e5f.ffe45","name":"zero or more","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"0","vt":"num"},{"t":"gt","v":"0","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":750,"y":220,"wires":[["7ec70534.059114"],["41c269c0.9a84b"]]},{"id":"6618a58e.9e08c4","type":"server-state-changed","z":"6b942e5f.ffe45","name":"Some person state changed","server":"6cdd0bc8.b8e434","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"person\\.(name1|name2)","entityidfiltertype":"regex","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":240,"y":220,"wires":[["283bf8c2.72ca08"]]},{"id":"7ec70534.059114","type":"delay","z":"6b942e5f.ffe45","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1020,"y":220,"wires":[["1020e3ae.656db4"]]},{"id":"41c269c0.9a84b","type":"change","z":"6b942e5f.ffe45","name":"reset","rules":[{"t":"set","p":"reset","pt":"msg","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":890,"y":320,"wires":[["7ec70534.059114"]]},{"id":"1020e3ae.656db4","type":"api-call-service","z":"6b942e5f.ffe45","name":"","server":"6cdd0bc8.b8e434","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1250,"y":220,"wires":[[]]},{"id":"6cdd0bc8.b8e434","type":"server","name":"Home Assistant"}]

Also you can consider to create in HA group of persons (ie children), then simply check for changing its state.

Thanks for this option
It helps
I didn’t know the entity possibility of “regular expression”
The last option is also nice