I have no idea what the output of the state_changed
nodes is but assuming that the output includes person.x
and either home
or not_home
or 'location'
this is a bit crude but it works
[{"id":"c7e49db42498d1d2","type":"inject","z":"738628ae578a307b","name":"Caro Home","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stateCaro","payload":"{\"person\":{\"caro\":\"home\"}}","payloadType":"json","x":1370,"y":1340,"wires":[["5348b284714d6d04"]]},{"id":"96a04894b4772f95","type":"inject","z":"738628ae578a307b","name":"Florian Not Home","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stateFlorian","payload":"{\"person\" : {\"florian\" : \"not_home\"}}","payloadType":"json","x":1360,"y":1400,"wires":[["5348b284714d6d04"]]},{"id":"59056b385434cfb3","type":"inject","z":"738628ae578a307b","name":"Caro Not Home","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stateCaro","payload":"{\"person\":{\"caro\":\"not_home\"}}","payloadType":"json","x":1360,"y":1300,"wires":[["5348b284714d6d04"]]},{"id":"996f9ed2a0375fc4","type":"inject","z":"738628ae578a307b","name":"Florian Home","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stateFlorian","payload":"{\"person\":{\"florian\":\"home\"}}","payloadType":"json","x":1370,"y":1440,"wires":[["5348b284714d6d04"]]},{"id":"2ab29179dbb3cf8f","type":"inject","z":"738628ae578a307b","name":"Florian at Work","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"stateFlorian","payload":"{\"person\" : {\"florian\" : \"at_work\"}}","payloadType":"json","x":1380,"y":1480,"wires":[["5348b284714d6d04"]]},{"id":"5348b284714d6d04","type":"join","z":"738628ae578a307b","name":"","mode":"custom","build":"object","property":"payload.person","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1710,"y":1400,"wires":[["cf093039818bfd9b"]]},{"id":"cf093039818bfd9b","type":"change","z":"738628ae578a307b","name":"Home State","rules":[{"t":"set","p":"payload","pt":"msg","to":"$lookup(payload.person.stateCaro, \"caro\") = \"home\" and $lookup(payload.person.stateFlorian,\"florian\") = \"home\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1850,"y":1400,"wires":[["350d92ed1689db41"]]},{"id":"350d92ed1689db41","type":"debug","z":"738628ae578a307b","name":"Home, Not Home","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":2110,"y":1400,"wires":[]}]