NOAA Weather alerts using RSS feed (US only)

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!

  1. 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.
  2. Install the Feed binding…
  3. Create a Feed Thing and use the URL from step 2…
  4. 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"}
  1. 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 :slightly_smiling_face:

3 Likes

Should there be an example here?

Sure… I’ll put in a screenshot and link to the Feed binding docs.

1 Like

Sorry, I did not realize there is a feed binding. I assumed something using http.

No worries… I added that step too!

1 Like

For those who want to use NOAA for their weather forecasts, I wish I had a nice and completed solution but I got stuck and abandoned it. But someone can pick it back up and also get the forecast and current conditions in addition to the alerts as described above. All the work I have done so far is documented at:

I got stuck trying to process out the forecasted precipitation as it is presented in a list of elements and you don’t know ahead of time how many elements will be in the list and what time period each element covers so it was hard to calculate the full day’s forecast.

It’d be easier to handle in Python than Rules DSL so it might be worth someone having another go at it if interested.

2 Likes