nws_alerts icon indicating copy to clipboard operation
nws_alerts copied to clipboard

Attribute Value Data?

Open NRutt2005 opened this issue 1 year ago • 6 comments

Question about this integration. Wasn't sure where else to ask the question. I see that the integration outputs the following attribute products:

  • Title
  • Event ID
  • Message Type
  • Event Status
  • Event Severity
  • Event Expires
  • Display Desc (Display Description)
  • Spoken Desc (Spoken Description)
  • icon: mdi:alert

I just set this integration up but I would like to set up automations for Severe Thunderstorm Warnings, Tornado Warnings, Tornado Watches, Severe Thunderstorm Watches, etc. Does anyone have screen shots of this integration and the attribute data that is populated for these attributes? Currently it just has 'null' as the attribute values obviously because there hasn't been a weather watch/warning issued since the setup. Just would like a little insight into the data values that will be populated. Thank you!

image

NRutt2005 avatar Dec 28 '23 19:12 NRutt2005

These are the header and the first alert. There are currently 4 in my area.

I hope this helps. Let me know if you need more shots of the data.

Screenshot 2024-01-11 at 13 47 40 Screenshot 2024-01-11 at 13 47 51

mdisabato avatar Jan 11 '24 19:01 mdisabato

I would really like to have some example data so I can test my templates

richcrabtree avatar Feb 11 '24 21:02 richcrabtree

Here's what I did to get data when my local forecast was all sunshine and pretty:

  • Check the national weather map for forecasts of nasty weather. Also check the NWS site for the list if alerts. This week, most of California is getting drenched from another 2-banger atmospheric river.
  • Set up another instance of NWS Alerts, but use the locale codes for the place with the nasty weather. This will generate the data you need to experiment. I put a "T" in front of the locale name for the test instance.
  • Once you are done, change the sensor names to your locale and claim victory.

Have fun!

mdisabato avatar Feb 19 '24 16:02 mdisabato

Can you guys share your yaml on the trigger method of the specific attributes? I see under "spoken_desc" attribute for my area:

  FLOOD WATCH REMAINS IN EFFECT THROUGH WEDNESDAY MORNING
  HIGH SURF ADVISORY REMAINS IN EFFECT UNTIL 4 AM PST TUESDAY
  WIND ADVISORY REMAINS IN EFFECT UNTIL 4 AM PST TUESDAY

Title attribute: title: Flood Watch - High Surf Advisory - Wind Advisory I don't care about the high surf advisory but want the Wind and flood advisory as triggers

ampersandru avatar Feb 19 '24 18:02 ampersandru

Ok I think I got it, might be a more graceful way to do multiple ORs in the template

trigger:
  - platform: template
    value_template: >-
      {{ state_attr('sensor.nws_alerts', 'title') is search('Flood',
      ignorecase=True) }}
  - platform: template
    value_template: >-
      {{ state_attr('sensor.nws_alerts', 'title') is search('Wind',
      ignorecase=True) }}
  - platform: template
    value_template: >-
      {{ state_attr('sensor.nws_alerts', 'title') is search('Fire',
      ignorecase=True) }}
  - platform: template
    value_template: >-
      {{ state_attr('sensor.nws_alerts', 'title') is search('Tornado',
      ignorecase=True) }}      
  - platform: template
    value_template: >-
      {{ state_attr('sensor.nws_alerts', 'title') is search('Storm',
      ignorecase=True) }}        

ampersandru avatar Feb 19 '24 19:02 ampersandru

Found a better way by adding a template sensor, if you're interested:

sensor:
  - platform: template
    sensors:
      weather_alert:
        friendly_name: "Weather Alert"
        value_template: >-
          {{ 'flood' in state_attr('sensor.nws_alerts', 'title') | lower or
             'rain' in state_attr('sensor.nws_alerts', 'title') | lower or
             'storm' in state_attr('sensor.nws_alerts', 'title') | lower or
             'tornado' in state_attr('sensor.nws_alerts', 'title') | lower }}

ampersandru avatar Feb 20 '24 18:02 ampersandru

It's typically better to get help on implementation of automations in HA via the HA forums instead of opening an issue for something like this as it's not technically an issue.

finity69x2 avatar Jul 15 '24 03:07 finity69x2