Alarm Script Recipes


 
Hah, you are a monster. I love how quickly you go from "Someone should write an msmtprc editor" to "BRB, finishing up the msmtprc editor".
Haha yeah well it became a priority when you guys jumped right onto alarm scripts. I'm pleased you're using that functionality and making it easier to use means someone might pop up with a cool new idea.

Looks to be working. Just need to make a package for it. Look it even supports multiple accounts! Although I can't easily figure out how to make it add one beyond the default.
EDIT: SMTP configuration is on the Services -> SMTP Client tab, not under LinkMeter as in the screenshot
 
Last edited:
Anyone want to test this luci-app-msmtp? It works with my config file and settings but I'd like to make sure it handles normal people's configs as well. Install it from System -> Software -> download and install, then it will be available in Services -> SMTP Client
 
Anyone want to test this luci-app-msmtp? It works with my config file and settings but I'd like to make sure it handles normal people's configs as well. Install it from System -> Software -> download and install, then it will be available in Services -> SMTP Client
did it then when to alarm tabs and got this

/usr/lib/lua/luci/dispatcher.lua:448: Failed to execute cbi dispatcher target for entry '/admin/lm/alarms'.
The called action terminated with an exception:
/usr/lib/lua/luci/cbi.lua:75: Model 'linkmeter/alarms' not found!
stack traceback:
[C]: in function 'assert'
/usr/lib/lua/luci/dispatcher.lua:448: in function 'dispatch'
/usr/lib/lua/luci/dispatcher.lua:195: in function </usr/lib/lua/luci/dispatcher.lua:194>
 
I did adjust it! All you had to do was put your gmail information in the default account slot. The other slot is only used if you uses `sendmail -a (accountname)` otherwise it uses the default account.
 
THANKS.
Were do I contribute to your attitude adjustment fund?
This thing is great and you just keep making it better We all Owe you big TIME!!!!
 
Damn, I wish I could read. I had seen the previous screen shot showing the SMTP configuration in LinkMeter->SMTP. No matter how hard I looked there I couldn't find it. I kept installing, removing, installing and nothing worked until I read the important part below.

Anyone want to test this luci-app-msmtp? It works with my config file and settings but I'd like to make sure it handles normal people's configs as well. Install it from System -> Software -> download and install, then it will be available in Services -> SMTP Client
 
From a stock install there should just be one tab, default. You can set up multiple accounts by adding more account lines to the msmtprc manually:
Code:
account default
account gmail
account hotmail
Then when you hit the SMTP Client configuration web page, you'll have a tab for each that will allow you to set the parameters. To use an account other than the default in your scripts, use the -a parameter such as `sendmail -a gmail me@gmail.com` instead of just `sendmail me@gmail.com`

If you just need the one account, as nearly everyone probably does, there's no need to muck about editing msmtprc directly or having multiple tabs in the configuration web page.
 
I'm trying to setup a new heatermeter and cannot for the life of me get the SMTP tab to come up (I do have an "Alarm Scripts" tab however).

I've written the latest openwrt-rpi.zip file from http://capnbry.net/linkmeter/snapshots/bcm2708/ to an SD card and then booted the SD card. After that I applied:

http://home.capnbry.net:22674/rpi/packages/luci-app-msmtp_1.4.27-1_brcm2708.ipk and
http://capnbry.net/linkmeter/snapshots/bcm2708/packages/linkmeter_4_brcm2708.ipk

but still no tab. Here's a list of programs installed.

Code:
Remove avahi-daemon 0.6.31-5 
Remove base-files 117-r35400 
Remove busybox 1.19.4-6 
Remove dropbear 2011.54-2 
Remove e2fsprogs 1.42.4-1 
Remove hostapd 20120910-1 
Remove hotplug2 1.0-beta-4 
Remove iw 3.6-1 
Remove iwinfo 36 
Remove jshn 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8 
Remove kernel 3.3.8-1-425b654c6d4052b736897104e0c7ed5a 
Remove kmod-8192cu 3.3.8+3.4.3-1 
Remove kmod-hid 3.3.8-1 
Remove kmod-input-core 3.3.8-1 
Remove kmod-input-evdev 3.3.8-1 
Remove kmod-nls-base 3.3.8-1 
Remove kmod-spi-bcm2708 3.3.8-1 
Remove kmod-spi-dev 3.3.8-1 
Remove kmod-usb-core 3.3.8-1 
Remove kmod-usb-hid 3.3.8-1 
Remove libavahi 0.6.31-5 
Remove libblkid 2.21.2-1 
Remove libblobmsg-json 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8 
Remove libc 0.9.33.2-1 
Remove libcom_err 1.42.4-1 
Remove libdaemon 0.14-2 
Remove libexpat 2.0.1-1 
Remove libext2fs 1.42.4-1 
Remove libgcc 4.6-linaro-1 
Remove libgdbm 1.9.1-2 
Remove libiwinfo 36 
Remove libiwinfo-lua 36 
Remove libjson 0.9-2 
Remove liblua 5.1.4-8 
Remove libnl-tiny 0.1-3 
Remove libopenssl 1.0.1c-1 
Remove libpthread 0.9.33.2-1 
Remove librrd 1.4.5-LM2 
Remove librt 0.9.33.2-1 
Remove libubox 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8 
Remove libubus 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50 
Remove libubus-lua 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50 
Remove libuci 2013-01-04.1-1 
Remove libuci-lua 2013-01-04.1-1 
Remove libuuid 2.21.2-1 
Remove linkmeter 4 
Remove lua 5.1.4-8 
Remove luci-app-msmtp 1.4.27-1 
Remove luci-i18n-english 0.11.1-1 
Remove luci-lib-core 0.11.1-1 
Remove luci-lib-ipkg 0.11.1-1 
Remove luci-lib-lucid 0.11.1-1 
Remove luci-lib-lucid-http 0.11.1-1 
Remove luci-lib-nixio 0.11.1-1 
Remove luci-lib-px5g 0.11.1-1 
Remove luci-lib-sys 0.11.1-1 
Remove luci-lib-web 0.11.1-1 
Remove luci-mod-admin-core 0.11.1-1 
Remove luci-mod-admin-full 0.11.1-1 
Remove luci-proto-core 0.11.1-1 
Remove luci-sgi-cgi 0.11.1-1 
Remove luci-theme-base 0.11.1-1 
Remove luci-theme-openwrt 0.11.1-1 
Remove msmtp 1.4.27-1 
Remove netifd 2013-01-29.2-4bb99d4eb462776336928392010b372236ac3c93 
Remove opkg 618-3 
Remove resize2fs 1.42.4-1 
Remove rrdtool 1.4.5-LM2 
Remove ubus 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50 
Remove ubusd 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50 
Remove uci 2013-01-04.1-1 
Remove wpa-supplicant 20120910-1 
Remove zlib 1.2.7-1

