# Msg.payload help

**URL:** <https://discourse.nodered.org/t/msg-payload-help/16611>\
**Category:** General\
**Created:** [11 October 2019 19:34 UTC](https://discourse.nodered.org/t/msg-payload-help/16611 "2019-10-11T19:34:58Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 19:34 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/1 "2019-10-11T19:34:58Z")

</div>

Hello All,

I am having issues converting a message payload ex ample value from debug "15" to '15'. I need the payload to be in the format 'x' so that my function node will work.

```auto
[{"id":"4d9bb02d.3c221","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"f0379573.07efb8","type":"inject","z":"4d9bb02d.3c221","name":"","topic":"","payload":"\"ip\":10.10.10.10\"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":2000,"y":280,"wires":[["c1ad69cb.940f48","789e8b45.05cc24"]]},{"id":"c1ad69cb.940f48","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2210,"y":280,"wires":[["e4a308f7.2638f8","409633ae.7428ac"]]},{"id":"e4a308f7.2638f8","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"ip","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2410,"y":280,"wires":[["5b20cab0.d9d224","b3a10295.f21af"]]},{"id":"5b20cab0.d9d224","type":"split","z":"4d9bb02d.3c221","name":"","splt":":","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":2570,"y":280,"wires":[["6671f7b4.7e6248","30294987.0bd8c6"]]},{"id":"6671f7b4.7e6248","type":"switch","z":"4d9bb02d.3c221","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"10.10","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":2710,"y":280,"wires":[["6a44a2ae.c0bd8c","7c690a00.459d38"],[]]},{"id":"6a44a2ae.c0bd8c","type":"json","z":"4d9bb02d.3c221","name":"","property":"payload","action":"str","pretty":false,"x":2850,"y":280,"wires":[["89572b0b.3b98f8","db28a337.e513e"]]},{"id":"89572b0b.3b98f8","type":"function","z":"4d9bb02d.3c221","name":"","func":"var m =msg.payload[0].value;\nreturn msg;","outputs":1,"noerr":0,"x":2990,"y":280,"wires":[["3939e7b5.1b0588","396d35be.8f75fa"]]},{"id":"3939e7b5.1b0588","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3170,"y":280,"wires":[["3fc9d158.1a921e"]]},{"id":"3fc9d158.1a921e","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3320,"y":220,"wires":[]},{"id":"789e8b45.05cc24","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2210,"y":200,"wires":[]},{"id":"409633ae.7428ac","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2370,"y":220,"wires":[]},{"id":"b3a10295.f21af","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2530,"y":220,"wires":[]},{"id":"30294987.0bd8c6","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2670,"y":220,"wires":[]},{"id":"7c690a00.459d38","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2830,"y":220,"wires":[]},{"id":"db28a337.e513e","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2990,"y":220,"wires":[]},{"id":"396d35be.8f75fa","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3137,"y":224,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [11 October 2019 19:53 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/2 "2019-10-11T19:53:22Z")

</div>

The msg.payload originating from the inject node is;

![inject](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/bf7c7550110f69182c0aade00a5d1a5b27177dcf.jpeg)  
Are you sure that is correct?

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 19:54 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/3 "2019-10-11T19:54:59Z")

</div>

I used the inject node to pass the message that is obtain from a text input node. The full flow has this msg.payload the saved to the pi the retrieved from the pi. Full flow below.

```auto
[{"id":"4d9bb02d.3c221","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"5bbc5d7b.141e84","type":"ui_text_input","z":"4d9bb02d.3c221","name":"IP Address of Controller","label":"IP Address of Controller","tooltip":"","group":"3487420a.cf479e","order":4,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"","x":1450,"y":140,"wires":[["74a3ba2.5c55d44"]]},{"id":"74a3ba2.5c55d44","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1890,"y":140,"wires":[["362e5ad6.79f686"]]},{"id":"362e5ad6.79f686","type":"join","z":"4d9bb02d.3c221","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2110,"y":140,"wires":[["a217d379.2c718","285ec233.4d192e"]]},{"id":"285ec233.4d192e","type":"function","z":"4d9bb02d.3c221","name":"Data Capture","func":"var d = new Date();\nvar t = d.getTime();\nvar n = d.getTimezoneOffset();\npayload={\"date/time\": d,\"Time Zone Diffrence in minutes\": n,\"IP\": msg.ip,\"Bacnet\": msg.Bacnet, \"Function\": msg.Function, \"type\": msg.ObjectID,\"App Tag\": msg.Apptag, \"Property ID\": msg.PropertyID, \"Write Value\": msg.Wvalue, \"payload\":msg.payload};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"x":2350,"y":360,"wires":[["e62980d8.db7fb"]]},{"id":"a217d379.2c718","type":"ui_text","z":"4d9bb02d.3c221","group":"998b684b.3b4e88","order":2,"width":0,"height":0,"name":"","label":"IP Address","format":"{{ip}}","layout":"col-center","x":2350,"y":120,"wires":[]},{"id":"e62980d8.db7fb","type":"json","z":"4d9bb02d.3c221","name":"","property":"payload","action":"","pretty":false,"x":2510,"y":360,"wires":[["44ddf002.82251"]]},{"id":"44ddf002.82251","type":"file","z":"4d9bb02d.3c221","name":"Add Device file location","filename":"/home/pi/hvac/NewDevice.log","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":2710,"y":360,"wires":[[]]},{"id":"b34ea623.c1c078","type":"ui_button","z":"4d9bb02d.3c221","name":"","group":"3487420a.cf479e","order":10,"width":0,"height":0,"passthru":false,"label":"Check Device (can take up to 2 mins)","tooltip":"","color":"red","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"","x":1410,"y":740,"wires":[["83a04ee8.e326"]]},{"id":"83a04ee8.e326","type":"file in","z":"4d9bb02d.3c221","name":"","filename":"/home/pi/hvac/NewDevice.log","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":1730,"y":740,"wires":[["5f393ae0.505b44"]]},{"id":"5f393ae0.505b44","type":"split","z":"4d9bb02d.3c221","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1950,"y":740,"wires":[["603d4f79.e86cd"]]},{"id":"603d4f79.e86cd","type":"switch","z":"4d9bb02d.3c221","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"IP\":","vt":"str"},{"t":"cont","v":"\"Bacnet\":","vt":"str"},{"t":"cont","v":"\"Function\":","vt":"str"},{"t":"cont","v":"\"type\":","vt":"str"},{"t":"cont","v":"\"App Tag\":","vt":"str"},{"t":"cont","v":"\"Property ID\":","vt":"str"},{"t":"cont","v":"\"Write Value\":","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":2110,"y":740,"wires":[["e62753b2.604bc"],[],[],[],[],[],[]]},{"id":"e62753b2.604bc","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2350,"y":640,"wires":[["fa58e6f8.8b1918"]]},{"id":"fa58e6f8.8b1918","type":"join","z":"4d9bb02d.3c221","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"7","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2610,"y":760,"wires":[["e3fb75ff.25a1e8"]]},{"id":"e3fb75ff.25a1e8","type":"switch","z":"4d9bb02d.3c221","name":"","property":"Function","propertyType":"jsonata","rules":[{"t":"cont","v":"\"Function\":\"Read Function\"","vt":"str"},{"t":"cont","v":"\"Function\":\"Write Function\"","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":2750,"y":760,"wires":[["bf633d4d.c1e2"],[]]},{"id":"bf633d4d.c1e2","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"ip","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2930,"y":520,"wires":[["c740d937.ea3ee8"]]},{"id":"c740d937.ea3ee8","type":"split","z":"4d9bb02d.3c221","name":"","splt":":","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":3130,"y":520,"wires":[["252d88ba.f77438"]]},{"id":"252d88ba.f77438","type":"switch","z":"4d9bb02d.3c221","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"192.168","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":3270,"y":520,"wires":[["fd4a523e.519ac"],[]]},{"id":"fd4a523e.519ac","type":"json","z":"4d9bb02d.3c221","name":"","property":"payload","action":"","pretty":false,"x":3410,"y":520,"wires":[["92887c96.4d0bb"]]},{"id":"92887c96.4d0bb","type":"function","z":"4d9bb02d.3c221","name":"","func":"var m =msg.payload[0].value;\nreturn msg;","outputs":1,"noerr":0,"x":3630,"y":520,"wires":[["9ee535e2.af73d8"]]},{"id":"9ee535e2.af73d8","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3810,"y":520,"wires":[["785296e9.076078"]]},{"id":"785296e9.076078","type":"join","z":"4d9bb02d.3c221","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"10","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":4020,"y":600,"wires":[["d73b2463.42ad28"]]},{"id":"d73b2463.42ad28","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4190,"y":540,"wires":[]},{"id":"3487420a.cf479e","type":"ui_group","z":"","name":"Manual Device check","tab":"99082a6.ab01ed8","order":2,"disp":true,"width":"10","collapse":true},{"id":"998b684b.3b4e88","type":"ui_group","z":"","name":"Verify Data","tab":"99082a6.ab01ed8","order":3,"disp":true,"width":"6","collapse":true},{"id":"99082a6.ab01ed8","type":"ui_tab","z":"","name":"Testing","icon":"dashboard","order":12,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [11 October 2019 20:05 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/4 "2019-10-11T20:05:20Z")

</div>

I haven't tried your full flow because it's about 4 screen widths wide!!, but I would suggest looking at the format of the input, as the screenshot that I pasted above of what you are injecting is clearly not structured correctly.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [11 October 2019 20:24 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/5 "2019-10-11T20:24:08Z")

</div>

Looks like exactly the same issue as your post yesterday. Please don’t open new issues for the same issue

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 20:25 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/6 "2019-10-11T20:25:42Z")

</div>

Not the same issue. I was able to remove the doubles quotes, by adding a json node and a function node. The new issue is the msg.payload need to be in a string format with ' instead of ".

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 20:31 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/7 "2019-10-11T20:31:03Z")

</div>

See below i cleaned it up a little more. The input works for the 5 other values that is being collected.

Now the only thing is the string format needs to be changed from " to '.

```auto
[{"id":"4d9bb02d.3c221","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"5bbc5d7b.141e84","type":"ui_text_input","z":"4d9bb02d.3c221","name":"IP Address of Controller","label":"IP Address of Controller","tooltip":"","group":"7d8dabf3.e28c04","order":4,"width":0,"height":0,"passthru":false,"mode":"text","delay":"0","topic":"","x":190,"y":80,"wires":[["74a3ba2.5c55d44"]]},{"id":"74a3ba2.5c55d44","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":80,"wires":[["362e5ad6.79f686"]]},{"id":"362e5ad6.79f686","type":"join","z":"4d9bb02d.3c221","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":610,"y":80,"wires":[["a217d379.2c718","285ec233.4d192e"]]},{"id":"285ec233.4d192e","type":"function","z":"4d9bb02d.3c221","name":"Data Capture","func":"var d = new Date();\nvar t = d.getTime();\nvar n = d.getTimezoneOffset();\npayload={\"date/time\": d,\"Time Zone Diffrence in minutes\": n,\"IP\": msg.ip,\"Bacnet\": msg.Bacnet, \"Function\": msg.Function, \"type\": msg.ObjectID,\"App Tag\": msg.Apptag, \"Property ID\": msg.PropertyID, \"Write Value\": msg.Wvalue, \"payload\":msg.payload};\nmsg.payload=payload;\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":80,"wires":[["e62980d8.db7fb"]]},{"id":"a217d379.2c718","type":"ui_text","z":"4d9bb02d.3c221","group":"7d8dabf3.e28c04","order":2,"width":0,"height":0,"name":"","label":"IP Address","format":"{{ip}}","layout":"col-center","x":790,"y":40,"wires":[]},{"id":"e62980d8.db7fb","type":"json","z":"4d9bb02d.3c221","name":"","property":"payload","action":"","pretty":false,"x":950,"y":80,"wires":[["44ddf002.82251"]]},{"id":"44ddf002.82251","type":"file","z":"4d9bb02d.3c221","name":"Add Device file location","filename":"/home/pi/hvac/NewDevice.log","appendNewline":true,"createDir":true,"overwriteFile":"true","encoding":"none","x":1150,"y":80,"wires":[[]]},{"id":"b34ea623.c1c078","type":"ui_button","z":"4d9bb02d.3c221","name":"","group":"7d8dabf3.e28c04","order":10,"width":0,"height":0,"passthru":false,"label":"Check Device (can take up to 2 mins)","tooltip":"","color":"red","bgcolor":"","icon":"","payload":"1","payloadType":"str","topic":"","x":170,"y":260,"wires":[["83a04ee8.e326"]]},{"id":"83a04ee8.e326","type":"file in","z":"4d9bb02d.3c221","name":"","filename":"/home/pi/hvac/NewDevice.log","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":490,"y":260,"wires":[["5f393ae0.505b44"]]},{"id":"5f393ae0.505b44","type":"split","z":"4d9bb02d.3c221","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":710,"y":260,"wires":[["603d4f79.e86cd"]]},{"id":"603d4f79.e86cd","type":"switch","z":"4d9bb02d.3c221","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"\"IP\":","vt":"str"},{"t":"cont","v":"\"Bacnet\":","vt":"str"},{"t":"cont","v":"\"Function\":","vt":"str"},{"t":"cont","v":"\"type\":","vt":"str"},{"t":"cont","v":"\"App Tag\":","vt":"str"},{"t":"cont","v":"\"Property ID\":","vt":"str"},{"t":"cont","v":"\"Write Value\":","vt":"str"}],"checkall":"true","repair":false,"outputs":7,"x":850,"y":260,"wires":[["e62753b2.604bc"],[],[],[],[],[],[]]},{"id":"e62753b2.604bc","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":220,"wires":[["fa58e6f8.8b1918"]]},{"id":"fa58e6f8.8b1918","type":"join","z":"4d9bb02d.3c221","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"7","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1210,"y":220,"wires":[["e3fb75ff.25a1e8"]]},{"id":"e3fb75ff.25a1e8","type":"switch","z":"4d9bb02d.3c221","name":"","property":"Function","propertyType":"jsonata","rules":[{"t":"cont","v":"\"Function\":\"Read Function\"","vt":"str"},{"t":"cont","v":"\"Function\":\"Write Function\"","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1350,"y":220,"wires":[["bf633d4d.c1e2"],[]]},{"id":"bf633d4d.c1e2","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"ip","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1510,"y":220,"wires":[["c740d937.ea3ee8"]]},{"id":"c740d937.ea3ee8","type":"split","z":"4d9bb02d.3c221","name":"","splt":":","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1670,"y":220,"wires":[["252d88ba.f77438"]]},{"id":"252d88ba.f77438","type":"switch","z":"4d9bb02d.3c221","name":"","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"192.168","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1810,"y":220,"wires":[["fd4a523e.519ac"],[]]},{"id":"fd4a523e.519ac","type":"json","z":"4d9bb02d.3c221","name":"","property":"payload","action":"","pretty":false,"x":1950,"y":220,"wires":[["92887c96.4d0bb"]]},{"id":"92887c96.4d0bb","type":"function","z":"4d9bb02d.3c221","name":"","func":"var m =msg.payload[0].value;\nreturn msg;","outputs":1,"noerr":0,"x":2090,"y":220,"wires":[["9ee535e2.af73d8"]]},{"id":"9ee535e2.af73d8","type":"change","z":"4d9bb02d.3c221","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"ip","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":2270,"y":220,"wires":[["785296e9.076078"]]},{"id":"785296e9.076078","type":"join","z":"4d9bb02d.3c221","name":"","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"10","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":2450,"y":220,"wires":[["d73b2463.42ad28"]]},{"id":"d73b2463.42ad28","type":"debug","z":"4d9bb02d.3c221","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":2590,"y":220,"wires":[]},{"id":"7d8dabf3.e28c04","type":"ui_group","z":"","name":"TEST","tab":"","disp":false,"width":"12","collapse":false}]

```

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 20:40 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/8 "2019-10-11T20:40:28Z")

</div>

@Paul-Reed Below is a screen shot of the function node that it leads to.  
but the msg.payload has to be in ' format not " to work.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/cdde98095b415dbe2171aa50b7dcac9120b74144.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 October 2019 20:45 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/9 "2019-10-11T20:45:59Z")

</div>

Of the flow you've shared, which bit are we meant to be looking at?

From the screenshot you've just shared, do you mean you want to use the value of `msg.ip` in the place where you currently have the string `'10.10.10.10'` ?

Have you tried doing exactly that... replacing `'10.10.10.10'` with `msg.ip`?

In JavaScript, a String type can be surrounded by either `"` or `'` - they are both valid (as long as they match at both ends).

If you pass a String type to Debug, it will display it surrounded by `"` to help indicated its a String type - but the `"` is not part of the actual data.

So the fact you have `'10.10.10.10'` surrounded by `'` is kinda irrelevant - it would work just as well with `"10.10.10.10"` as that is exactly the same value.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [11 October 2019 20:50 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/10 "2019-10-11T20:50:44Z")

</div>

I see Nick is replying, but I'll have a go.

I loaded your most recent flow.

1 - looking at the flow you posted I have to agree with @Paul-Reed. It is a wide flow.  
Sure there is nothing wrong with that, but it makes it harder to get your head around.  
2 - I am not seeing where the data is originating.

The top part of the flow does have a `text input` node. But it still isn't clear to me what is going on.

The lower part of the flow starts with a `push button` that injects a `1`. I'm still not getting it.

You have just posted another part which includes a picture of a screen shot of a function node I can't find in the flow you posted.

I'd better stop now as I see Nick has beaten me to posting.

His questions will be better worded to find the problem than mine.

But another thing that may help is to put a few `debug` nodes in the flow so people can see how the message is _developing_ through the flow.

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 21:00 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/11 "2019-10-11T21:00:18Z")

