MP3 Datei im Dashboard abspielen

Hallo,

ich möchte bei NOde Red im Dashboard eine MP3-Datei abspielen.
Dazu habe ich nach einem Button die Node File-In und danach die Audio-File geschaltet. Das funktioniert so weit.
In der File-in muss ich dabei Pfad und Dateinamen eingeben.
Es sollen aber verschiedene Dateien abgespielt werden.
Hat jemand eine Idee wie dieses Problem zu lösen ist.

Das solltest du leicht scripten können oder mit eine Change-Node machen können.

Entscheidend ist, dass du die Info vom file-in-node liest:

Inputs

filename string
    if not set in the node configuration, this property sets the filename to read. 

Also einfach ein msg-object mit gewünschtem msg.filename “rein” geben.

Hallo,
kannst du mir da bitte noch weiter auf die Sprünge helfen?
bin bislang nicht weiter gekommen weil ich nicht weiß wo ich was reinschreiben soll!

Nur mal “ungetestet” zusammengesteckt:

[{"id":"8d7a4cfc.0f792","type":"ui_button","z":"15a27673.1e345a","name":"","group":"4b3126b4.eaae58","order":3,"width":0,"height":0,"passthru":false,"label":"/tmp/file1.mp3","tooltip":"","color":"","bgcolor":"","icon":"","payload":"/tmp/file1.mp3","payloadType":"str","topic":"","x":100,"y":820,"wires":[["c0981bb0.e1dbf8"]]},{"id":"237bd1a2.fa1bd6","type":"ui_button","z":"15a27673.1e345a","name":"","group":"a65b47d6.8799c8","order":3,"width":0,"height":0,"passthru":false,"label":"/tmp/file2.mp3","tooltip":"","color":"","bgcolor":"","icon":"","payload":"/tmp/file2.mp3","payloadType":"str","topic":"","x":100,"y":900,"wires":[["c0981bb0.e1dbf8"]]},{"id":"16419f68.75f689","type":"file","z":"15a27673.1e345a","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":490,"y":860,"wires":[["1f1e2d35.720c13"]]},{"id":"1f1e2d35.720c13","type":"ui_audio","z":"15a27673.1e345a","name":"","voice":"","always":"","x":640,"y":860,"wires":[]},{"id":"c0981bb0.e1dbf8","type":"change","z":"15a27673.1e345a","name":"","rules":[{"t":"set","p":"filename","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":860,"wires":[["16419f68.75f689"]]},{"id":"4b3126b4.eaae58","type":"ui_group","z":"","name":"Semy","tab":"a1c7344d.2e00e8","disp":true,"width":"6","collapse":false},{"id":"a65b47d6.8799c8","type":"ui_group","z":"","name":"Heizung","tab":"9deab54d.d3f5d8","order":3,"disp":true,"width":"6"},{"id":"a1c7344d.2e00e8","type":"ui_tab","z":"","name":"Test","icon":"fa-fire"},{"id":"9deab54d.d3f5d8","type":"ui_tab","z":"b4ea147.741e5e8","name":"Küche","icon":"fa-coffee"}]

Hallo,

danke, hat geklappt
ich musste nur noch msg.payload gegen msg.filename in der change- node tauschen.

1 Like