I’ve just officially released the updated version of the integration.
I’ve also updated the example automations, etc package and the dashboard code to use the new alert attribute structure.
I’ve tested it pretty extensively and I’m fairly sure everything works but I may have missed something so of course let me know if there are issues.
As far as the automations are concerned I’m not sure why but I’ve always made the assumption in the past that any new alert would be at the top of alerts list (index 0) but during my testing I’m not 100% sure that’s correct.
So I’ve changed the automations to send notifications and announcements about all alerts. Obviously it would get annoying to hear the same alerts over and over so I’ve built-in a history of all notified & announced alerts and if any “new” alert is already in those lists the alert gets ignored in the notifications and announcements.
Hopefully it will be more reliable in sending notifications of important info without any false repeat alerts.
I figured as much but the issue I seemed to run into in testing is if several alerts were issued at the same time then you couldn’t always ensure the first one would be the worst one.
Example, I had for testing a zone in California that had more than one of each heat advisories, heat watches, air quality alerts, then later severe thunderstorm watches and warnings - there were 12 active alerts at one time. and in my subjective opinion the thunderstorm warnings were more important than the thunderstorm watches which were more important than the heat advisories were more important than the air quality alerts but those were all intermingled amongst each other.
So even if (as we assumed) that the newest was the first in the list if we limit the announcement to the first then we might still miss something more important that might have gotten issued essentially simultaneously with something less important and it ends up being further down.
Here is an example of the state changes over the last week.
The jumps from 2 to 3 to 4 to 5 etc might be able to be handled ok by a queued automation. The jump directly 2 to 5 or from 6 to 8 couldn’t be.
And TBH, I’m pretty sure some of those 1 step state changes were when a few old alerts expired and they were replaced en masse by their newly sent replacements. so 4 might have all expired at once then 5 might have been sent at once.
That assumption is supported by me getting multiple persistent notifications and mobile notifications all at once for based on each alerts unique ID.
Of course for a “normal” severe weather event it’s not likely to get more than one alert at a time so the queued method would be perfectly fine. But unfortunately the times we are in now are getting less “normal” all the time.
I’m a bit lost with the new version and hoping some kind person can nudge me toward a working card again.
I have been using a conditional card that pops up only when there is an alert and it has been working great for a long time.
Now that I have tried to do it with the new version I can’t seem to figure it out.
card:
content: |
{% if states.sensor.nws_alert_event.attributes.features[0] is defined %}
Headline
{{states.sensor.nws_alert_event.attributes.features[0].properties.headline }}
Details
{{states.sensor.nws_alert_event.attributes.features[0].properties.description }}
Instructions
{{states.sensor.nws_alert_event.attributes.features[0].properties.instruction }}
{% else %}
{% endif %}
type: markdown
theme: AMOLED Blue
conditions:
- entity: sensor.nws_alert_event
state_not: none
type: conditional
I am replying only in hope that someone posts a good working example of a replacement for what I had before the update. I want a Lovelace card for alerts but with the new thing I have nothing.
It depends on what you had before the update. Without know what you had no one can help you with the update.
And if you had just the stock package from my github repo then the readme for the release tells you that there are updated package & dashboard examples. Did you look at the new code in the package/dashboard folders there?
Or since you are replying to danbutter did you see the updated example code that I posted to help them out?
I have one (hopefully last) piece of the automation puzzle. There is an automation which turned off an input boolean “Severe Weather” when the NWS Alerts sensor no longer had anything with the word “warning” in it…
alias: Household - Climate (Severe Weather Mode) Deactivate
description: ""
trigger:
- platform: template
value_template: |
{{ 'warning' not in state_attr('sensor.nws_alerts', 'title') | lower }}
alias: NWS Alert Sensor Does Not Contain Phrase (Warning)
condition: []
action:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.severe_weather
alias: Deactivate Severe Weather Mode
mode: single
What changes do I need for this to work as expected with the new format?
Thank you. I think I’ve got everything switched over now. It’s not looking like I have any strange weather in the immediate future, but I’ve switched everything so I’ll wait and see how it goes.