</div>

The full flow can not be imported it is over the limit. I agree that normally it does not matter if surrounded by ' or ". But in order for the function to work the payload has to be surrounded by '.

the text input is being stored as a payload then converted from payload to. IP then joined with the other payloads that was converted. then they are displayed to the dashboard to make sure data is right before sending the full string with all the msg.x's to a log file on the pi (the reason for this is to have a log of that has been done). Then i am pulling the data from a log file and recompiling everything to be sorted on a value defined in the first flow. Then dumping and the msg.payloads into one function that i have to normally type all the values in to work. In the last screen shot i uploaded you can see by the var i have in the function this works for all except the var I = msg.ip; the reason for this is the msg.ip value is in the " format instead of the ' format.

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 21:01 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/12 "2019-10-11T21:01:56Z")

</div>

I hope that made sense. and i am grateful that you all are trying to help.

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 21:03 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/13 "2019-10-11T21:03:27Z")

</div>

Here is the dashboard view.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3271dd4411906eba0548d511b839d4a56cc383b8.jpeg)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 October 2019 21:05 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/14 "2019-10-11T21:05:15Z")

</div>

> [@Navybrandon](#):
>
> The full flow can not be imported it is over the limit. I agree that normally it does not matter if surrounded by ' or ". But in order for the function to work the payload has to be surrounded by '.

Please pass a message to Debug to display the value of `msg.ip` and show us the result so we can see for certain exactly what you've got.

Why does your function require the string to be surrounded by `'`?

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 21:13 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/15 "2019-10-11T21:13:16Z")

