Good morning,
I am new in this so be patient if I am not using the correct words.
I am trying to get notification from several sensors about their battery levels. The picture below shows my flow, which it is working and provides me with a notification if the percentage of the battery is below what I set in the switch node.
As it is now, I can only get the numeric value of the battery sensors but not the name of the sensor (or node) where the information are caming from. Althought is feasible, I would like to NOT repeat the same for each sensor and hardcoded the sensor's node name in the Function node.
I would like to know and how can the node name be collected and passed together with the battery level so the notification will have the sensor (node Name) and the battery value.
Is this possible?
Thank you for your help
M
[{"id":"9731ebee.c6c868","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"c91a5df8.a2bc58","type":"function","z":"9731ebee.c6c868","name":"Data","func":"msg.payload = \n{\n \"data\": \n {\n \"message\": msg.payload + \" %\"\n }\n}\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":490,"y":240,"wires":[["5c61ed5.44ce994","6bd72ad6.8219cc"]]},{"id":"5c61ed5.44ce994","type":"api-call-service","z":"9731ebee.c6c868","name":"Notify IOS","server":"8ff04ac7.39cc7","version":1,"debugenabled":true,"service_domain":"notify","service":"mobile_app_mauros_iphone","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":650,"y":200,"wires":[[]]},{"id":"383943bb.98c064","type":"debug","z":"9731ebee.c6c868","name":"Battery","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":280,"y":180,"wires":[]},{"id":"5dbe0b68.ff7314","type":"switch","z":"9731ebee.c6c868","name":"Check Battery","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"90","vt":"str"},{"t":"gte","v":"100","vt":"str"}],"checkall":"true","repair":true,"outputs":2,"x":300,"y":240,"wires":[["c91a5df8.a2bc58","383943bb.98c064"],[]]},{"id":"50a1bbb9.b782cc","type":"inject","z":"9731ebee.c6c868","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"30","payloadType":"num","x":80,"y":140,"wires":[["5dbe0b68.ff7314"]]},{"id":"6bd72ad6.8219cc","type":"debug","z":"9731ebee.c6c868","name":"TS data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":260,"wires":[]},{"id":"20d1f13.c57c50e","type":"server-state-changed","z":"9731ebee.c6c868","name":"guest battery","server":"8ff04ac7.39cc7","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.ble_battery_guest","entityidfiltertype":"exact","outputinitially":false,"state_type":"num","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":70,"y":200,"wires":[["5dbe0b68.ff7314"]]},{"id":"25840ef.5bcc872","type":"server-state-changed","z":"9731ebee.c6c868","name":"Family Battery","server":"8ff04ac7.39cc7","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.ble_battery_family","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"num","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":70,"y":280,"wires":[["5dbe0b68.ff7314"]]},{"id":"8ff04ac7.39cc7","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]