![]() |
Help a firefighter - trigger alarm.mp3 by monitoring incoming e-mails
Dear colleague, we use this one now: https://www.alamos-gmbh.com/service/apager-pro/
The whole Landkreis (county?) is supposed to use it. Best part is that it also shows me the way to the fire station should i have forgotten how to get there. @all: You guys are great. I now have a separate email account, with situation set up so that when i´m not within reach of a known wifi the ambient changes and thus the sound when i get an email. Emails are constantly retrieved for the alarm mail account and only manually for the normal one. I think i can live with that for the time being. I'll probably try to retrieve the alarm message via kdeconnect with a linux computer later to gain a few seconds and to be able to forward the message via different means. One last question though: the Situations app lets me execute random commands it seems. Does anyone have any idea how to put this possibility to use? |
Re: Please help a firefighter
I just found some time to hack together a shell one-liner that should solve it for you (jn case your alert e-mail has a specific unique subject):
Code:
{ dbus-monitor & echo $! >dbusmonpid; } | { grep -q -m 1 'xxxSUBJECTxxx' && gst-launch-1.0 playbin uri=file:///home/nemo/Music/SOMEFILE.ogg.midi.wav.mp3 && kill $(cat dbusmonpid) && rm dbusmonpid; } Tested and worked. :) This is definitely not fool proof and could be extended with a loop and more. Oh and let the sound play to end (do not use ctrl-c), else the dbus-monitor process will not get killed. About loudness I do not know with gst-launch but there should be some help. So there is room for improvement. But hey it works! Thanks @haltux for the right pointers! :D |
Re: Please help a firefighter
If you can make the alerts come as SMS with predefined message, you could also use FindMyJolla to create alert:
https://openrepos.net/content/ajalkane/find-my-jolla |
Re: Please help a firefighter
Quote:
Very good and flexible starter. I could also think of, that you not filter the subject which is good, but when needed you could also filter the account which gets an e-mail. Just as an idea when the subject changes. |
Re: Please help a firefighter
This sounds great, i'll test it. I should probably make this a cron job to start on boot, no?
I can define the message myself so that shouldn't be a problem. Volume should be easy: https://gstreamer.freedesktop.org/do...ume/index.html |
Re: Please help a firefighter
You are welcome.
Fire fighters are system relevant ;) so I needed to help :D About volume level I found that gstreamer thing also but think this is just setting 0-100 % of actual level (not sure). So I think this approach here sounds better: Code:
after installing alsa-utils via pkcon I was able to change the master volume/balance via cmd line like 'amixer sset Master 80%,80%' The current code snippet I made is a one-time executer, so you would need to put into a loop. I thought it is easier to control when you want it to run. If you want it always, a systemd script on boot or cron job is good. But then it would need some more fine tuning against reliability, e.g. how to stop it or how to pause/stop the sound... |
Re: Please help a firefighter
Just in case a colleague of mine finds this: I had to install gstreamer1.0-tools, too
|
Re: Please help a firefighter
So after install alsa-utils and gstreamer1.0-tools i'm now here:
Code:
{ dbus-monitor & echo $! >dbusmonpid; } | { grep -q -m 1 '<alarm>' && amixer sset Master 100%,100% && gst-launch-1.0 playbin uri=file:///home/nemo/Documents/sirene.mp3 && |
Re: Please help a firefighter
Quote:
Would you mind to edit the first post and hereby the title to some more meaningful? Like: Help a firefighter - trigger alarm.mp3 by monitoring incoming e-mails -- and maybe reset loudness after sound has played? |
Re: Please help a firefighter
Quote:
Thank you all for your input. I'll try to figure out how to make a systemd service from this that also resets sound volume. |
All times are GMT. The time now is 11:25. |
vBulletin® Version 3.8.8