The obvious protocol for such an alert system is MQTT. However, the MQTT interface module of the pywws software that I am using to manage my weather station doesn't seem to want to upload any data. After spending time debugging Python (confirming my dislike of the language), I gave up and decided to pursue an alternative strategy based upon the Twitter updates from the station. I implemented a NodeRed flow on the IBM BlueMix service which monitored the twitter feed and took various actions depending upon what it saw.
The warning rules I decided to implement were:
- The station is supposed to tweet a weather status every 10 minutes. If 15 minutes or more have passed since the last tweet something has malfunctioned, so the weather station twitter account (@llweather) sends a direct message to my personal account (@bodonovan).
- When it starts to rain (an all too frequent event in Ireland), the weather station sends me an @reply message to advise me to bring in any washing hanging on the line.
- The dashboard in my car warns of possible icy roads when the temperature drops below 3 degrees centigrade. Therefore I decided to get my weather station to also send me an @reply message when this happens (luckily this alert gets triggered less frequently in Ireland, but if I moved to Alaska I would need to tweak the threshold).
- I don't want to be annoyed by repeated tweets about the same weather event, so I put in some code that alerts of the same type won't be repeated more often than once every 6 hours.
- The application is configured not to send any warnings between midnight and 7am. I am interested in weather, but not interested enough to lose sleep over it.
Unfortunately, I didn't have to wait too long to get a real rain warning e.g.:@bodonovan temp has dropped to 9.9 wear a hat and gloves Tue Mar 14 2017 21:42:22 GMT+0000 (UTC)— Laurel Lodge Weather (@LLWeather) March 14, 2017
@bodonovan rain just started - bring in the washing Tue Mar 14 2017 16:12:21 GMT+0000 (UTC)— Laurel Lodge Weather (@LLWeather) March 14, 2017
At some stage in the future I will put some more effort into fixing the MQTT problems (partly as a way to learn Python better). But, for now the system seems to be working fine.