# Move data (not payload) from one node to another

**URL:** <https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731>\
**Category:** General\
**Created:** [4 October 2020 16:23 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731 "2020-10-04T16:23:08Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [4 October 2020 16:23 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/1 "2020-10-04T16:23:08Z")

</div>

HI all,

I am trying to take the rgb\_color value from a light and take that value and set that as the value for the rgb\_color in another node for a different node.

I just can't seem to move the value via any methods i know.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/8/e88779e6ad71e8546a272143c06379a7c63988db.png)

I am sure it is very simple, but i just cant get it.

Many thanks in advance for any help with this.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [4 October 2020 16:25 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/2 "2020-10-04T16:25:58Z")

</div>

Have you tried a change node set to move?

There’s a great page in the docs that will explain how to use the debug panel to find the right path to any data item.

> **[Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)**

---

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [4 October 2020 16:41 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/3 "2020-10-04T16:41:55Z")

</div>

thank you, i was using change rather than set.

I can now get the array data, so effectivly payload[0] payload[1] and payload [3]

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/55d5bc161d4b7fcbc8f639c716a94cf5206fdd70.png)

when i try both:

```auto
{
    "rgb_color": "{{payload[0],payload[1],payload[2]}}",
    "brightness": "35",
    "effect": "None"
}

```

and

```auto
{
    "rgb_color": "{{payload}}",
    "brightness": "35",
    "effect": "None"
}

```

I just cant seem to do anything with it.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 October 2020 16:48 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/4 "2020-10-04T16:48:31Z")

</div>

Where are you putting that code and if you add a debug node showing what is coming out then what do you see?  
**[Edit]** Also what do you _want_ to see coming out?  
**[Further Edit]** Guessing that you are putting that in a function node and that what you want is `"rgb_color": "100,100,100"` then you must use javascript, not moustache notation. So you want something like (untested)

```auto
rgb_color: `"${payload[0]},${payload[1],${payload[2]}"`

```

See [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template\_literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)

---

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [4 October 2020 16:52 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/5 "2020-10-04T16:52:00Z")

</div>

thats the data part of a home assistant call service node:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/5/75588202087256113348955ab94db7f72e9c3ef9.png)  
all i get is an error

```auto
"Call-service API error. Error Message: None for dictionary value @ data['rgb_color']"

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [4 October 2020 17:04 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/6 "2020-10-04T17:04:13Z")

</div>

> [@Jmilesy](#):
>
> thats the data part of a home assistant call service node:

I believe that is the first time you have mentioned HA. I have no knowledge of HA.

---

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [4 October 2020 17:33 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/7 "2020-10-04T17:33:03Z")

</div>

sorry,

HA forums saying its a node red issue - as i can enter the value directly, just not transfer the value

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [4 October 2020 17:40 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/8 "2020-10-04T17:40:01Z")

</div>

sorry replied to wrong person

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [4 October 2020 17:46 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/9 "2020-10-04T17:46:06Z")

</div>

I think it need to be an array

Does the node config input allow mustache templete?

```auto
{
    "rgb_color": [{{payload}}],
    "brightness": "35",
    "effect": "None"
}

```

---

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [4 October 2020 18:33 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/10 "2020-10-04T18:33:13Z")

</div>

it does when  
" DataJSON

- Accepts [Mustache Templates](https://zachowj.github.io/node-red-contrib-home-assistant-websocket/guide/mustache-templates.html) when data type is JSON"

I have checked it is passing a JSON array in payload

but that has not changed the error unfortunatly.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [4 October 2020 18:37 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/11 "2020-10-04T18:37:01Z")

</div>

What home Assistant node are you using?

---

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [4 October 2020 19:16 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/12 "2020-10-04T19:16:35Z")

</div>

its the call service node part of node-red-contrib-home-assistant-websocket

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [4 October 2020 20:52 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/13 "2020-10-04T20:52:52Z")

</div>

Not much of a how to in the info of that node. I did not see any links to more documentation.  
Try using the change node to create the msg, and use msg in the data input field.  
e.g.

```auto
[{"id":"187967a.a95e618","type":"inject","z":"4484ee28.caa3c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[255, 0 , 1]","payloadType":"json","x":150,"y":500,"wires":[["67f3f52c.e2114c"]]},{"id":"67f3f52c.e2114c","type":"change","z":"4484ee28.caa3c","name":"","rules":[{"t":"set","p":"hold","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"brightness\":\"35\",\"effect\":\"None\"}","tot":"json"},{"t":"set","p":"payload.rgb_color","pt":"msg","to":"hold","tot":"msg"},{"t":"delete","p":"hold","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":500,"wires":[["269a25ff.79887a"]]},{"id":"269a25ff.79887a","type":"debug","z":"4484ee28.caa3c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":590,"y":360,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![michaelblight](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/michaelblight/32/445_2.png) [@michaelblight](https://discourse.nodered.org/u/michaelblight)\
**Post date:** [5 October 2020 01:57 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/14 "2020-10-05T01:57:59Z")

</div>

Rather than using moustache templates with JSON, you could use JSONata instead. In this case, after changing from "{}" to "J:", you would use:

```auto
{
    "rgb_color": payload,
    "brightness": "35",
    "effect": "None"
}

```

Brightness in HA is normally a number too - so no quotes. FWIW I prefer to use "brightness\_pct".

---

<div class="post-metadata">

**Author:** ![Jmilesy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jmilesy/32/12756_2.png) [@Jmilesy](https://discourse.nodered.org/u/Jmilesy)\
**Post date:** [10 October 2020 12:47 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/15 "2020-10-10T12:47:53Z")

</div>

thanks all, managed to get it working thank to all your advice 🙂

---

<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:** [9 December 2020 12:47 UTC](https://discourse.nodered.org/t/move-data-not-payload-from-one-node-to-another/33731/16 "2020-12-09T12:47:54Z")

</div>

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