I am trying to use a zone around my house with the person.xyz attribute array to determine who is home.
I am currently using the zone to detect if the house is occupied or not, but I would like to add more logic to it to change automations based on if specific people are home. I want to use the array of persons that is inside the payload of the zone entity to made choices. In order to do that I need a way to search if an element is in the array or if an element is not in the array.
So far I have been able to use the switch node to search if an element is in the array, but I cannot search to see if an element is not in the array.
Here is what I have so far.
[{"id":"987bf3df0fa8b61d","type":"api-current-state","z":"fb29e58f011f5e34","name":"","server":"58bff01.29ea91","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is_not","entity_id":"zone.home","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"},{"property":"people","propertyType":"msg","value":"data.attributes.persons","valueType":"jsonata"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":330,"y":1120,"wires":[["335e6f45a261e80a"]]},{"id":"df9c6157d8539c6e","type":"inject","z":"fb29e58f011f5e34","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":1120,"wires":[["987bf3df0fa8b61d"]]},{"id":"38e70424fe2c9a71","type":"debug","z":"fb29e58f011f5e34","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":1120,"wires":[]},{"id":"335e6f45a261e80a","type":"switch","z":"fb29e58f011f5e34","name":"","property":"people","propertyType":"msg","rules":[{"t":"cont","v":"personName","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":530,"y":1120,"wires":[["38e70424fe2c9a71"]]},{"id":"58bff01.29ea91","type":"server","name":"Home Assistant","addon":true}]
I am hoping someone can provide a little guidance on the best way to handle this. It is a little tricky because want different things to happen if different people are home alone vs home with someone else etc.