Join/Merge msg.payload with text/string

Hi.
I'm trying to construct a flow which I'll check all end devices (with battery) to get their battery level and send me a notification weekly, for instance.
So I need to collect some states from entities, create only one "message/text" and send it as a notification.
I get the values (two of them on this example), but I just get the number (the main info) and it is correct, but I'd like to add the text (the name of each device, for instance) but I don't know how could I change it.
Could anyone help me, please?
Thanks.

[{"id":"d080e9c42da40370","type":"tab","label":"Battery - Status","disabled":false,"info":"","env":[]},{"id":"9679fb12eb0a6e6d","type":"debug","z":"d080e9c42da40370","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":540,"y":240,"wires":[]},{"id":"cd3d227d8ed2f4a0","type":"inject","z":"d080e9c42da40370","name":"Timer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":120,"wires":[["1493492c7d77d7ba","d0150ec0a139be5a"]]},{"id":"1493492c7d77d7ba","type":"api-current-state","z":"d080e9c42da40370","name":"Lock - Main","server":"fad61953.26ffa8","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.sala_fechadura_battery","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":270,"y":60,"wires":[["c0f7cde410f9c2eb"],[]]},{"id":"d0150ec0a139be5a","type":"api-current-state","z":"d080e9c42da40370","name":"Lock - Kitchen","server":"fad61953.26ffa8","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.cozinha_fechadura_battery","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":280,"y":120,"wires":[["c0f7cde410f9c2eb"],[]]},{"id":"f6a98c037a1bfe72","type":"join","z":"d080e9c42da40370","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":590,"y":80,"wires":[["9679fb12eb0a6e6d"]]},{"id":"c0f7cde410f9c2eb","type":"batch","z":"d080e9c42da40370","name":"","mode":"count","count":"2","overlap":0,"interval":10,"allowEmptySequence":false,"topics":[],"x":450,"y":80,"wires":[["f6a98c037a1bfe72"]]},{"id":"fad61953.26ffa8","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"}]

Hi have you looked at the template node.
e.g.

[{"id":"cd3d227d8ed2f4a0","type":"inject","z":"d080e9c42da40370","name":"Timer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":120,"wires":[["1493492c7d77d7ba","d0150ec0a139be5a"]]},{"id":"1493492c7d77d7ba","type":"api-current-state","z":"d080e9c42da40370","name":"Lock - Main","server":"fad61953.26ffa8","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.sala_fechadura_battery","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":270,"y":60,"wires":[["30ac16fd.1a9aea"],[]]},{"id":"d0150ec0a139be5a","type":"api-current-state","z":"d080e9c42da40370","name":"Lock - Kitchen","server":"fad61953.26ffa8","version":3,"outputs":2,"halt_if":"0","halt_if_type":"num","halt_if_compare":"gte","entity_id":"sensor.cozinha_fechadura_battery","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":280,"y":120,"wires":[["c8ae02e0.d49b2"],[]]},{"id":"30ac16fd.1a9aea","type":"change","z":"d080e9c42da40370","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"main","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":60,"wires":[["f6a98c037a1bfe72"]]},{"id":"c8ae02e0.d49b2","type":"change","z":"d080e9c42da40370","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"kitchen","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":120,"wires":[["f6a98c037a1bfe72"]]},{"id":"f6a98c037a1bfe72","type":"join","z":"d080e9c42da40370","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":690,"y":80,"wires":[["8173e9ac.4ba678"]]},{"id":"8173e9ac.4ba678","type":"template","z":"d080e9c42da40370","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"this will join {{payload.main}} with {{payload.kitchen}}","output":"str","x":460,"y":200,"wires":[["9679fb12eb0a6e6d"]]},{"id":"9679fb12eb0a6e6d","type":"debug","z":"d080e9c42da40370","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":650,"y":180,"wires":[]}]

If you look in the Current state node that you are using you can retrive multiple bits of data - in your case you are retrieving the entity and putting that in msg.data

so you can access this property and do with it what you want

Craig

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.