We had been scraping weather alerts from wunderground until they changed their API. This is a really simple solution that I finally setup as a replacement. The tricky part is knowing that the feeds exist and what the URL is for your area. There are feeds other than alerts available too!
- Find the URL for the area that you want the alert for… https://alerts.weather.gov/. Scroll down and select your state, then county, then copy the URL from the address in your browser. For example, this is for our area… NWS Alerts.
- Install the Feed binding…
- Create a Feed Thing and use the URL from step 2…
- Create Items…
Group gNWS_Public_Alert "NWS Public Alert RSS Feed" <text>
String Feed_NWS_Public_Description_Latest "NWS: Latest description [%s]" <text> (gNWS_Public_Alert) {channel="feed:feed:nws-public-alert:latest-description"}
DateTime Feed_NWS_Public_Date_Latest "NWS: Latest date [%1$tA, %1$tB %1$te, %1$tY at %1$tl:%1$tM%1$tp]" <calendar> (gNWS_Public_Alert) {channel="feed:feed:nws-public-alert:latest-date"}
- Create a rule. This example requires the openHAB Cloud Connector and
myopenhab.org
to be setup with a mobile device to receive the notifications, but modify it to setup your own method of communicating the alert. I have a notification function that includes TTS audio notifications, which could also easily be done through the amazonalexacontrol binding
from core.rules import rule
from core.triggers import when
from core.actions import NotificationAction
@rule("Alert: NWS public alert")
@when("Item Feed_NWS_Public_Description_Latest changed")
def nws_update(event):
NotificationAction.sendBroadcastNotification(u"Weather Alert: {}".format(items["Feed_NWS_Public_Description_Latest"].toString()))
You probably won’t need the Feed_NWS_Public_Date_Latest Item, but I use it in an announcement that plays periodically throughout the day when the mode changes…
if items["Feed_NWS_Public_Date_Latest"].zonedDateTime.isAfter(DateTimeType().zonedDateTime.minusDays(1)):
temp_reminder = "{}\nReminder: {}".format(temp_reminder, items["Feed_NWS_Public_Title_Latest"])
BTW, this is currently the easiest way to setup Jython …