Hi all, Very much a newbie here; I'm battling to generate a notify output message to HASSIO as a result of a flow.
I'm monitoring the status of a number of devices that present their status as 'on or 'off' I've currently setup a flow for each one like this:
[{"id":"6e11c083.28e6c","type":"server-state-changed","z":"bf0787b8.a439b8","name":"MCU Fridge","server":"c8eb62f2.32f1f","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.thfour_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":104,"y":255,"wires":[[],["d1f5ae05.aa47"]]},{"id":"9f881658.dc8a68","type":"api-call-service","z":"bf0787b8.a439b8","name":"Notify offline","server":"c8eb62f2.32f1f","version":1,"debugenabled":true,"service_domain":"notify","service":"mobile_app_pixel_3_xl","entityId":"","data":"{\"message\":\"Fridge sensor is offline\",\"title\":\"MCU status\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":767,"y":255,"wires":[[]]},{"id":"61b1dc62.f41a44","type":"api-current-state","z":"bf0787b8.a439b8","name":"If still off","server":"c8eb62f2.32f1f","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.thfour_status","state_type":"str","state_location":"data","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":417,"y":255,"wires":[["9a0646c2.f639c8"],[]]},{"id":"9a0646c2.f639c8","type":"delay","z":"bf0787b8.a439b8","name":"1 per hour","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":580,"y":255,"wires":[["9f881658.dc8a68"]]},{"id":"d1f5ae05.aa47","type":"delay","z":"bf0787b8.a439b8","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":264,"y":255,"wires":[["61b1dc62.f41a44"]]},{"id":"c8eb62f2.32f1f","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
As you can see, the output notification is hand coded;
What I'm trying to do is form up the notification using the source device and it's status in the output message notification. This way, I presume I can have only one output node that services the output from all the individual flows.
Something like this:
[{"id":"5a5a1371.ce7c1c","type":"server-state-changed","z":"573fee3d.4152f","name":"MCU thtwo","server":"c8eb62f2.32f1f","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.thtwo_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":179,"y":2312,"wires":[[],["9641a199.b5c2e"]]},{"id":"5f7a7cc.d520784","type":"server-state-changed","z":"573fee3d.4152f","name":"MCU ththree","server":"c8eb62f2.32f1f","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.ththree_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":189,"y":2363,"wires":[[],["3d05d4f4.89e49c"]]},{"id":"bafe53ca.ec92f","type":"server-state-changed","z":"573fee3d.4152f","name":"MCU Fridge","server":"c8eb62f2.32f1f","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.thfour_status","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":189,"y":2414,"wires":[[],["ffe1bc9.0411f4"]]},{"id":"78f4e75b.6baee8","type":"api-call-service","z":"573fee3d.4152f","name":"Notify offline","server":"c8eb62f2.32f1f","version":1,"debugenabled":true,"service_domain":"notify","service":"mobile_app_pixel_3_xl","entityId":"","data":"var x = msg.payload;var y = msg.topicmsg.payload = `Warning. ${y} is reporting as ${x} line, please investigate!`;return msg;","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":886,"y":2363,"wires":[[]]},{"id":"70e8be97.c5a4d","type":"api-current-state","z":"573fee3d.4152f","name":"If still off","server":"c8eb62f2.32f1f","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.thtwo_status","state_type":"str","state_location":"data","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":502,"y":2312,"wires":[["2a0f3033.971c1"],[]]},{"id":"2a0f3033.971c1","type":"delay","z":"573fee3d.4152f","name":"1 per hour","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":665,"y":2312,"wires":[["78f4e75b.6baee8"]]},{"id":"9641a199.b5c2e","type":"delay","z":"573fee3d.4152f","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":349,"y":2312,"wires":[["70e8be97.c5a4d"]]},{"id":"afc50627.67ce08","type":"api-current-state","z":"573fee3d.4152f","name":"If still off","server":"c8eb62f2.32f1f","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.ththree_status","state_type":"str","state_location":"data","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":502,"y":2363,"wires":[["eb2385a5.635a58"],[]]},{"id":"eb2385a5.635a58","type":"delay","z":"573fee3d.4152f","name":"1 per hour","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":665,"y":2363,"wires":[["78f4e75b.6baee8"]]},{"id":"3d05d4f4.89e49c","type":"delay","z":"573fee3d.4152f","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":349,"y":2363,"wires":[["afc50627.67ce08"]]},{"id":"3b7d9ac.200fe66","type":"api-current-state","z":"573fee3d.4152f","name":"If still off","server":"c8eb62f2.32f1f","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.thfour_status","state_type":"str","state_location":"data","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":502,"y":2414,"wires":[["e843bfad.fb179"],[]]},{"id":"e843bfad.fb179","type":"delay","z":"573fee3d.4152f","name":"1 per hour","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"hour","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":665,"y":2414,"wires":[["78f4e75b.6baee8"]]},{"id":"ffe1bc9.0411f4","type":"delay","z":"573fee3d.4152f","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":349,"y":2414,"wires":[["3b7d9ac.200fe66"]]},{"id":"c8eb62f2.32f1f","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
Clearly this isn't working, and I know that concatenating messages using differing variables should be a core skill! I know my coding skills should be better! to be honest, the visual nature of NodeRed is what's drawn me in, but I'm let down now by my lack of syntax knowledge.
I think I'm nearly there, but getting frustrated now as I know the solution will be easy...? I guess brain surgery is easy when you know how... lol
Thanks in advance..