Severe Weather Notification Not Working

So I’ve been using the NWS Alerts integration great, it updates my location, and tells me the active alerts. I’ve been trying to use it to replace the standard weather app on my phone for alerts, and leverage HA to use a speaker and maybe run some automations. Thing is, it doesn’t trigger.

I’ve built several automations and they’ve never fired, mainly because they haven’t re-occurred yet since I built them off of the Attributes. But today I had a NWS Alert that I did build one for, that expired, and got renewed, but my system never actioned on it. So where did I go wrong?

This is a snippet of the trigger portion, which I figure is the failing part. If I run this manually, I get notified fine, and it plays the sound file file, and TTS fine, etc. It just didn’t fire automatically when the alert came.

I have time conditions because this type alert shouldn’t come in after sleeping hours, but if it does, it’s too late or for a different day and I don’t want it going off in the middle of the night for this one. If I can get this one working, then I’ll do some for tornadoes and such, and those I want to hit whenever they are posted. I don’t think the conditions had anything to do with it, so I’m guessing my trigger or value is incorrect somehow?

alias: Weather_Alert_Cold_Weather
description: “”
triggers:

  • trigger: state
    entity_id:
    • sensor.nws_alerts
      attribute: Alerts
      to: “Event: Cold Weather Advisory”
      conditions:
  • condition: time
    after: “08:00:00”
    before: “20:00:00”
    weekday:
    • sun
    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
      actions:
  • action: notify.mobile_app_xxxxxxxx
    metadata: {}
    data:
    message: Cold Weather Advisory! !Warning!
    title: :snowflake::cold_face::snowman_with_snow::mountain_snow::wind_face:
    data:
    TTL: 0
    priority: high
  • action: media_player.play_media
    target:
    entity_id: media_player.vlc_telnet
    data:
    media_content_id: media-source://media_source/local/imperial_alert.mp3
    media_content_type: audio/mpeg
1 Like

You can’t trigger on the event the way you are doing it.

Have you looked at the github repo for the integration? It gives example code to use to trigger a notification on the desired alert type.

I’m assuming you are on the latest version of the integration (v5.0 or later)? if so look here for examples:

the only way you will be able to trigger on a specific alert event is to extract the event in a template.

{{ state_attr('sensor.nws_alerts_test', 'Alerts')[0].Event == 'Cold Weather Advisory' }}

the problem is that the desired event might be in the second alert and not the first so you have to account for that. And that’s where it gets tricky.

And I’m pretty sure that the state trigger can’t accept a template. So you would need to switch to a template trigger instead.

That’s why it’s better to use the provided automation examples and modify them to your desired actions.

I am on the latest version of the integration yes. But not I haven’t reviewed the GitHub stuff yet.

And yeah they can often stack up multiple alerts so that will make it more complex.