Home Assistant Community

Call service node Data inject msg.payload

#1

I’m using a call service node to call alexa_tts. I want her to say the string from the msg.payload from the previous node.
A working Data field looks like this:

{"message":"This is a test"}

How do i replace “This is a test” with the string in the payload from the calling Node?

#2

If you using the latest node-red-contrib-home-assistant-websocket

{"message":"{{payload}}"}

Otherwise you’re going to have to use a template or function node.

1 Like
#3

Thanks Kermit. Worked perfectly!!

#4

Can I piggy back off of this? I need to do the same thing, but I need to send an integer not a string.

If I try {"value":"{{payload}}"} HA complains that extra keys not allowed @ data['0']

If I try {"value":{{payload}}} the node in Node-RED won’t accept it…

#5

This has to with you sending more data than the service call was expecting. Make sure you’re not passing any extra data in msg.payload.data for the previous nodes.

#6

I finally managed to work it out. I had to use a template in the end to send the data through to the call service node.

I was actually trying to send the contents of a flow variable, so in my case it was {"data" : { "value" : {{flow.MinCool}} } }