Exec node problem. Paramaters msg.payload;

Sorry folks, Mr stupid is at it again.

Given if I make the line complete in this exec node, the sound is played, but if I send it the file name as a payload nothing happens.

[{"id":"f6964989d2228832","type":"exec","z":"235f16ee6e459f2c","command":"omxplayer /home/pi/.node-red/public/Sounds/","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"DING","x":2290,"y":2240,"wires":[[],[],[]]},{"id":"6edeb0e71d6b6aba","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bellding.mp3","payloadType":"str","x":2100,"y":2240,"wires":[["f6964989d2228832"]]}]

What am I missing?

EDIT:

For clarity:
This is what is in the exec node:
omxplayer /home/pi/.node-red/public/Sounds/
And the payload is bellding.mp3

If I make the line:
omxplayer /home/pi/.node-red/public/Sounds/bellding.mp3 it works.
As posted, it doesn't.

Do you get any error message from the second exec output?

(Sorry, hadn't checked that.)

But - sorry to digress - I did notice that the payload was somewhat wrong.

I looked at what was going on with htop and found
omxplayer /home/pi/.node-red/public/Sounds/ bellding.mp3
was what omxplayer was getting.

Somehow a rogue space was getting in the equation.

I think the exec node inserts that space.

A work-around is to pass the full pathname of your file as mag.payload

Or you can use a template to define the command

then in the exec node have the Command field empty and tick Apppend msg.payload

1 Like

I kind of did that - ITMT.

But I put the payload through a template node and changed the payload to include the path the just had the command in the exec node and appended the payload.

All working.

Thanks for the help/time.

(Basically this)

[{"id":"b555d7550142bb91","type":"template","z":"235f16ee6e459f2c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"/home/pi/.node-red/public/Sounds/{{payload}}","output":"str","x":2100,"y":2240,"wires":[["f6964989d2228832"]]},{"id":"6edeb0e71d6b6aba","type":"inject","z":"235f16ee6e459f2c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"bellding.mp3","payloadType":"str","x":1910,"y":2240,"wires":[["b555d7550142bb91"]]},{"id":"f6964989d2228832","type":"exec","z":"235f16ee6e459f2c","command":"omxplayer ","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"DING","x":2290,"y":2240,"wires":[[],[],[]]}]

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