R pi PIR triggering playing mp3 file

I am new to node-red and have spent days trying to get a simple project to play a sound file when triggered from a PIR and turn on a light with a Raspberry Pi.

I have tried all the nodes that deal with audio. Even tried to install Contrib-audio only to have the install fail.

The file plays great in VLC so it is not hardware
If someone can help me with an example of this flow or a link to how I can learn to do this.

Thanks

Welcome to the forum @thecybo

If you have not already done so then I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot in about 1 hour. A small investment for a lot of gain.

First make sure that your PIR input is working as expected. Connect a Debug node to it and check that it is sending the messages you expect.

Are you trying to play the file on the pi running node-red or in the browser, which may be on a different machine?

This is the first thing to check. I've lost count of the number of times Linux sound has let me down. If it doesn't "just work" I generally don't even bother. The first step is to use a Linux command-line tool on the Pi to output a sound and make sure that is working.

If that works, I'd try doing the same from Node-RED using an exec node.

Once you know that that is working, then you can move on to any custom sound nodes.

Hi Colin

Thanks for the reply

I think that my biggest problem is that I don't do this enough to get good at it.
I had the same set up a couple of years ago and it worked just find, but I lost that flow and now have to start all over again. I also had a dashboard to select three different videos. Gone

I mentioned in my post that I could get the mp3 to play outside node-red but did not say that it had to play on the Pi. I installed MPG321 as required in one of the nodes and I am able to run the MP3 from the command line so I ruled out problems with Linux.

I am not familiar with exec nodes but a quick search looks like that might be the anaswer. I will dig into it and get back with you.

Thanks a lot!

Richard

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