# Exec node problem. Paramaters msg.payload;

**URL:** <https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191>\
**Category:** General\
**Created:** [1 January 2024 23:28 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191 "2024-01-01T23:28:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 January 2024 23:28 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191/1 "2024-01-01T23:28:41Z")

</div>

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.

```auto
[{"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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [1 January 2024 23:40 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191/2 "2024-01-01T23:40:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [1 January 2024 23:50 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191/3 "2024-01-01T23:50:07Z")

</div>

(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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [2 January 2024 00:16 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191/4 "2024-01-02T00:16:24Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/a/7ac8dc356d52ac136ec88e7267da0c45f7078704.png)

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [2 January 2024 00:18 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191/5 "2024-01-02T00:18:58Z")

</div>

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)

```auto
[{"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":[[],[],[]]}]

```

---

<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:** [16 January 2024 00:19 UTC](https://discourse.nodered.org/t/exec-node-problem-paramaters-msg-payload/84191/6 "2024-01-16T00:19:29Z")

</div>

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