This is my final flow
- PIR activation
- Check if I’m home
Lower:
- Set helper
Internal_location_from
value to previous location based on Internal_location_to
helper (area_name
value)
- Clear payload to empty string (in order for the
join
node to work later)
Upper:
- Fetch PIR
area_name
value via a template to msg.payload
- Wait via
join
node for step 3. to finish, combine payloads (empty string from step 3., area_name
from step 5.
- set helper
Internal_location_to
based on msg.payload
(area_name
value)
[{"id":"a85985f846d9d157","type":"trigger-state","z":"129d4fa1e55fa789","name":"Hall PIR trigger","server":"5e7872b3.6ff53c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.nedis_pir_1_ias_zone","entityidfiltertype":"regex","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"inputs":0,"outputs":3,"customoutputs":[{"messageType":"payload","messageValue":"binary_sensor.nedis_pir_1_ias_zone","messageValueType":"str","comparatorPropertyType":"current_state","comparatorType":"is","comparatorValue":"on","comparatorValueDataType":"str","comparatorPropertyValue":"new_state.state"}],"outputinitially":false,"state_type":"str","enableInput":false,"x":100,"y":260,"wires":[[],[],["69887185cbb30919"]]},{"id":"93b47293430a75fd","type":"trigger-state","z":"129d4fa1e55fa789","name":"Bedroom PIR trigger","server":"5e7872b3.6ff53c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.neo_pir_1_home_security_motion_detection","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"inputs":0,"outputs":3,"customoutputs":[{"messageType":"payload","messageValue":"binary_sensor.neo_pir_1_home_security_motion_detection","messageValueType":"str","comparatorPropertyType":"current_state","comparatorType":"is","comparatorValue":"on","comparatorValueDataType":"str","comparatorPropertyValue":"new_state.state"}],"outputinitially":false,"state_type":"str","enableInput":false,"x":110,"y":340,"wires":[[],[],["69887185cbb30919"]]},{"id":"44a5046256155d8f","type":"trigger-state","z":"129d4fa1e55fa789","name":"Kitchen PIR trigger","server":"5e7872b3.6ff53c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.ikea_tradfri_pir_1_on_off","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"targetType":"this_entity","targetValue":"","propertyType":"current_state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on","propertyValue":"new_state.state"}],"inputs":0,"outputs":3,"customoutputs":[{"messageType":"payload","messageValue":"binary_sensor.ikea_tradfri_pir_1_on_off","messageValueType":"str","comparatorPropertyType":"current_state","comparatorType":"is","comparatorValue":"on","comparatorValueDataType":"str","comparatorPropertyValue":"new_state.state"}],"outputinitially":false,"state_type":"str","enableInput":false,"x":110,"y":420,"wires":[[],[],["69887185cbb30919"]]},{"id":"6dbee0822f61a83b","type":"api-current-state","z":"129d4fa1e55fa789","name":"Read current Internal_location_to","server":"5e7872b3.6ff53c","version":3,"outputs":2,"halt_if":"NULL","halt_if_type":"str","halt_if_compare":"is_not","entity_id":"input_select.internal_location_to","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"},{"property":"payload.area_name","propertyType":"msg","value":"\"\"","valueType":"str"}],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":620,"y":460,"wires":[["a35caf96ad8668f7","af6a735ee93e89ae"],[]]},{"id":"26d79edf5e343eb1","type":"api-render-template","z":"129d4fa1e55fa789","name":"Set PIR area_name as payload","server":"5e7872b3.6ff53c","version":0,"template":"","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":910,"y":280,"wires":[["57294dc344eb5f22"]]},{"id":"58544058f08ca626","type":"change","z":"129d4fa1e55fa789","name":"Find PIR area_name","rules":[{"t":"set","p":"template","pt":"msg","to":"\"{{area_name('xxxxx')}}\"","tot":"str"},{"t":"change","p":"template","pt":"msg","from":"xxxxx","fromt":"str","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":280,"wires":[["26d79edf5e343eb1"]]},{"id":"69887185cbb30919","type":"api-current-state","z":"129d4fa1e55fa789","name":"At home?","server":"5e7872b3.6ff53c","version":3,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","entity_id":"person.petri","state_type":"str","blockInputOverrides":false,"outputProperties":[],"for":0,"forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":340,"y":320,"wires":[["6dbee0822f61a83b","58544058f08ca626"],[]]},{"id":"57294dc344eb5f22","type":"join","z":"129d4fa1e55fa789","name":"Join as strings","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"payload","joiner":"","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1180,"y":280,"wires":[["db617707c776be86"]]},{"id":"db617707c776be86","type":"api-call-service","z":"129d4fa1e55fa789","name":"Set new Internal_location_to","server":"5e7872b3.6ff53c","version":3,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"input_select.internal_location_to","data":"{\"option\":\"{{payload}}\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1400,"y":280,"wires":[[]]},{"id":"a35caf96ad8668f7","type":"api-call-service","z":"129d4fa1e55fa789","name":"Set Internal_location_from","server":"5e7872b3.6ff53c","version":3,"debugenabled":false,"service_domain":"input_select","service":"select_option","entityId":"input_select.internal_location_from","data":"{\"option\":\"{{payload}}\"}","dataType":"json","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1410,"y":460,"wires":[[]]},{"id":"af6a735ee93e89ae","type":"change","z":"129d4fa1e55fa789","name":"Clear msg.payload to empty string","rules":[{"t":"set","p":"payload","pt":"msg","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":380,"wires":[["57294dc344eb5f22"]]},{"id":"5e7872b3.6ff53c","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]