View Full Version : Help a firefighter - trigger alarm.mp3 by monitoring incoming e-mails
Veraendert
2020-04-15, 16:22
Hi, i'm a volunteer firefighter which is a pretty busy job right now with lots of alarms. I need help with having some kind of alarm sound on a phone running SFOS.
I also happen to have a Jolla Phone which i really like.
We have 2 means of alarms: An app running on Android or iOS and a bulky analogue device.
When i go out for work or jogging, i usually take only my phone with me. And i would prefer using my J1 and not one of my Android phones that i'd rather leave at home. I tried running the Android app on it for alarms but no luck getting it to work so far. So this is a dead end (the Android app is called aPager Pro if you need to know).
What i did manage to do is forwarding the messages by e-mail from the app to my J1 using an app called NotifyMe. The problem is: I get a lot of e-mails. So if i have to take my phone out every time i get an e-mail, i'm more or less unable to work.
So what i need is a solution that reads my mails (or just the sender as that would always be the same for the forwarded alarms) and plays a sound as loud as possible. But i'm way out of my depths here. Does anyone have any idea how to solve my problem?
What about a dedicated email account for your alarm emails?
Veraendert
2020-04-15, 16:41
Wouldn't be a problem to set up- but i still wouldn't have an alarm?
rob_kouw
2020-04-15, 18:42
My e-mail provider has a service to send sms (text) messages when e-mails come in according with filter settings. That would solve it, right? It will cost you a few cents per sms.
If not through your provider: the other day I was talking to a guy who had a Node-RED solution to keep an eye on his building. He used sms messages too, I think through Vonage. I don't know if there is a lot of programming involved.
rob_kouw
2020-04-15, 18:49
Wouldn't be a problem to set up- but i still wouldn't have an alarm?
That would depend on the ringtone for incoming e-mails?
Veraendert
2020-04-15, 20:15
Isn't the ringtone always the same? Problem is i need mails from my main account in the phone, top.
Veraendert
2020-04-15, 20:17
I probably should mention that i run my own Mail server, if that helps.
Hi, i'm a volunteer firefighter which is a pretty busy job right now with lots of alarms. I need help with having some kind of alarm sound on a phone running SFOS.
I also happen to have a Jolla Phone which i really like.
We have 2 means of alarms: An app running on Android or iOS and a bulky analogue device.
When i go out for work or jogging, i usually take only my phone with me. And i would prefer using my J1 and not one of my Android phones that i'd rather leave at home. I tried running the Android app on it for alarms but no luck getting it to work so far. So this is a dead end (the Android app is called aPager Pro if you need to know).
What i did manage to do is forwarding the messages by e-mail from the app to my J1 using an app called NotifyMe. The problem is: I get a lot of e-mails. So if i have to take my phone out every time i get an e-mail, i'm more or less unable to work.
So what i need is a solution that reads my mails (or just the sender as that would always be the same for the forwarded alarms) and plays a sound as loud as possible. But i'm way out of my depths here. Does anyone have any idea how to solve my problem?
So can you describe how do you get the email from the alarm, does it work so that the android application sends the email when you are summoned? Or do you get the alarm email from the fire department?
Of course if the alarm backend system that "aPager Pro" uses had an open API then it would not be difficult to implement something in python that'd serve as alarm application on SFOS.
If this is not possible then indeed some filtering based on the emails is the next best thing.
I probably should mention that i run my own Mail server, if that helps.
A quick solution would be to set up a separate mail account. Use only this one for push notifications and fetch the other mails only manually. You said, that you get a lot of mails anyways. Fetch these only then, when you are not running. :-)
Veraendert
2020-04-16, 08:50
Thanks so far, i've set up a separate mail account, that probably helps a bit. There is no way to alter the sound of email notification i presume?
@juiceme: The application is closed source and as far as i can tell works with an encrypted message other than SMS/e-mail. This is sensible data so we don't want everybody to be able to see the messages. No way they'd open the API just for me to mess around. But when that message is displayed, a different Android app NotifyMe grabs the displayed message and forwards it via e-mail.
That's not perfect but still better than just hearing the siren from the first engine going out. We're short of firefighters so this is a rather pressing problem.
peterleinchen
2020-04-16, 09:21
jI guess for now a separate mail account with push set and all others to manual is best option for you.
I am pretty sure that it should be possible with some coding (e.g. python):
dbus listening for new mails and filtering text, then with aplay or something else playing sound.
I am also sure similar have been done for N900 already but I cannot remember for SFOS...
Thanks so far, i've set up a separate mail account, that probably helps a bit. There is no way to alter the sound of email notification i presume?
Of course you can! Go to Settings -> Sounds & feedback -> Email and set the loudest you want
Veraendert
2020-04-16, 10:59
@claustn: Thanks, maybe i wasn't clear enough: I only have the option to edit the alarm sound for every e-mail, regardless of what account it was sent to. That way, if i check for mails from my "normal" account, there would be an alarm sound every time there's new mail. So while i could use some siren sound for e-mail alarms, this would probably not be a good idea e.g. at work.
Ideally, there would be a specific sound for that e-mail account overriding everything and playing at full volume.
But the setup i have now is already a lot better than what i had before thanks to everyone. I really appreciate it. Checking your email every 5 minutes on a 20km run sucked.
rob_kouw
2020-04-16, 11:04
In case you are located in The Netherlands: dds.nl offers the sms service. An account is 32,50/year, text message 0,10-0,12 euro each.
Veraendert
2020-04-16, 11:18
I'm in Germany. And this would still mean that i'd get an alarm sound every time i receive an SMS. Which isn't that often but still often enough.
@claustn: Thanks, maybe i wasn't clear enough: I only have the option to edit the alarm sound for every e-mail, regardless of what account it was sent to. That way, if i check for mails from my "normal" account, there would be an alarm sound every time there's new mail. So while i could use some siren sound for e-mail alarms, this would probably not be a good idea e.g. at work.
Ideally, there would be a specific sound for that e-mail account overriding everything and playing at full volume.
But the setup i have now is already a lot better than what i had before thanks to everyone. I really appreciate it. Checking your email every 5 minutes on a 20km run sucked.
I agree that separate alarms for each account would be the best, but you can also have an Ambience for running with the loud email tone and another one for everything else. Or use the Situations app to change stuff according to where you are.
I would do it with dbus.
For sms you can look here:
https://talk.maemo.org/showthread.php?t=100848
And the email application has a session dbus interface (com.jolla.email.ui) maybe it is helpful.
https://together.jolla.com/question/185264/dbus-monitor-shows-mail-password-in-clear-text-and-other-sensitive-information/
https://talk.maemo.org/showthread.php?t=92303
You can quite easily connect some kind of prototype board with modem to the 'real' alarm device which, when will be activated, will send you SMS. Easy to do but you need some electronics technician/engineer in your place to do it.
Veraendert
2020-04-16, 13:45
I agree that separate alarms for each account would be the best, but you can also have an Ambience for running with the loud email tone and another one for everything else. Or use the Situations app to change stuff according to where you are.
Mabe i'll just let the app check if i'm connected to known wifi (which means i'm at home or at work and will likely have the alarm device with me) and act accordingly. I'll give it a try.
That's me yesterday btw. 3rd one from left. The good looking one.
@veraendert: I'm a volunteer in the german civil protection service and my local unit decided to use a tool named divera for alerting us. Unfortunately there is also only an iOS or Android app, thus is "suffer" from the same problem. Which App is your fire brigade using?
Veraendert
2020-04-16, 18:58
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?
peterleinchen
2020-04-16, 19:48
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):
{ 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; }
Replace the xxxSUBJECTxxx with any unique part of subject of your alert mail. And replace SOMEFILE with any music /sirene/noise sound file.
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
ajalkane
2020-04-16, 20:03
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
So there is room for improvement. But hey it works!
Thanks @haltux for the right pointers! :D
Nice one I am glad that I could be of help with this outcome :)
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.
Veraendert
2020-04-17, 06:21
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/documentation/volume/index.html
peterleinchen
2020-04-17, 07:31
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 (https://lists.sailfishos.org/pipermail/devel/2015-March/005896.html) sounds better:
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...
Veraendert
2020-04-17, 09:11
Just in case a colleague of mine finds this: I had to install gstreamer1.0-tools, too
Veraendert
2020-04-17, 11:07
So after install alsa-utils and gstreamer1.0-tools i'm now here:
{ 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 &&
kill $(cat dbusmonpid) && rm dbusmonpid; }
This is a working solution.
peterleinchen
2020-04-17, 12:04
So after install alsa-utils and gstreamer1.0-tools i'm now here:
...
This is a working solution.
Now as we know the trigger subject text we just need your e-mail address to test! :D
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?
Veraendert
2020-04-17, 14:17
Now as we know the trigger subject text we just need your e-mail address to test! :D
I'm not that stupid :D
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.
Android_808
2020-04-18, 07:34
Can you record the current level using awk and alsamixer sget to a file, like the PID, just before you set it to 100. Then restore it when you do the cleanup up the end.
And the email application has a session dbus interface (com.jolla.email.ui) maybe it is helpful.
https://together.jolla.com/question/185264/dbus-monitor-shows-mail-password-in-clear-text-and-other-sensitive-information/
https://talk.maemo.org/showthread.php?t=92303
With this + a simple shell script, shouldn't it be possible to look for certain keywords in incoming mails, and sound an alarm if such are found?
Veraendert
2020-04-19, 17:01
Can you record the current level using awk and alsamixer sget to a file, like the PID, just before you set it to 100. Then restore it when you do the cleanup up the end.
I'm a little unsure if i can but i'll do my best. Right now, i have the problem that the terminal stops working after some time and i have to restart it. I have gotten one alarm now but i don't want to miss the next one. So- having the sound restored is somewhat the icing on the cake.
peterleinchen
2020-04-19, 18:25
Sounds like OOM kills of terminal. :(
I see my terminal cover often greyed out, i.e. killed and the command just interrupted :eek:
I extended my swap manually with a swap file on home (maybe better on SD card like on N900?) and it got better.
Maybe try with ShellEx or qCommand from openrepos?
Or let a cron job restart this command every xx minutes?
(will you get re-notified more often via mail?)
Android_808
2020-04-19, 23:03
I'm a little unsure if i can but i'll do my best. Right now, i have the problem that the terminal stops working after some time and i have to restart it. I have gotten one alarm now but i don't want to miss the next one. So- having the sound restored is somewhat the icing on the cake.
Did a little digging. You can use alsamixer -sget Master but you may also be able to use alsactl.
Maybe something like editing the dbus command posted earlier to add
alsactl --file ~/.config/asound.state store
Before the alsamixer -sset Master bit and
alsactl --file ~/.config/asound.state restore
In the kill/cleanup part.
Veraendert
2020-04-20, 15:44
Sounds good, will try. But then the script worked very well twice today already. Which means that i'm really tired. Because it was quite early when my sleep was interrupted.
peterleinchen
2020-04-20, 21:00
Cannot help you with this sound stuff,
as I am not really a knowledged one regarding PA, alsa and so on
and all that alsa vodoo just gives me a lot of 'no such device' or 'cannot read control' or similar on XA2...
Veraendert
2020-04-21, 13:50
No problem, you helped a great deal already. I just need some time to figure things out. As long as i have a working solution, i'm fine.
biketool
2020-04-21, 14:21
To dodge into a different direction may I ask what bulky analog device you have for callouts? Are people still using Motorola Minotaur and Minotaur IIs?(edit, damn they are up to the Minotaur 6, now as big as a little '90s belt pager now but still voice paging.)
I was a paid guy and finished as an officer and EMT-P but ended up taking the tech telated topics during my 8-5 work hours, though we were still doing in the VHF in rural western US when I medical'ed out.
I am also an amateur radio guy so hacking a VHF receiver with tone controls back then was cake though we also had commercial UHF POCSAG pagers with priority so they all beeped about 1-2 sec after the tones came over the VHF dispatch channel.
Not sure what your dispatch's setup looks like.
Big life altering advice for all first responders.
Lift properly, ask for help(hard for young guys, especially young volunteers), protect your spine, stairways with a patient on the cot and you are the backwards guy will get you; the damage you do might put you away fast or might just get worse over time; it is what ended my career.
Also remember that car drivers are what kill by far the most first responders and that people get lax at training events in a way they never would on a real call(hours of repeated extinguish/relight burn to learns especially).
Pass this on to the young guys at your department and wherever you end up doing teaching.
T
I am also an amateur radio guy so hacking a VHF receiver with tone controls back then was cake
I guess today one could maybe do this with a cheap SDR USB stick and a Raspberry Pi.
biketool
2020-04-22, 11:39
I guess today one could maybe do this with a cheap SDR USB stick and a Raspberry Pi.
The RTL-SDR is an incredibly useful hack but started life as an HDTV receiver, there was little consideration to power savings beyond not maxing out a USB 2.0 port; I would guess they burn worse than 1A/H, they sure get hot aand that is before you add a band tuned LNA inline to receive weaker mobile signals(dispatch is probably pretty strong).
You can find the actual fire pagers cheaper and even the old ones with tiny crappy Ni-Cd batteries lasted several days in the 70s-80s, I guess the Minotaur pagers only got very small at gen6 before that they were cigarette pack sized up to a small brick for the 80s origonal. When I was just a volunteer though after getting permission and my callsign I clipped the wide TX enable wire(the old outside of amateur band mod) on my amateur handheld radio so I could call in accidents to dispatch or talk on tactical channel without taking a radio off of the engine/rescue/ambulance; now those little VHF/UHF Baofengs and the like are so cheap and easy to USB program with CHIRP I would do that even even just to listen to dispatch freq in an untrunked unencrypted system. That said I was already carrying the radio to use the amateur repeater for ham chatting as well as callbacks to non-ham friends on the telephone patch in the days(1990s) when I could only afford paging service not a phone. I recommend any volunteer fire/EMS people reading this especially new excited ones get clear permission and probably a real department radio callsign before they transmit or they can expect to get stomped on by the Chief maybe asked to turn in their gear and shown the door, or at least a stern meeting with the comm officer and their Lt/Capt.
Veraendert
2020-04-22, 14:37
To dodge into a different direction may I ask what bulky analog device you have for callouts? Are people still using Motorola Minotaur and Minotaur IIs?(edit, damn they are up to the Minotaur 6, now as big as a little '90s belt pager now but still voice paging.)
I was a paid guy and finished as an officer and EMT-P but ended up taking the tech telated topics during my 8-5 work hours, though we were still doing in the VHF in rural western US when I medical'ed out.
I am also an amateur radio guy so hacking a VHF receiver with tone controls back then was cake though we also had commercial UHF POCSAG pagers with priority so they all beeped about 1-2 sec after the tones came over the VHF dispatch channel.
Not sure what your dispatch's setup looks like.
Big life altering advice for all first responders.
Lift properly, ask for help(hard for young guys, especially young volunteers), protect your spine, stairways with a patient on the cot and you are the backwards guy will get you; the damage you do might put you away fast or might just get worse over time; it is what ended my career.
Also remember that car drivers are what kill by far the most first responders and that people get lax at training events in a way they never would on a real call(hours of repeated extinguish/relight burn to learns especially).
Pass this on to the young guys at your department and wherever you end up doing teaching.
We use these: https://www.funkhandel.com/Swissphone-Quattro-XLi. To be phased our for ages- we're supposed to get shiny new digital devices. I was told so already when i joined the force though. And it still is just planned. I guess i'm not supposed to play around with my receiver. And being a lawyer (and therefore not that technically gifted) i probably shouldn't. And i wouldn't get the permission anyway. I'm unfortunately the one that told them not to give such a permission ever since it's forbidden here in Germany.
As for your advice: Being already older, i did tell the young ones how to lift properly and why it's important. They don't care much. We do have a routine how to work safely with car traffic around. And it's rigorously enforced. There's one team on each engine which is responsible for the safety of those on that engine.
I would guess they burn worse than 1A/H, they sure get hot
I've used them in a few projects over the years, largely als a receiver/transmitter for various devices operating on 433 MHz.
E.g. as an Internet-enabled thermostat for the furnace etc.
Could maybe work as a stationary alarm receiver internet relay sort of thing.
That said I was already carrying the radio to use the amateur repeater for ham chatting as well as callbacks to non-ham friends on the telephone patch in the days(1990s) when I could only afford paging service not a phone.
It seems to have gone full circle and people are using phones now for what has been previously the domain of radio amateurs.
vBulletin® v3.8.8, Copyright ©2000-2025, vBulletin Solutions, Inc.