Msg.payload not being appended to command in exec node

This used to work :frowning:

[{"id":"a82bdbdd.0f5b78","type":"inject","z":"5976337f.eb428c","name":"speak test","props":[{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Espeak","payload":"MultiWordTest","payloadType":"str","x":1135,"y":200,"wires":[["1a243027.611e7","37b0eeda.2b2ce2"]]},{"id":"a1324e0b.76d96","type":"mqtt in","z":"5976337f.eb428c","name":"espeak","topic":"Espeak","qos":"2","datatype":"utf8","broker":"be7ee050.262c9","x":1101,"y":241,"wires":[["1a243027.611e7"]]},{"id":"1a243027.611e7","type":"exec","z":"5976337f.eb428c","command":"/usr/bin/espeak-ng","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Espeak","x":1342,"y":340,"wires":[["37b0eeda.2b2ce2"],["37b0eeda.2b2ce2"],[]]},{"id":"37b0eeda.2b2ce2","type":"debug","z":"5976337f.eb428c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1355,"y":230,"wires":[]},{"id":"be7ee050.262c9","type":"mqtt-broker","name":"localhost:1883","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""}]

But now I get:

12/24/2020, 3:53:41 PMnode: 37b0eeda.2b2ce2
Espeak : msg : Object
{ _msgid: "8cebdf5d.5b246", topic: "Espeak", payload: "MultiWordTest" }
12/24/2020, 3:53:52 PMnode: 37b0eeda.2b2ce2
Espeak : msg : Object
_msgid: "8cebdf5d.5b246"
topic: "Espeak"
payload: ""
rc: object
code: 0

It still works on my desktop development system which is still running node-red v0.19.5

The new system I'm setting up is running node-red v1.2.6, The espeak-ng command works fine when I give it over a ssh login to the remote system.

First off I would suggest putting a separate debug node each place you want it. It makes it easier to see where the msg comes from.

Second, if you open the rc: object what is it showing?

The timestamps make it clear where each message comes from, the first is the output of the inject node, exactly what I expect.

The second comes from the exec node stdout, the the rc object has been expanded in the cut and paste, and shows code: 0

Looks the little triangles to indicate expansion didn't cut and paste the one in front of rc: would be pointing down.

I don't think you will find it is the msg.payload appending that is the problem. One way to check is to remove the command from the exec node and add it to the msg.payload coming in and check the results.

another way to check is to use a different conmmand. Set the command to ls and pass in /usr/bin (or the home directory of the user running NR) and see what happens.

When I do that with your flow, I get an error (which is expected) since I don't have speak-ng installed

The fact that the RC is 0 means the command was executed.

What platform are you running on?
What version of node.js?
does the user - on the new device - running NR have the privilege to run the command?
could it be that espeak is trying to talk on the device running NR? (just speculating here.

Running the espeak command on the device running node red is the whole point, as that is where the audio amp and speakers are connected.

As I said its running v1.2.6

I assume that with the default bash script installation node-red runs as the same user where the .node-red directory gets created, which would be the same username as I do for the ssh connection.

The espeak command works when I give it over an ssh login.

I'm starting node-red as a service, does this start it as a different user? if so how does it read $HOME/.node-red/settings?

Still puzzled.

Have a Merry Christmas everyone!