# Node name or friendly name for notification

**URL:** <https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228>\
**Category:** General\
**Created:** [12 February 2022 16:33 UTC](https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228 "2022-02-12T16:33:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![N3RO815](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/n3ro815/32/56293_2.png) [@N3RO815](https://discourse.nodered.org/u/N3RO815)\
**Post date:** [12 February 2022 16:33 UTC](https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228/1 "2022-02-12T16:33:53Z")

</div>

Hello.  
These are my first steps with Node Red and Home Assistant. I have some battery-powered devices where I would like to send a notification when the battery runs low.

This has been my idea so far:

 ![screen_20220212_172003](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/6/b6b7a9a47c2002ceecad29de39176ec85802a7e9.png)

```auto
[{"id":"0ef04dc37c3d2c33","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"be534ff6981c7c7c","type":"api-call-service","z":"0ef04dc37c3d2c33","name":"Benachrichtigung R. Handy","server":"ea544f4f.d7486","version":4,"debugenabled":false,"domain":"notify","service":"mobile_app_rmx1993_roman","target":{"entityId":[],"areaId":[],"deviceId":[]},"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":60,"wires":[[]]},{"id":"948391439ac32016","type":"server-state-changed","z":"0ef04dc37c3d2c33","name":"Wohnzimmer Fensterkontakt","server":"ea544f4f.d7486","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.wohnzimmer_fensterkontakt_hinten_battery","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":40,"wires":[["dc4008089b6c239e"]]},{"id":"dc4008089b6c239e","type":"switch","z":"0ef04dc37c3d2c33","name":"Status bat_low","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"bat_low","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":60,"wires":[["e44370e6cd475414"]]},{"id":"e44370e6cd475414","type":"function","z":"0ef04dc37c3d2c33","name":"Msg","func":"msg.payload = {\"data\":{\"message\":\"Batterie von\" + \" ist schwach! \",\"title\":\"Wichtige Nachricht von HomeAssistant!\",\"data\":{\"group\":\"Batterie\"}}};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":60,"wires":[["be534ff6981c7c7c"]]},{"id":"4a41b1aaac511640","type":"server-state-changed","z":"0ef04dc37c3d2c33","name":"Küche Fensterkontakt","server":"ea544f4f.d7486","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.kueche_fensterkontakt_battery","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","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,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":140,"y":100,"wires":[["dc4008089b6c239e"]]},{"id":"ea544f4f.d7486","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":false,"heartbeat":false,"heartbeatInterval":""}]

```

I hope this works the way I want it to. How do I get the name of the node or the friendly name in the function node? So that the name of the device is instead of the +.

function node:

```auto
msg.payload = {"data":{"message": "Batterie von" "+" " ist schwach! ","title":"Wichtige Nachricht von HomeAssistant!","data":{"group":"Batterie"}}};
return msg;

```

Or does someone have a better idea to implement my project? I would be very grateful for help.

Thank you.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 February 2022 19:42 UTC](https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228/2 "2022-02-12T19:42:05Z")

</div>

You can't get the name of an upstream node, the nodes are designed to be independent of each other.

What you should do is to get the device name from the incoming msg. I don't use HA so I don't know what data you get but there should be something in the incoming msgs that indicates the device name.

---

<div class="post-metadata">

**Author:** ![N3RO815](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/n3ro815/32/56293_2.png) [@N3RO815](https://discourse.nodered.org/u/N3RO815)\
**Post date:** [13 February 2022 08:37 UTC](https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228/3 "2022-02-13T08:37:53Z")

</div>

Ok thanks. I'll have to see how I can solve this.

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [13 February 2022 12:58 UTC](https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228/4 "2022-02-13T12:58:58Z")

</div>

Normally such nodes send a topic to identify the origin.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 April 2022 12:59 UTC](https://discourse.nodered.org/t/node-name-or-friendly-name-for-notification/58228/5 "2022-04-14T12:59:34Z")

</div>

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