Volume Control via Node-Red

Hello,

I have installed on a second RbPi “Node-Red” with the palette “node-red-contrib-volumio”

I found a “Flow” which works fine with [Play, Stop, Playlist, …].
I tried to extend the flow to control Volume [plus , minus] with out any luck.
The closest I got was to get have Volumio jump to the max. Volume.

I have tried now for hours various ways to format the “eventPush”
================ one of many attempts ================
--------- inject-node: ---------
volume, 40

-----function------
var name = msg.payload;
msg.payload = {
event: “volume”,
volume: name
}
return msg;

Sorry, but I do not understand how I need to format a proper “request”

Can anyone out there please help me on how to set up the flow?
Any Idea is welcome
Thank you very much in advance

Thanks to the creator of the palette I got it to work.
Here is the solution:

Luca wrote on Github:

Volume control works for me.

In the following example i put
{“event”:“volume”,“data”:50}
in “volume 50” palette (as msg.payload)

================================
Maybe this is useful for others as well.

Thanks again Luca - you had made my day

I second that. Thanks a lot for the right format. :smiley:

I think I am completely missing something. I can get play, pause, stop to work, but not volume. Hopefully someone sees my error. I get the error of pushEvent not defined:

I can send just “volume” and nothing really happens, but when I try to send a volume level I get the above error.

Thank You

So… I found a german website and through pictures, I got it to send a volume command.
https://smart-wohnen.org/homematic-den-volumio-music-player-in-die-hausautomatisierung-einbinden/

Any idea how I can pass the data: 10 in the inject node to the to the function nodes data variable?

Thank you again.

I figured it out (I think). Hope this helps someone, and thanks to the German website.

The control of volume is working.
I can start, stop the music.

But i will start a soundfile (mp3) directly from my second PI

Pi1 = Node-red PI
Pi2 = Volumio PI

Now, i will start a command from PI_Nodered to start the sound on PI_Volumio

The Sound file is on my PI_Volumio (USB/Music/Test.mp3)

PI_Nodered-IP = 192.168.2.69
PI_Volumio-IP = 192.168.2.70

My try: (with a function node)

var event = msg.payload;

msg.payload = {
event: event,
uri: “mnt/USB/AUDIO/Test/2.mp3”,
}

return msg;

…but it doesn`t work…

my next try:

“event”: “replaceAndPlay”,
“pushEvent”: “pushState”,

but it doesn`t try again!