Severe Weather Alert

I am trying to figure out if it is possible to have a severe weather event trigger a light to start flashing, and then the user can turn off the light after acknowledging the alert.

I have the severe weather alert already setup as a sensor in hassio that gives the user an indication of how many alerts are active.

I’m quite a noobie, but I suppose you could create a recursive automation that is triggered by the severe weather sensor, toggles the light and calls itself. It will have a boolean condition that is toggled by the physical light switch and inhibit the automation. Once it’s inhibited, it won’t call itself within a certain period of time (a day, for instance)

Which weather alert integration are you using?

Rest, setup in configuration manually.

It’s hard to know what’s possible without knowing the info that your rest sensor provides.

This is what I have added in my config, The sensor just provides an alert via the dashboard tile.

  • platform: rest
    resource: https://api.weather.gov/alerts/active/count
    name: NWS Alert Count
    value_template: >
    {% if value_json.zones.OH is defined %}
    {{ value_json.zones.OH }}
    {% else %}
    0
    {% endif %}
    headers:
    User-Agent: Homeassistant
    Accept: application/ld+json
    scan_interval: 60

Please format code using the </> button. Are you sure you mean zones and not areas? Looking at the data at that URL, the zones are more specific, and the state counts are in areas.

You could set up an automation to turn your flashing light on based on changes to the value of your sensor, and another one to switch it off based on notification dismissal, but you’d need to decide how you want it to trigger:

  • only when it goes above 0?
  • on any increase?

You could do the second version using trigger variables.

Not to toot my own horn…But I have an integration that provides alerts from the NWS as well.

it not only provides a count of alerts but it provides the actual alert data as attributes so you can set up automations based on that data.

I even have an example config that you can use to set up some useful notifications.

the integration (nws_alerts) is in HACS but you can find the github repo here:

and my example package is here:

3 Likes

@finity Sorry to bring up an old post, but I’m having an issue getting NWS alerts started. I download from hacs, but never get the integration to show up after that. I went ahead and added the sensor, shows up in dev. tools. Then I get state “0” and attribution: Data provided by Weather.gov
title: null
event_id: null
message_type: null
event_status: null
display_desc: null
spoken_desc: null
icon: mdi:alert
friendly_name: NWS Alerts

Any idea where this is going wrong? I’ve tried downloading, removing, downloading, clearing cache.

How did you add the sensor? Manually in yaml or thru the integrations UI?

I did it through yaml, because nws alert isn’t showing up in the integrations

Do you have any active alerts for your area?

you can go to “https://api.weather.gov/alerts/active/count” and look for your zone info in the list. If your zone isn’t in the list then you have no active alerts and what you are seeing is normal.

Usually pressing F5 fixes that. :slight_smile:

Thanks for getting back to me! Appears to be working. Sorry to bother, it threw me off when the integration wasn’t showing and then all the nulls.

No problem. Glad to help.

I still don’t understand why it didn’t show up in the integrations UI?

@finity

Excellent, thanks for integration! Exactly what I was hoping to find. Sorry to drag up this post, but thought it was appropriate place.

Do you know, or know where I can find the list of values for the sensor attributes? Specifically Event Severity? I really only wanted to monitor for severe warning alerts.

Scrolled your yaml and found a couple values. Didn’t want to wait for the severe warnings to find out I missed one. :cloud_with_lightning: :tornado: :scream:
Thanks!

No, sorry I don’t.

That attribute was added a while after my initial implementation as a request from another user. I don’t think I even use that attribute anywhere in my config.

I just use the alert types which are pretty well documented:

https://www.weather.gov/lwx/WarningsDefined

If you want to build an automation off the alerts, you can use the Condition to do it. I set off a bunch of actions for tornado warnings only.


  - condition: template
    value_template: '{{ ''Tornado Warning'' in state_attr(''sensor.nws_alerts_3'', ''title'') }}'

Don’t ask why my sensor ends in a 3. Let’s just say I had some issues with HACS a while back.

Just FYI, those are the wrong "s in your YAML there.

Interesting…you mean the single quotes like this '' ?
This automation went off just fine recently (5 times in one night), but I’m still learning and understand some of these things work today, but might not tomorrow.