I just made this small bash script that read the logfile and send a message to my iphone using prowl/growl
(prowl is a great tool for iphone to recive alerts)
You can save it and chmod u+x thisscript and then add it to your crontab and let it run every minute.
1. register to get your own API key at http://www.prowlapp.com/ and install the APP on yout iphone.
2. modify this script with your API key.
3. enter your deviceID that have motion event detection.
I know it would be better to include this like a module but I just wanted to add my own fast why to send prowl and hope some other find it usefull or can make a prowl module out of it.
(Iam not a bash guru, took me an hour to make and sorry for bad english, not my native.)
Code: Select all
#!/bin/bash
#Prowl alarm using bash and razbery z-wave
#Håkan Franzen 2015-03-15
#V1.1
Zwave_deviceid="19-0-48-1" # DeviceID you can find in the raz Z-Way Home Automation UI / Preferences / Widgets
Prowl_apikey=1111111111111111111111111111111112222233 # get your API key from http://www.prowlapp.com/
#---------------------------------------------------------
a=`echo $Zwave_deviceid | awk -F'-' '{print $1}'`
b=`echo $Zwave_deviceid | awk -F'-' '{print $2}'`
c=`echo $Zwave_deviceid | awk -F'-' '{print $3}'`
d=`echo $Zwave_deviceid | awk -F'-' '{print $4}'`
zdevice="devices.$a.instances.$b.commandClasses.$c.data.$d.level"
Timestamp=`cat /var/log/z-way-server.log | grep $zdevice | tail -1 | awk '{print $1$2}'`
zdevicestatus=`cat /var/log/z-way-server.log | grep $zdevice | tail -1 | awk '{print $8}'`
oldTimestampfile="/tmp/oldTimestamp$Zwave_deviceid"
oldTimestamp=`cat cat /tmp/oldTimestamp$Zwave_deviceid`
function prowl {
/usr/bin/curl -s https://api.prowlapp.com/publicapi/add -F apikey=$Prowl_apikey -F priority="1" -F application="Z-WAVE" -F event="ALARM" -F description="$1" >/dev/null
}
if [ "$Timestamp" = "$oldTimestamp" ]
then
echo "Nothing changed since last check"
else
echo "Sending alarm!"
echo $Timestamp >$oldTimestampfile
if [ "$zdevicestatus" = "True" ]
then
echo "Wine Celler door is OPEN"
prowl "Wine Celler door is OPEN"
fi
if [ "$zdevicestatus" = "False" ]
then
echo "Wine Celler door is CLOSED"
prowl "Wine Celler door is CLOSED"
fi
fi