I am having some problems with the Play_Audio node.
On one Node-Red Pi (Raspian), I inject once with the inject node into a File-In node to read a .wav file and the output of that node is "a single Buffer Object", which flows to the Play Audio node.
When I click on deploy, and Node-Red restarts when the deploy is finished, then the inject node runs once to flow into the File_In node that reads a wav file into a buffer object, which then flows to the Play Audio node, giving me an audio alert that the deploy has finished. (The wav file was copied from my PC if you wish to duplicate my efforts).
Pretty cool.
[{"id":"ef195245.f4512","type":"play audio","z":"afd5184a.0cd4d8","name":"","voice":"0","x":630,"y":1160,"wires":[]},{"id":"adaa06f7.109c88","type":"inject","z":"afd5184a.0cd4d8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"x":150,"y":1160,"wires":[["967ef650.a43ee8"]]},{"id":"967ef650.a43ee8","type":"file in","z":"afd5184a.0cd4d8","name":"Reads the .wav file","filename":"/home/pi/sounds/Unlock.wav","format":"","chunk":false,"sendError":false,"x":370,"y":1160,"wires":[["ef195245.f4512"]]},{"id":"27191a7f.ad17d6","type":"comment","z":"afd5184a.0cd4d8","name":"Sends a tone. Send once at start tells me when 'deploy' is finished.","info":"","x":330,"y":1120,"wires":[]}]
However, here's the problem.
On a second Pi running Node Red on HassOS, I get silence from the same flow. (Yes, I changed the absolute file location for the wav file).
I verified that the File-In node was finding the file by misspelling the filename. I put a bad filename ("Unloc.wav" instead of "Unlock.wav") and I get this error in the debug node following the File_In node:
Error: ENOENT: no such file or directory, open '/config/node-red/lib/sounds/Unloc.wav'
I do not get any error when the correct filename is used, so I am sure the File_In node is finding the file.
I know that the Play Audio node is working because instead of the File_In node, I can use a function node to put "Deploy Finished" into msg.payload then flow that into the Play Audio node, and I hear "Deploy Finished" on the PC speaker:
[{"id":"a642ec4e.80e38","type":"function","z":"11ef03a7.e4b69c","name":"Set msg.payload to \"Deploy finished.\"","func":"msg.payload = \"Deploy finished.\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":340,"wires":[["dae07b79.d85dd8"]]},{"id":"c1bbf37d.9def6","type":"inject","z":"11ef03a7.e4b69c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":150,"y":340,"wires":[["a642ec4e.80e38"]]},{"id":"dae07b79.d85dd8","type":"play audio","z":"11ef03a7.e4b69c","name":"","voice":"4","x":670,"y":340,"wires":[]}]
Using the TTS feature of the Play Audio node is a sufficient workaround, but I am curious why the Play Audio node in the Node-Red on HassOS isn't playing the wav file?
Note, it did work on the HassOS Pi before upgrading Home Assistant.