# Help using payload from previous node - Home assistant nodes

**URL:** https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129
**Category:** General
**Created:** [25 October 2019 09:44 UTC](https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129 "2019-10-25T09:44:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ulrar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ulrar/32/13580_2.png) [@Ulrar](https://discourse.nodered.org/u/Ulrar)
#### Post date: [25 October 2019 09:44 UTC](https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129/1 "2019-10-25T09:44:10Z")

</div>

Hi,

I just started trying node red out with home assistant, but I don't really understand how to create flows.  
I'm trying to setup a flow to change the color of a light bulb depending on it's current color (to cycle through a few favourites easily from a hue light switch). Here is what I have so far :

```auto
[{"id":"b6ea14f1.63f2c8","type":"api-current-state","z":"5114ad7.ae7af54","name":"","server":"3624259f.a9b772","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.0x0017880103ac8bc9_light","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":400,"y":560,"wires":[["a5faa7af.e81e4"]]},{"id":"11497e10.12b34a","type":"inject","z":"5114ad7.ae7af54","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":560,"wires":[["b6ea14f1.63f2c8"]]},{"id":"a5faa7af.e81e4","type":"function","z":"5114ad7.ae7af54","name":"","func":"if (JSON.stringify(msg.data.attributes.rgb_color) == JSON.stringify([128, 128, 128]))\n{\n msg.payload = [0, 0, 0];\n}\nelse\n{\n msg.payload = [128, 128, 128];\n}\n\nnode.warn(msg.payload);\n\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":560,"wires":[["ee38cfed.4987b"]]},{"id":"ee38cfed.4987b","type":"api-call-service","z":"5114ad7.ae7af54","name":"","server":"3624259f.a9b772","version":1,"service_domain":"light","service":"turn_on","entityId":"light.0x0017880103ac8bc9_light","data":"{\"rgb_color\": {{payload}}}","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":970,"y":560,"wires":[["68e19db6.128094"]]},{"id":"68e19db6.128094","type":"debug","z":"5114ad7.ae7af54","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1220,"y":500,"wires":[]},{"id":"3624259f.a9b772","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

```

This does not work however : "Call-service API error. Error Message: extra keys not allowed @ data['0']"  
I know that error usually means you're trying to define your object wrong, like having data inside of data, but I don't think that's what I'm doing here. The {{payload}} syntax was found in other posts here and on the HA forums, maybe that's just not how to do it.  
Any tips would be appreciated !  
Thanks

---

<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: [25 October 2019 10:09 UTC](https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129/2 "2019-10-25T10:09:48Z")

</div>

Welcome to the community, you don't say which node you are using which is kind of important. I'd suggest editing the title ( the little pencil icon) to include this so that anyone who is familiar with that node is able to notice your post

---

<div class="post-metadata">

### Author: ![Ulrar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ulrar/32/13580_2.png) [@Ulrar](https://discourse.nodered.org/u/Ulrar)
#### Post date: [25 October 2019 10:20 UTC](https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129/3 "2019-10-25T10:20:57Z")

</div>

I'm using the home assistant nodes, I added that

---

<div class="post-metadata">

### Author: ![Ulrar](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ulrar/32/13580_2.png) [@Ulrar](https://discourse.nodered.org/u/Ulrar)
#### Post date: [6 November 2019 20:00 UTC](https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129/4 "2019-11-06T20:00:03Z")

</div>

Hi,

Noone has any ideas on this ?

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [6 November 2019 21:09 UTC](https://discourse.nodered.org/t/help-using-payload-from-previous-node-home-assistant-nodes/17129/5 "2019-11-06T21:09:20Z")

</div>

Well this is the Node-RED forum not the Home Assistant forum so while there are some HA users here, there may not be many who have detailed knowledge of it.