</div>

That you for helping. I am also going to do screen shots.

Data being entered and sent

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/f/f53fd6d2d5be71e5d438831658349950bee540f3.jpeg)

error on the node red side

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/353abaf56d60af05a26dc765100bc89784dda92e.png)

It works when the function is like below

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/72109557991f8ed1afe2c6a84475bdfa671fa816.png)

dashboard view when working

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/6efdd00501938fd0c67976e80167068039faa7ac.jpeg)

i hope this helps.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [11 October 2019 21:16 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/16 "2019-10-11T21:16:11Z")

</div>

> [@Navybrandon](#):
>
> i hope this helps.

Not really, you have not answered what Nick asked...  
Posting lots of screenshots is clouding your issue, it would be better to describe in words

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 21:19 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/17 "2019-10-11T21:19:16Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/0d0aab6d237b61ec31b37be38d243e284e9274db.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 October 2019 21:19 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/18 "2019-10-11T21:19:23Z")

</div>

> [@Navybrandon](#):
>
> It works when the function is like below

Sorry, but I can't do a line by line comparison across two screenshots to figure out what you've changed.

When you say 'error on the node red side' which error in particular are we meant to be looking at?  
When you say it works, there still an error in the sidebar... so what has worked?

---

<div class="post-metadata">

**Author:** ![Navybrandon](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/navybrandon/32/13021_2.png) [@Navybrandon](https://discourse.nodered.org/u/Navybrandon)\
**Post date:** [11 October 2019 21:22 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/19 "2019-10-11T21:22:41Z")

</div>

The function of the read node sends out 2 payloads one has the payload of the values and the other does not. The one that does not have a payload returns the error.

it works whe i manually input the ip address as '192.168.1.41' but will not work if i use msg.ip or a var i put in place of msg.ip because the value that is being sent does not have 'before and after the ip address.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/63d8542622ff6d7451f5b1043fc3d37b2fa42d57.png)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [11 October 2019 21:28 UTC](https://discourse.nodered.org/t/msg-payload-help/16611/20 "2019-10-11T21:28:52Z")

</div>

> [@Navybrandon](#):
>
> it works whe i manually input the ip address as '192.168.1.41' but will not work if i use msg.ip or a var i put in place of msg.ip because the value that is being sent does not have 'before and after the ip address.

No. That is _not_ what is happening here.

```auto
client.readProperty('192.168.1.41', { .........

```

There is _absolutely nothing_ special about the fact it has `'` around it.

The follow is exactly the same:

```auto
client.readProperty("192.168.1.41", { .........

```

So is this:

```auto
let myIP = "192.168.1.41";
client.readProperty(myIP, { .......

```

and this:

```auto
let myIP = '192.168.1.41';
client.readProperty(myIP, { .......

```

It has nothing to do with what quotes are used.

> [@Navybrandon](#):
>
> The function of the read node sends out 2 payloads one has the payload of the values and the other does not. The one that does not have a payload returns the error.

Do you want it to return two payloads? I see you have `return msg` at the end - that will be returning one message, and you also have `node.send(msg)` inside the `client.readProperty` callback which sets the payload and then sends it again.

If you don't want two messages, and only want the one with the payload, then don't do `return msg` at the end of the function.

[Next page](https://discourse.nodered.org/t/msg-payload-help/16611.md?page=2)
