weewx alerting

218 views
Skip to first unread message

Ryan Stasel

unread,
May 12, 2023, 10:42:35 PM5/12/23
to weewx-user
Hey All,

Is there a way to have WeeWX send email alerts for when it hasn’t received data from the station after X amount of time? My Weatherlink seems to have gone offline a few days ago (network dropped, but kept logging data thankfully), but I didn’t notice until now. 

Is there an option to have it alert? I see alarming for weather conditions here: https://github.com/weewx/weewx/blob/master/examples/alarm.py but not really anything for “I haven’t gotten any data for X time, or “station has gone offline””

Thanks! 

-Ryan Stasel

vince

unread,
May 13, 2023, 2:40:14 PM5/13/23
to weewx-user
I always recommend a standalone external program called occasionally by cron as the simplest way to do these kinds of things.

Here's a quickie script in bash as an example

#!/bin/bash
# max time since last record in seconds
maxDifference=3600

# timestamp of the last record in the db
lastTimestamp=`echo "select dateTime from archive order by dateTime desc limit 1;" | sqlite3 weewx.sdb`

# current timestamp
now=`date +%s`

# difference in timestamps
declare -i delta=${now}-${lastTimestamp}

# print it out
echo "lastTimestamp=${lastRecord} now=${now} delta=${delta}"
if test ${delta} -gt ${maxDifference}
then
    echo "too long since last record"
    # put something here to syslog and/or email
else
    echo "last record check within limits"
fi

Doug Bo

unread,
May 14, 2023, 12:16:58 PM5/14/23
to weewx-user
Funny, I was just thinking I need a script to monitor weewx remote installs.  Thanks!

Doug B.
Reply all
Reply to author
Forward
0 new messages