Severe Weather Alerts from the US National Weather Service

Can you export the flow. Not a screen shot.

Sorry still a little new to this. Is this what you are looking for?

[{"id":"ef54818a.9b2b3","type":"tab","label":"Weather","disabled":false,"info":""},{"id":"cdcce678.6bd218","type":"e-mail","z":"ef54818a.9b2b3","server":"10.1.1.10","port":"25","secure":false,"tls":false,"name":"[email protected]","dname":"","x":390,"y":260,"wires":[]},{"id":"c1b5ba56.45ac28","type":"server-state-changed","z":"ef54818a.9b2b3","name":"NWS Alerts","server":"4cb643b8.f59d2c","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.nws_alerts","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":true,"ignorePrevStateUnknown":true,"ignorePrevStateUnavailable":true,"ignoreCurrentStateUnknown":true,"ignoreCurrentStateUnavailable":true,"x":90,"y":320,"wires":[["44e9d2b6.2474fc"]]},{"id":"9f3d8bb7.f183e8","type":"api-call-service","z":"ef54818a.9b2b3","name":"Alexa Announce Master Bedroom","server":"4cb643b8.f59d2c","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_scott_s_bedroom_dot","entityId":"","data":"{\"message\":\"Weather Alert,,,{{payload}}\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":440,"y":200,"wires":[["6f693caa.5d61d4"]]},{"id":"923fb52d.8ad5c8","type":"split","z":"ef54818a.9b2b3","name":"","splt":" - ","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":590,"y":320,"wires":[["efd76f6b.dbc7a"]]},{"id":"c784c6af.596278","type":"api-current-state","z":"ef54818a.9b2b3","name":"Alert Type","server":"4cb643b8.f59d2c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.nws_alert_type","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":440,"y":320,"wires":[["923fb52d.8ad5c8"]]},{"id":"efd76f6b.dbc7a","type":"switch","z":"ef54818a.9b2b3","name":"Alert Types","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Unknown","vt":"str"},{"t":"cont","v":"Warning","vt":"str"},{"t":"neq","v":"Unknown","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":150,"y":240,"wires":[[],["9f3d8bb7.f183e8"],["cdcce678.6bd218"]]},{"id":"6f693caa.5d61d4","type":"api-current-state","z":"ef54818a.9b2b3","name":"Alert Speak","server":"4cb643b8.f59d2c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.nws_alert_speak","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":730,"y":180,"wires":[["74d06a87.ccda74"]]},{"id":"74d06a87.ccda74","type":"split","z":"ef54818a.9b2b3","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":890,"y":180,"wires":[["1d396853.fca548"]]},{"id":"1d396853.fca548","type":"switch","z":"ef54818a.9b2b3","name":"Weather Alert Speak","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"Warning","vt":"str"},{"t":"cont","v":"WARNING","vt":"str"},{"t":"cont","v":"warning","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":400,"y":120,"wires":[["77f84be6.1e92e4","e42ae6de.f5ce88"],["77f84be6.1e92e4","e42ae6de.f5ce88"],["77f84be6.1e92e4","e42ae6de.f5ce88"]]},{"id":"77f84be6.1e92e4","type":"api-call-service","z":"ef54818a.9b2b3","name":"Alexa Announce Master Bedroom","server":"4cb643b8.f59d2c","version":1,"debugenabled":false,"service_domain":"notify","service":"alexa_media_scott_s_bedroom_dot","entityId":"","data":"{\"message\":\"{{payload}}\",\"data\":{\"type\":\"tts\"}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":740,"y":100,"wires":[[]]},{"id":"e42ae6de.f5ce88","type":"api-call-service","z":"ef54818a.9b2b3","name":"Turn On Lights","server":"4cb643b8.f59d2c","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"media_player.tcl","data":"","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":680,"y":40,"wires":[[]]},{"id":"44e9d2b6.2474fc","type":"delay","z":"ef54818a.9b2b3","name":"","pauseType":"delay","timeout":"200","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":270,"y":320,"wires":[["c784c6af.596278"]]},{"id":"3da1dfcb.70ace","type":"inject","z":"ef54818a.9b2b3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":430,"y":40,"wires":[["e42ae6de.f5ce88"]]},{"id":"4cb643b8.f59d2c","type":"server","name":"Home Assistant","addon":true}]
1 Like

Thanks for posting this. Iā€™m wondering how you created the ā€œAlert Typeā€ sensor. Iā€™m assuming you used a template sensor to pull out the title. What happens if thereā€™s more than one alert? Could you possibly share your config for that sensor?

Yes I did use Template sensors to pull the title and spoken_desc. This is what I have in my configuration.yaml file:

- platform: template
     sensors:
       nws_alert_type:
         value_template: "{{ state_attr('sensor.nws_alerts', 'title') }}" 
       nws_alert_speak:
         value_template: "{{ state_attr('sensor.nws_alerts', 'spoken_desc') }}"

-------------------------ā€™
To deal with the issue of multiple concurrent alerts I use a ā€œSplitā€ node in NodeRed, to break apart individual messages using the ā€˜-ā€™ as the delimiter in the String / Buffer field. (See Below) The Split node looks for the ā€˜-ā€™ character in the title string, then if it exists it sends out each title as a different message. So the output of the Split node may have one event in, but then outputs an event for each alert. I do the same with the spoken_desc on the Alert Speak node output.

I am having to rebuild my system after a crash and finding that over the last month the backups were corrupted.

Where can I find the latest code to rebuild my weather alerts.
After reading the posts it seems that there are many iterations in this discussion.
Thanks

I assume you are using HACS?

if so then just go there and search for ā€œnws alertsā€ and install it.

if not then go to the github and follow the instructions there.

1 Like

Any chance you could share your flow?

I know this is a bit old, but it may be easier to filter it as part of the original request.

Per the NWS documentation, it sound like adding another variable could filter out test messages
https://www.weather.gov/documentation/services-web-api#/default/get_alerts

status          Status (actual, exercise, system, test, draft)
array[string]   Available values : actual, exercise, system, test, draft
(query)

so I think you could just append &status=actual to avoid any exercise/system/test/draft alerts.

Similarly someone asked about duplicates which I am GUESSING may be ā€œupdatesā€ and thereā€™s a filter for that too.

message_type    Message type (alert, update, cancel)
array[string]   *Available values* : alert, update, cancel
(query) 

Still working on mine based on thisā€¦I am thinking I may try to do binary_sensors for the types of alerts I am specifically interested in (my area gets TONS of flood warnings any time it rains)ā€¦you can apparently fliter more than one type of alert too in the options.

In my case, I am only interested in very specific sub-set of warnings (not watches) so I think something like this seems to workā€¦

&status=actual&message_type=alert,update&urgency=immediate,expected&event=Blizzard Warning,Winter Storm Warning,Ice Storm Warning,High Wind Warning,Severe Thunderstorm Warning,Tornado Warning,Extreme Wind Warning,Tropical Storm Warning,Hurricane Warning

Iā€™m still figuring out how I want it, I may split into several binary_sensors for a couple types of storms but Iā€™m still working out the details. Iā€™ll try and remember to post an update when I work more out.

2 Likes

Please keep us updated. I have gotten a few tsunami tests via the NWS and was wondering if I could filter it out, especially since I use it in automations.

So are you forking the current NWS Integration (and then pull request later) or are you making your own REST sensors to pull the data?

Is there a NWS integration that already gives you the alerts broken out into sensors easily for your area?

I was starting from scratch with my own ā€œhow can I get the data and make a sensorā€ and this thread was the only thing sounded at all like what I want.

My end-goal is to do things like reconfigure HVAC in conditions that will likely cause power outagesā€¦e.g turn down A/C when a summer storm is about to hit or push up heat if an ice-storm is coming since Iā€™ve been ā€œburnedā€ by a couple power failures at not good times (3AM when heat is down at 66F or just before coming home when A/C is up at 78F) and then its miserable freezing or sticky hot.

In my case, I have zero interest in the forecast or current conditions (I can get from my backyard weathehr station) I am only interested in ā€œabout to be poundedā€ type EAS alerts

this integration doesnā€™t break out the alerts for you but you can use the alerts that are broken out in the attributes of the sensor that it creates to create tour own sensors from them. And template binary sensors/sensors allow you to filter out only the alerts you want to see from those attributes.

I filter out for only severe thunderstorm warnings and tornado warnings for my automations to trigger whole house ā€œwake up!ā€ announcements. everything else just gets a pushbullet notification and a pop up persistent notification in the frontend.

the integration already provides you all the data you need. All you have to do is set up the filters you want.

Just tried it, downside to the NWS integration is it looks like it wants a weather station, and I assume youā€™d get alerts for that location vs the county you are actually in. In my case the ā€œnearest weather stationā€ is actually probably 30 miles away in a different county.

I may leave it on for a while but I am skeptical it would provide accurate alerts vs this API with a sensor scraping the data and using my county alert zone-code.

Are you talking about the official built-in NWS integration or my custom ā€œNWS Alertsā€ integration?

in mine you can input a county or zone just as you would for getting alerts directly from the NWS API. Because thatā€™s what my integration is based on. it provides no less location specificity than the NWS API.

1 Like

As said there is a NWS Alerts Integration; the downside for me is that it does not present the message type to allow not getting tests.

BTW, not 20 mins after I posted the last time, I got a tsunami test alert.

I can look into adding that to the NWS alerts integration attributes for each alert. Hopefully that wonā€™t be too hard to do.

can you give me an event_id for an alert (provided by the integration) that contained a test message so I can see the structure of the alert?

the funny thing is that this thread is supposed to be specifically about that integration and how it has evolved.

:slightly_smiling_face:

The one under Configuration > Integrations > Add; is there more than one place?

I guess the official one National Weather Service (NWS) - Home Assistant

That got lost in the 296 posts in the tread.
I canā€™t pull the event id out of my history, it only has the number of alerts in history or logbook. andā€¦of courseā€¦I donā€™t have influxDB up at this time.

The best I got is that it happened at 0933 PST
I have the following Zones: WAC035,WAZ559,WAZ654

From the integration the only part that says test is in the detailed description, of course I have everything set to use the spoken description which does not say ā€˜testā€™ in it. The only test I have ever gotten have been tsunami alerts. The integration works great for my case, it is just the test alerts that are an annoyance. If I remember on the next test I will at least get a screenshot; but that will probably be 90 days from now.

@mmiller7

you can add the custom integration thru HACS if you use it or by going to my github and installing it from there manually. The link is somewhere up there :point_up_2: but if you canā€™t find it Iā€™ll post it again.

@GlennHA

Iā€™m not really sure how to find old alerts unless I have the event id.

So, yeah, the next time it happens please make sure to grab that info for me and Iā€™ll see about including it in the event data for you.

I might just add a swath of areas and see if I get a test hit.

I do that for testing the integration and itā€™s kind of a pain because you keep getting all kinds of notifications you just really donā€™t care about. :laughing: