First post - new to HA! Loving it so much at this point as it’s so much more flexible than my Wink Hub2!
In any event, I’m looking to use this existing flow in node-red which does work just fine but route it to the person who triggered it. Use case being that it should notify the last person to leave the home they forgot to shut off the lights.
So in the first two trigger nodes, I’d like to output something like the entity name and then switch it to the registered name for notifications. It would of course need to make it past all the other nodes and be consumed in the Android Notify node.
Hope that makes sense!
Thanks!
node-red code:
[{"id":"4339fc91.cf8304","type":"tab","label":"Notifications","disabled":false,"info":""},{"id":"7a589892.605ac8","type":"trigger-state","z":"4339fc91.cf8304","name":"Tom Left Home","server":"5265857.3021e7c","entityid":"device_tracker.toms_pixel_2","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"9i2c9sz7d3e","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"},{"id":"pnytw6yb6e","targetType":"entity_id","targetValue":"device_tracker.emilys_pixel_2","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"home"},{"id":"mluovtrmf0h","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"home"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":100,"y":40,"wires":[["e92fe981.dcbb28"],[]]},{"id":"cb7a0dda.a8ef3","type":"template","z":"4339fc91.cf8304","name":"Format Friendly Name","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload.attributes.friendly_name}}","output":"str","x":580,"y":80,"wires":[["1f2f0511.7cb41b"]]},{"id":"1f2f0511.7cb41b","type":"join","z":"4339fc91.cf8304","name":"Join Entities","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":", ","joinerType":"str","accumulate":false,"timeout":"2","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":790,"y":80,"wires":[["8f2f19f8.bf9c98"]]},{"id":"8f2f19f8.bf9c98","type":"api-call-service","z":"4339fc91.cf8304","name":"Notify Android","server":"5265857.3021e7c","service_domain":"notify","service":"android","data":"{\"message\":\"The light(s): {{payload}} is still on.\",\"target\":\"Toms_Pixel_2\"}","mergecontext":"","output_location":"","output_location_type":"none","x":980,"y":80,"wires":[[]]},{"id":"e92fe981.dcbb28","type":"ha-get-entities","z":"4339fc91.cf8304","server":"5265857.3021e7c","name":"Get Light/TV States","rules":[{"property":"entity_id","logic":"includes","value":"light.dining_room_recessed_lights,light.sengled_e11_g13_03027d89_1,light.emily_night_stand,light.kitchen_pendants,light.kitchen_pendants,light.living_room_recessed_lights,switch.entertainment_center,switch.tv_outlet","valueType":"str"},{"property":"state","logic":"is","value":"on","valueType":"str"}],"output_type":"split","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":350,"y":80,"wires":[["cb7a0dda.a8ef3"]]},{"id":"417e8650.f039c8","type":"trigger-state","z":"4339fc91.cf8304","name":"Emily Left Home","server":"5265857.3021e7c","entityid":"device_tracker.emilys_pixel_2","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"9i2c9sz7d3e","targetType":"this_entity","targetValue":"","propertyType":"previous_state","propertyValue":"old_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"},{"id":"whjpxt6hf3","targetType":"entity_id","targetValue":"device_tracker.toms_pixel_2","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"home"},{"id":"y1b0arkmr5","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is_not","comparatorValueDatatype":"str","comparatorValue":"home"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":100,"y":120,"wires":[["e92fe981.dcbb28"],[]]},{"id":"474ac35d.fd35fc","type":"inject","z":"4339fc91.cf8304","name":"Simulate Away","topic":"","payload":"{\"message\":\"not_home\"}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":200,"wires":[["e92fe981.dcbb28"]]},{"id":"5265857.3021e7c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]