[DEPRECATED] NOAA Weather Alerts

The new poll frequency was not working for me (v1.1.3). I observed that when I set the poll frequency to 1 minute intervals, it continued to operate at 5 minute intervals. This was seen in the apps status page under scheduled jobs.

I temporarily added logging information with each case statement and found that the problem was 2 fold.

  1. It was executing each case statement as if it were true, ending with the default which is runEvery5Minutes(refresh).
  2. After the overall switch statement concluded, runIn(5,"refresh") was still being called thus overwriting the schedule just set within the switch statement.

After testing, I came to the following solution in the Updated() function:

	switch (whatPoll.toInteger()) {
		case 1: 
			runEvery1Minute(refresh)
			break
		case 5: 
		    runEvery5Minutes(refresh)
            break
		case 10: 
		    runEvery10Minutes(refresh)
			break
		case 15: 
		    runEvery15Minutes(refresh)
 			break
		case 30: 
			runEvery30Minutes(refresh)
 			break
		default: 
			runEvery5Minutes(refresh)
 			break
	}
	//runIn(5, refresh)  // remove

@rayzurbock Thank you! I forgot the breaks. Much appreciated! Will be fixed later today. :grin:

So this will only work with tts devices ? What is push over?

Well, NOAA works with any music or speech device that you have integrated with HE. So that would include, but limit to, Sonos, Samsung, Alexa, Google Home, etc. NOAA will announce within your home based on what you want to be alerted to.

PushOver is a service that enables device notifications. HE only supports 10 sms/txt messages a day. So the integrated solution to device notification is PushOver. NOAA can send a device notification also to devices.

I think I’m following.

So what your saying for push over is that I do t have to use he limited text messaging notifications?

The app has its own?

Lastly? noAa doesn’t support Canada ??

So PushOver is the solution to use for device notification in replacement of sms/txt messages.

Also this app is only supports NOAA for USA alerts. I just looked and it seems Canada uses a similar solution. I will look to see if they have an API that I can consume to provide weather alerts for USA and Canada.

Awesome.

Thanks!

v1.1.4 - fixed poll frequency case statement

@mik3 So I did some research and unfortunately similar to anyone OUTSIDE of the USA no other country provides API access to any XML or JSON feeds. Canada uses an ATOM feed without headers so parsing is going to be difficult. Sorry unless there is an API I can leverage that is standardized I won't be able to add it to NOAA. :frowning:

We had a severe thunderstorm warning today and I finally got to hear the alert play on all of my Google Home's. Worked great, except the message that played was too long for my taste.
I don't know if you want to provide this as an optional setting or not, but I modified the code on my hub as follows:

//DISABLE ORIGINAL alertmsg = "${alertseverity} Weather Alert. for the following counties: ${alertarea}.  ${response.data.features[0].properties.event}. . . This is the end of this Weather Announcement." //BL
alertmsg = "${alertseverity} Weather Alert. ${response.data.features[0].properties.headline}. ${response.data.features[0].properties.instruction}. . This is the end of this Weather Announcement."  //BL

This produces the much shorter message:

{prefix message}. Severe Weather Alert. Severe Thunderstorm Warning. Severe Thunderstorm Warning issued March 9 at 8:40AM CST expiring March 9 at 9:00AM CST by NWS City State. For your protection move to an interior room on the lowest floor of a\nbuilding.\n\nTorrential rainfall is occurring with this storm, and may lead to\nflash flooding. Do not drive your vehicle through flooded roadways. This is the end of this Weather Announcement.

Note: I'm also changing " CST" to "" as I know what timeZone I'm in and I'm adjusting " NWS " to " the national weather service ".

I'm also not interested in announcing for "watches" or future events so I added the following as well within the refresh() code:

alerturgency = response.data.features[0].properties.urgency  //(shows as Immediate or Future)
and wrapped the alertmsg building code within:
if(alerturgency == "Immediate"){
   ....
  alertmsg = .....
}
2 Likes

@rayzurbock I will play with what you have here. I will probably make use of some of these changes as the alert feed from the api is quite wordy but it was more accurate compare to the immediate alerts feed. Appreciate the contributions!!

Can you PM the wordy version of the alert if you don’t mind? Want to compare what you have verses what the original.

I'm actually still hacking around on the code and thought why not throw all of the stuff into variables, then maybe add an "advanced" mode setting or something where a user could just type in the format that they want, such as

"{alertprefix}. {alertseverity} weather alert. Certainty is {alertcertainty}. Urgency is {alerturgency}. {alertheadline}. {alertinstruction}. This is the end of the weather announcement."

