Play Alarm Sounds

I’d like to introduce myself before the question.
I have a small grow room from about 15 years and i decided for a full automation.
I started this experience with mycodo python and raspberry about 2 months ago.
I chose mycodo because it perfectly suits my needs.
But i don’t use timers and pid because I can’t get it to work properly.
Instead i use the conditional controller.
Anyway i prefer this way.
I did automations for light, aspirator, humidifier, fans, air/water pump for DWC system and a nutrients calendar widget.
but I’m not done yet.
I use sensors to check as much as possible and i have various alarms to perform.
I use emails for emergency, but i need sounds to play in loop and stop under certain conditions.
I tried using command shell or directly in conditional but in the best case the sound starts and mycodo waits the end and not perform the next actions.
What to do?
Thanks for your time

Hi Roberto. Have you tried threading?

1 Like

It’s working.
Timer for lights, 2 programs, 5 alarms
Sends mail one time and repeats the sound every period in a separate process.
Sound stops if the conditions come back to normal or by switch
…i think ther’s a better way to do it. (3,8 KB)


Very nice solution! I’ve always wanted to incorporate alarm sounds into my projects, but email alerts always worked well enough and, crosses fingers, I haven’t had any catastrophic issues yet.

Getting it to work is the first step. You could remove the need for separate bash scripts by creating Python functions to play the sounds that you spawn the threads of.

I already tried to play directly in python without success.
I should install libraries, but i don’t know wich one is more stable.
And i’m not able to stop the thread for loop the sound.
So I decided to leave this option until i have more knowledge.
Thank you!