Severe Weather Alerts from the US National Weather Service

Thanks

I forgot to ask…

Does your component handle the periodic “unavailable” and “unknown” states that I filtered out in my last iteration above?

I’m not positive about that one. I’ll have to do more testing.

I’ve updating the custom component to allow for more than one zone per sensor.
Ex:

- platform: nws_alerts
  zone_id: 'PAC049,WVC031'

I seem to be blind to where I specify my Alexas or Dots.

I think that the only thing that the custom component does is creates a sensor. You still have to use the resulting information from the sensor in your automations to trigger the pop ups and announcements.

I think…

Thanks again.

I’m going to try it right now and see what happens.

I’ll keep you posted.

@eracknaphobia first thank you for sharing this component i have one question ?
i use ios notifications for home assistant so when i use this automation i only get the number of alerts but no the text is any way to pass the content to the message notification this is my automation

  - alias: NWS alertas
    trigger:
      platform: state
      entity_id: sensor.nws_alerts
    condition:
      condition: template
      value_template: '{{states.sensor.nws_alerts.state | int > 0}}'
    action:
      - service: notify.ios_my_iphone
        data:
          message: "NWS: {{ states.sensor.nws_alerts.state }}"

there should be the state which should represent the count of active alerts.

then there should be three attributes - a “title”, a “display_desc” and a “spoken_desc”.

You should be able to access them like:

states.sensor.nws_alerts.attributes.title

states.sensor.nws_alerts.attributes.display_desc

states.sensor.nws_alerts.attributes.spoken_desc

And one more question…

How often does the sensor update?

thank you that did the trick

Please excuse my ignorance/confusion for a moment. So is this new nws_alerts a replacement for ALL of the previous nws sensors from finity’s project?

no. Just the sensor portion.

You still need all of the scripts and automations. You’ll just need to switch over to the new sensor information if you want to use that component and not the REST sensor that I am using.

I’m testing it out right now but I’m not receiving any information in the new sensor yet and it’s been running for about half an hour. We actually have one active alert right now (“Special Weather Statement”) that’s not showing up for some reason.

@eracknaphobia

Is there anything I can check to see why it’s not updating yet?

Okay, I’ll do the same and join you. We get ALOT of severe weather announcement testing opportunities here in Texas.
I just replaced the rest sensors. I left your sensor templates in place. Can they go also?

What is sensor.nws_alerts state? I added INZ009 to my sensor and it bumped it to 2 alerts now…

Looks like I should probably add the title of the alert before the description. Kinda hard to tell where the first alert ends and the second begins.

I tried it first with both in the same sensor

- platform: nws_alerts
  zone_id: ‘INZ009,INC033’

And I didn’t get anything in the states or attributes (0 state & null for all attributes)

Then I thought I’d try it with them split out:

- platform: nws_alerts
  zone_id: ‘INC033’

- platform: nws_alerts
  zone_id: ‘INZ009’

And here is the result from that attempt (the same result):

I’m not getting any errors in the log either.

EDIT: Hold on… I just saw I’ve got fancy quotes in the zone lines. Let me fix those…

EDIT 2: That fixed it. Well, that was a rookie error. :flushed: That’s what I get for being lazy and just copy and pasting from your post.

1 Like

Glad it works. :grinning:

1 Like

You might want to go back and edit your first post above where I copied the code from. It looks like there are curly quotes in there.

We don’t want that to propagate anymore and cause more confusion.

Good point. I’ve fixed it.

It updates every 5 minutes. Seems like the json file gets updated every 10+ minutes so I figured 5 minutes would be a good start. I could probably add a setting to let the user define update interval. I could see that for some alerts, like tornado’s, every minute counts but starting off I didn’t want to spam nws servers and I couldn’t find a concrete update interval / limit in there api documentation so I was just playing it safe for now.

I’m getting an error in my logs every 5 minutes now…

2018-10-15 17:48:25 ERROR (SyncWorker_6) [homeassistant.components.sensor.rest] Error fetching data: <PreparedRequest [GET]> from https://api.weather.gov/alerts/active/count failed with HTTPSConnectionPool(host='api.weather.gov', port=443): Read timed out. (read timeout=10)

Dunno if this is just a timeout at nws or if we have a code issue.

I didnt mean to start a new topic but i did LOL https://community.home-assistant.io/t/all-in-one-packages-question/79205