finity69x2 / nws_alerts

An updated version of the nws_alerts custom integration for Home Assistant
86 stars 29 forks source link

Feature Request: Easier way to access new alerts / severe alerts #9

Closed steven-dyson closed 3 years ago

steven-dyson commented 3 years ago

Looking through the code I saw that you had some template sensors to alert for severe weather or multiple alerts. I was wondering if there was a way to do two things:

  1. A separate NWS sensor that is on when there is a severe weather alert (severe weather, hurricane, tornado, wild fire)
  2. A easier way to push only new alert(s) to TTS, Telegram, notify service.

Right now it would take quite a bit of work for me to figure out how to get a severe weather alert and a TTS message only when there is a new alert. I'm sure eventually I can look at your template sensors and get something working in nodered. However, an integrated solution would be very appreciated.

Thanks!

finity69x2 commented 3 years ago

All of the information you want is already provided by the integration. it's kind of up to you to figure out how you want to use it. especially as you already noted I've provided examples to get you started. It's beyond the scope of this project to actually create notifications, etc.

Also, if you only want a sensor to tell you that there is a severe event only there is another integration available - https://github.com/mcaminiti/nws_warnings

but it only provides a few categories.

steven-dyson commented 3 years ago

When the month of WTH comes around again I will definitely add a "WTH is there not a fully functional out of the box integration for weather alerts" to the HA forums.

Any examples/ideas for the display of the weather alerts? When you click on the new_alerts entity to view the attributes its pretty difficult to read. All of the titles, descriptions, etc are grouped together.

Thanks for the info, I might use that until I get this all setup. I like to have the advisories as well.

finity69x2 commented 3 years ago

I personally use a markdown card to show all of my alerts in a separate lovelace view:

          - type: conditional
            conditions:
              - entity: sensor.nws_alerts
                state_not: '0'
            card:
              type: markdown
              content: >
                ---

                # NWS First Active Alert
                  {% if state_attr('sensor.nws_alerts', 'title') != None and state_attr('sensor.nws_alerts', 'title').split(' - ')[0] is defined  %}

                ##{{ states.sensor.nws_alerts.attributes.title.split(' - ')[0] }}

                  {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[0] }}

                  {% else %}
                    none
                  {% endif %}
          - type: conditional
            conditions:
              - entity: sensor.nws_alerts
                state_not: "0"
              - entity: sensor.nws_alerts
                state_not: "1"
            card:
              type: markdown
              content: >
                ---

                # NWS Second Active Alert
                {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[1] is defined %}
                  ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[1] }}

                  {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[1] }}

                {% else %}
                  none
                {% endif %}
          - type: conditional
            conditions:
              - entity: sensor.nws_alerts
                state_not: "0"
              - entity: sensor.nws_alerts
                state_not: "1"
              - entity: sensor.nws_alerts
                state_not: "2"
            card:
              type: markdown
              content: >
                ---

                # NWS Third Active Alert
                {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[2] is defined %}
                  ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[2] }}

                  {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[2] }}

                {% else %}
                  none
                {% endif %}
          - type: conditional
            conditions:
              - entity: sensor.nws_alerts
                state_not: "0"
              - entity: sensor.nws_alerts
                state_not: "1"
              - entity: sensor.nws_alerts
                state_not: "2"
              - entity: sensor.nws_alerts
                state_not: "3"
            card:
              type: markdown
              content: >
                ---

                # NWS Fourth Active Alert
                {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[3] is defined %}
                  ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[3] }}

                  {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[3] }}

                {% else %}
                  none
                {% endif %}
          - type: conditional
            conditions:
              - entity: sensor.nws_alerts
                state_not: "0"
              - entity: sensor.nws_alerts
                state_not: "1"
              - entity: sensor.nws_alerts
                state_not: "2"
              - entity: sensor.nws_alerts
                state_not: "3"
              - entity: sensor.nws_alerts
                state_not: "4"
            card:
              type: markdown
              content: >
                ---

                # NWS Fifth Active Alert
                {% if state_attr('sensor.nws_alerts', 'title').split(' - ')[4] is defined %}
                  ## {{ states.sensor.nws_alerts.attributes.title.split(' - ')[4] }}

                  {{ state_attr('sensor.nws_alerts', 'display_desc').split('\n\n-\n\n')[4] }}

                {% else %}
                  none
                {% endif %}
steven-dyson commented 3 years ago

Forgot about the new blueprint feature. Perhaps you could convert this to a blueprint?

Once I get more than one weather alert again I will finish up my node-red flow and post it.

finity69x2 commented 3 years ago

blueprints are only for automations.

It wouldn't work for something like this.