It would take setting the following in the refresh(), adding an advanced mode that allowed you to type what alertmsg should be (perhaps showing the available variables, then also in refresh() adding additional alertmsg.replaceAll's to translate alertprefix, alertseverity, etc to what the NWS alert says.

alertareadescription = response.data.features[0].properties.areaDesc
alertsent = response.data.features[0].properties.sent
alerteffective = response.data.features[0].properties.effective
alertexpires = response.data.features[0].properties.expires
alertstatus = response.data.features[0].properties.status
alertmessagetype = response.data.features[0].properties.messagetype
alertcategory = response.data.features[0].properties.category
alertseverity = response.data.features[0].properties.severity
alertcertainty = response.data.features[0].properties.certainty
alerturgency = response.data.features[0].properties.urgency
alertevent = response.data.features[0].properties.event
alertsendername = response.data.features[0].properties.sendername
alertheadline = response.data.features[0].properties.headline
alertdescription = response.data.features[0].properties.description
alertinstruction = response.data.features[0].properties.instruction
alertresponse = response.data.features[0].properties.response

Edit:
replace's to set before sending for notification/speech:

alertmsg = alertmsg.replace("{alertareadescription}","${alertareadescription}")
alertmsg = alertmsg.replace("{alertsent}","${alertsent}")
alertmsg = alertmsg.replace("{alerteffective}","${alerteffective}")
alertmsg = alertmsg.replace("{alertexpires}","${alertexpires}")
alertmsg = alertmsg.replace("{alertstatus}","${alertstatus}")
alertmsg = alertmsg.replace("{alertmessagetype}","${alertmessagetype}")
alertmsg = alertmsg.replace("{alertcategory}","${alertcategory}")
alertmsg = alertmsg.replace("{alertseverity}","${alertseverity}")
alertmsg = alertmsg.replace("{alertcertainty}","${alertcertainty}")
alertmsg = alertmsg.replace("{alerturgency}","${alerturgency}")
alertmsg = alertmsg.replace("{alertevent}","${alertevent}")
alertmsg = alertmsg.replace("{alertsendername}","${alertsendername}")
alertmsg = alertmsg.replace("{alertheadline}","${alertheadline}")
alertmsg = alertmsg.replace("{alertdescription}","${alertdescription}")
alertmsg = alertmsg.replace("{alertinstruction}","${alertinstruction}")
alertmsg = alertmsg.replace("{alertresponse}","${alertresponse}")
alertmsg = alertmsg.replace(" CST","")
alertmsg = alertmsg.replace(" CDT","")
alertmsg = alertmsg.replace(" MDT","")
alertmsg = alertmsg.replace(" MST","")
alertmsg = alertmsg.replace(" PST","")
alertmsg = alertmsg.replace(" PDT","")
alertmsg = alertmsg.replace(" EST","")
alertmsg = alertmsg.replace(" EDT","")
alertmsg = alertmsg.replace(" NWS "," the national weather service ")
alertmsg = alertmsg.replaceAll("\n"," ")
state.alertmsg = alertmsg
1 Like

v2.0.0 updated and available. A lot of new options and improvements.

1 Like

I'm getting this error after updating when doing the test alert on version 2.0

app:2892019-03-11 03:39:36.563 pmerrorgroovy.lang.MissingMethodException: No signature of method: java.lang.String.call() is applicable for argument types: (java.lang.String) values: [Testing Severe Weather Alert for the following counties: Springfield County. The founder, Jebediah Springfield has spotted a cloud above the nuclear power plant towers. Expect heavy polution, possible fish with three eyes, and a Simpson asleep at the console. . . This is the end of this Severe Weather Announcement.] Possible solutions: wait(), any(), wait(long), split(java.lang.String), each(groovy.lang.Closure), take(int) on line 134 (mainPage)

@bfara83 v2.0.1 with the appropriate fixes. Sorry about that!

1 Like

Thanks for implementing the recent changes. We are expecting some thunderstorms tomorrow so if they reach severe level (likely) hopefully I'll get good alerts from this. I'll report back.

1 Like

[UPDATE] 2.0.2 - fixed {alertevent} replacement, modified URI string to only look for actual alerts (NOAA was notifying test events due to lack of URI refinement)

So with the severe weather coming to the west/Midwest did the latest updates work for you all?

No alerts were issued where I am so I didn't get to test it out like I had hoped.

Yeah my weather reports were not severe or extreme so didn’t get any alerts.

1 Like