Also, if I had an alarm setup that was working before these updates, should I just be able to copy the MSMTP file and alarm-xx files to the respective locations and have this thing work ?

One other alarm question. On my old system when I was able to get it to work I would only get one alarm even if the temperatures went back to the "in control" range. In order to get another alarm I would have to go back into the web interface and "arm" it again. Is there someway to set things up so I'll automatically get an alarm without having to "re-arm" the alarm?

Sorry for all the questions.

Thanks. Alan.


Edit: I did find a SMTP configuration tab, but it's under System and not Linkmeter. Is this the way it should be?
 
Last edited:
I'm trying to setup a new heatermeter and cannot for the life of me get the SMTP tab to come up (I do have an "Alarm Scripts" tab however).
Did you reboot? The luci cache algorithm won't check for new modules installed.
Also, if I had an alarm setup that was working before these updates, should I just be able to copy the MSMTP file and alarm-xx files to the respective locations and have this thing work ?
Yes, in fact the next snapshot will do this exact step as part of the backup/restore process.
One other alarm question. On my old system when I was able to get it to work I would only get one alarm even if the temperatures went back to the "in control" range. In order to get another alarm I would have to go back into the web interface and "arm" it again. Is there someway to set things up so I'll automatically get an alarm without having to "re-arm" the alarm?
No, the way the code works is that if it passes the alarm point, the alarm goes off and keeps going off until you disable it and then stays disabled until you re-enable it. This is because it doesn't check that the alarm is out of the alarm range before triggering and prevents the alarm from going off continuously every time you try to disable it.

I will probably revisit this now I've had more of a chance to use the alarms. When I wrote it it was easiest to test that way and it was difficult to disable the alarm once it was going off. I'm thinking it would be best if the alarm system required that you had to be outside the alarm region before it will engage and fire.
 
OK. I re-booted and pretty much go it working. I still don't get the "SMTP" tab under Linkmeter, but I do get it under "Services", so that's all that really matters.

Bryan, is there a minor typo on your Github alarm scripts page wiki? Should the word "non-zero" but changed to zero? "The system first looks for alarm-all, and executes that. If the return value of that script is non-zero, the system looks for a file named alarm-{probeidx}{alarmtype}. "

If the script value is zero, then it runs the file named "alarm--{pro........." , correct?

Edit: I guess it depends on whether you are talking about the "All" script being non-zero or the "alarm specific" script being non-zero.
 
Last edited:
Yeah I moved it under Services, which is the LuCI standard for addons like this. The screenshot is a little confusing I'll edit.

Good call on the wiki, you're right. I changed the way it worked to do multiple scripts and edited the wiki, but I guess I did it backwards. The proper way is that by default it will execute the "all" and specific script, unless you return non-zero in which case the specific script will not be executed.
 
Thanks. Everything seems to be working. I also stumbled on the Archive tab. Pretty slick.

About the only thing I need now is an Android app to make the SMS message from myself into an alarm instead of a chirp so I will wake up at night if I'm doing an overnight cook. The app "Tasker" has come up when I googled trying to find a program, but it's $7 and it seems to do a LOT more than I need.
 
Last edited:
Hopefully someone can help me. I'm trying out the new alarms. Here is what I'm trying:
#!/bin/sh
# The first line of any shell script must begin with the above #! line
# Comments begin with #
# Silence this alarm
al_set 0
echo "$pn Alert -- $pcurr $al_type" | sendmail -a gmail 5125798677@messaging.sprintpcs.com


Just a simple cut-n-paste from the WIKI. However, I"m not seeing it trigger, it is enabled, I did have the temp go higher than the temp I specified. I did see it trigger once, but never again.

I have manually verified that the email works. I just used: echo "test" | sendmail -a gmail ..... and got my email, so that works.

Why isn't the alarm triggering?

dave
 

 

Back
Top