finity69x2 / nws_alerts

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

Updated [Alternative] Automations for 5.0 #87

Closed T3chArmy closed 1 week ago

T3chArmy commented 1 month ago

Does not appear this repo has discussions enabled, so posting this here to hopefully save others some time.

I just wanted to share the updated automations I came up with for version 5.0. These do not rely on the Variable Integration through HACS. or anything else externally.

Some of these could probably stand some additional improvements, but interested to hear what the rest of the users think/suggest.

These are written while I was using the 2024.8.0 beta.

To use this on older versions you'll need to change every "action" to "service". Do not change the first occurrence of action after condition.

Mobile App Notifications:

alias: NWS - Mobile App Notifications
description: ""
trigger:
  - platform: state
    entity_id: sensor.nws_alerts
condition: []
action:
  - repeat:
      sequence:
        - action: notify.all_devices
          data:
            message: clear_notification
            tag: NWS_{{ repeat.item }}
      for_each: >-
        {{ trigger.from_state.attributes.Alerts | map(attribute='ID') |
        reject('in', trigger.to_state.attributes.Alerts | map(attribute='ID')) |
        list() }}
  - repeat:
      sequence:
        - action: notify.all_devices
          data:
            title: "NWS: {{ repeat.item.Headline }}"
            message: |
              {{ repeat.item.Description }} {{ repeat.item.Instruction or "" }}
            data:
              notification_icon: mdi:weather-lightning-rainy
              channel: WeatherAlerts
              importance: high
              color: red
              push:
                interruption-level: time-sensitive
              tag: NWS_{{ repeat.item.ID }}
      for_each: "{{ state_attr('sensor.nws_alerts','Alerts') }}"
mode: queued
initial_state: "on"
max: 10

Persistent Notifications:

alias: NWS - Persistent Notifications
description: ""
trigger:
  - platform: state
    entity_id: sensor.nws_alerts
condition: []
action:
  - repeat:
      sequence:
        - action: persistent_notification.dismiss
          data:
            notification_id: NWS_{{ repeat.item }}
      for_each: >-
        {{ trigger.from_state.attributes.Alerts | map(attribute='ID') |
        reject('in', trigger.to_state.attributes.Alerts | map(attribute='ID')) |
        list() }}
  - repeat:
      sequence:
        - action: persistent_notification.create
          data:
            notification_id: NWS_{{ repeat.item.ID }}
            title: "NWS: {{ repeat.item.Headline }}"
            message: |
              {{ repeat.item.Description }} {{ repeat.item.Instruction or "" }}
      for_each: "{{ state_attr('sensor.nws_alerts','Alerts') }}"
mode: queued
initial_state: "on"
max: 10

TTS Announcements:

(This is utilizing a script with input variables, but this just plays the TTS across all of my media devices in a way that does not break my audio streaming)

alias: NWS - TTS Announcements
description: ""
trigger:
  - platform: state
    entity_id: sensor.nws_alerts
condition: []
action:
  - repeat:
      sequence:
        - metadata: {}
          data:
            announce_outside: true
            announcement_message: >-
              The {{repeat.item.Event}} set to expire in {{repeat.item.Expires |
              as_datetime() | time_until(2)}} is no longer in effect.
          action: script.whole_home_announcement
      for_each: >-
        {{ trigger.from_state.attributes.Alerts | reject('in',
        trigger.to_state.attributes.Alerts) | list() |
        sort(attribute='Expires')}}
  - repeat:
      sequence:
        - variables:
            alert: "{{ repeat.item }}"
        - if:
            - condition: template
              value_template: "{{ ('Warning' in alert.Event) and (alert.Type == 'Alert') }}"
          then:
            - repeat:
                count: 3
                sequence:
                  - metadata: {}
                    data:
                      announce_outside: true
                      announcement_message: >-
                        The National Weather Service has {{ iif(alert.Type ==
                        'Alert', 'issued a', 'updated the') }} {{alert.Event}}
                        for our area. {% if(alert.Event != alert.Headline) %}
                          {{ alert.Headline }}
                        {% else %}
                          It will expire in {{alert.Expires | as_datetime() | time_until(2)}}. {{ (alert.Instruction or '') | replace('\n', ' ') }}
                        {% endif %}
                    action: script.whole_home_announcement
                  - delay: "00:00:25"
          else:
            - metadata: {}
              data:
                announce_outside: true
                announcement_message: >-
                  The National Weather Service has {{ iif(alert.Type == 'Alert',
                  'issued a', 'updated the') }} {{alert.Event}} for our area. {%
                  if(alert.Event != alert.Headline) %}
                    {{ alert.Headline }}
                  {% else %}
                    It will expire in {{alert.Expires | as_datetime() | time_until(2)}}. {{ (alert.Instruction or '') | replace('\n', ' ') }}
                  {% endif %}
              action: script.whole_home_announcement
      for_each: >-
        {{ trigger.to_state.attributes.Alerts | reject('in',
        trigger.from_state.attributes.Alerts) | list() |
        sort(attribute='Expires') }}
mode: queued
initial_state: "on"
max: 10

Script used by TTS Announcment across multiple areas in the home:

alias: Whole Home Announcement
sequence:
  - parallel:
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_master_bedroom_pair
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_office_pair
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_living_room_speaker
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_guest_bedroom_speaker
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - if:
          - condition: template
            value_template: "{{ announce_outside }}"
        then:
          - parallel:
              - continue_on_error: true
                metadata: {}
                data:
                  entity_id: media_player.musicassist_shop_audio
                  cache: false
                  message: "{{ announcement_message }}"
                action: tts.cloud_say
  - set_conversation_response: Announcment completed.
fields:
  announcement_message:
    selector:
      text:
        multiline: true
    name: Announcement Message
    description: Message to play on all speakers
    required: true
  announce_outside:
    selector:
      boolean: {}
    name: Announce Outside?
    default: true
    required: false
    description: Play announcement on outside speakers?
description: Play an announcement on all speakers
mode: queued
max: 10
Watso4183 commented 1 month ago

I tried testing the mobile app notifications. I received the following error:

Message malformed: Unable to determine action @ data['action'][0]['repeat']['sequence'][0]

I assumed notify.all_devices was a notify group, but inputting my own notify group did not resolve the issue.

T3chArmy commented 1 month ago

I tried testing the mobile app notifications. I received the following error:

Message malformed: Unable to determine action @ data['action'][0]['repeat']['sequence'][0]

I assumed notify.all_devices was a notify group, but inputting my own notify group did not resolve the issue.

Sorry, I forgot to mention. I'm running the HA 2024.8.0 beta, the official release will be tomorrow.

If you are on a previous version, replace action with service on the service calls

If you are also on the 2024.8.0 beta, it seems like it might be an issue with clear_notification command, you can try removing that section.

Watso4183 commented 1 month ago

Not on the beta, but that would certainly explain it. I tend to avoid .0 releases, but I'll test again when I'm on a 2024.8.x release.

T3chArmy commented 1 month ago

Not on the beta, but that would certainly explain it. I tend to avoid .0 releases, but I'll test again when I'm on a 2024.8.x release.

Replace

- action: notify.all_devices

With

- service: notify.all_devices

And it should work on the current released versions.

T3chArmy commented 1 month ago

For anyone who has used these, I did just notice a mistake

On clearing of the mobile notification action it should not have had the ID as the repeat.item is the ID due to the way the for_each is written.

data:
            message: clear_notification
            tag: NWS_{{ repeat.item.ID }}

should be

data:
            message: clear_notification
            tag: NWS_{{ repeat.item }}
finity69x2 commented 1 month ago

The only reason I used the external "variables" integration was to ensure that a history of events were kept so that the same events don't get announced or notified again if a new alerts comes in while the old one is still active. There's no good built-in alternative for that functionality as far as I know.

I haven't dug thru your automations above to see if or how you have handled that.

If I get time I'll try them out to see what I think and let you know if I see anything that needs addressed.

But thanks for you contribution.

T3chArmy commented 1 month ago

@finity69x2 I accomplished this by comparing the original list of alerts and the new list of alerts, and used reject to filter the previous alerted items out.

I am certainly open to input, especially if you notice any obvious oversights or something not functioning correctly.

I attempted to test these extensively. However there are likely still ways to improve my automations.

finity69x2 commented 1 month ago

I attempted to test these extensively. However there are likely still ways to improve my automations.

I hear you on that one. :)

thanks again.

beyondunreal79 commented 1 month ago

Does not appear this repo has discussions enabled, so posting this here to hopefully save others some time.

I just wanted to share the updated automations I came up with for version 5.0. These do not rely on the Variable Integration through HACS. or anything else externally.

Some of these could probably stand some additional improvements, but interested to hear what the rest of the users think/suggest.

These are written while I was using the 2024.8.0 beta.

To use this on older versions you'll need to change every "action" to "service". Do not change the first occurrence of action after condition.

Mobile App Notifications:

alias: NWS - Mobile App Notifications
description: ""
trigger:
  - platform: state
    entity_id: sensor.nws_alerts
condition: []
action:
  - repeat:
      sequence:
        - action: notify.all_devices
          data:
            message: clear_notification
            tag: NWS_{{ repeat.item }}
      for_each: >-
        {{ trigger.from_state.attributes.Alerts | map(attribute='ID') |
        reject('in', trigger.to_state.attributes.Alerts | map(attribute='ID')) |
        list() }}
  - repeat:
      sequence:
        - action: notify.all_devices
          data:
            title: "NWS: {{ repeat.item.Headline }}"
            message: |
              {{ repeat.item.Description }} {{ repeat.item.Instruction or "" }}
            data:
              notification_icon: mdi:weather-lightning-rainy
              channel: WeatherAlerts
              importance: high
              color: red
              push:
                interruption-level: time-sensitive
              tag: NWS_{{ repeat.item.ID }}
      for_each: "{{ state_attr('sensor.nws_alerts','Alerts') }}"
mode: queued
initial_state: "on"
max: 10

Persistent Notifications:

alias: NWS - Persistent Notifications
description: ""
trigger:
  - platform: state
    entity_id: sensor.nws_alerts
condition: []
action:
  - repeat:
      sequence:
        - action: persistent_notification.dismiss
          data:
            notification_id: NWS_{{ repeat.item }}
      for_each: >-
        {{ trigger.from_state.attributes.Alerts | map(attribute='ID') |
        reject('in', trigger.to_state.attributes.Alerts | map(attribute='ID')) |
        list() }}
  - repeat:
      sequence:
        - action: persistent_notification.create
          data:
            notification_id: NWS_{{ repeat.item.ID }}
            title: "NWS: {{ repeat.item.Headline }}"
            message: |
              {{ repeat.item.Description }} {{ repeat.item.Instruction or "" }}
      for_each: "{{ state_attr('sensor.nws_alerts','Alerts') }}"
mode: queued
initial_state: "on"
max: 10

TTS Announcements:

(This is utilizing a script with input variables, but this just plays the TTS across all of my media devices in a way that does not break my audio streaming)

alias: NWS - TTS Announcements
description: ""
trigger:
  - platform: state
    entity_id: sensor.nws_alerts
condition: []
action:
  - repeat:
      sequence:
        - metadata: {}
          data:
            announce_outside: true
            announcement_message: >-
              The {{repeat.item.Event}} set to expire in {{repeat.item.Expires |
              as_datetime() | time_until(2)}} is no longer in effect.
          action: script.whole_home_announcement
      for_each: >-
        {{ trigger.from_state.attributes.Alerts | reject('in',
        trigger.to_state.attributes.Alerts) | list() |
        sort(attribute='Expires')}}
  - repeat:
      sequence:
        - variables:
            alert: "{{ repeat.item }}"
        - if:
            - condition: template
              value_template: "{{ ('Warning' in alert.Event) and (alert.Type == 'Alert') }}"
          then:
            - repeat:
                count: 3
                sequence:
                  - metadata: {}
                    data:
                      announce_outside: true
                      announcement_message: >-
                        The National Weather Service has {{ iif(alert.Type ==
                        'Alert', 'issued a', 'updated the') }} {{alert.Event}}
                        for our area. {% if(alert.Event != alert.Headline) %}
                          {{ alert.Headline }}
                        {% else %}
                          It will expire in {{alert.Expires | as_datetime() | time_until(2)}}. {{ (alert.Instruction or '') | replace('\n', ' ') }}
                        {% endif %}
                    action: script.whole_home_announcement
                  - delay: "00:00:25"
          else:
            - metadata: {}
              data:
                announce_outside: true
                announcement_message: >-
                  The National Weather Service has {{ iif(alert.Type == 'Alert',
                  'issued a', 'updated the') }} {{alert.Event}} for our area. {%
                  if(alert.Event != alert.Headline) %}
                    {{ alert.Headline }}
                  {% else %}
                    It will expire in {{alert.Expires | as_datetime() | time_until(2)}}. {{ (alert.Instruction or '') | replace('\n', ' ') }}
                  {% endif %}
              action: script.whole_home_announcement
      for_each: >-
        {{ trigger.to_state.attributes.Alerts | reject('in',
        trigger.from_state.attributes.Alerts) | list() |
        sort(attribute='Expires') }}
mode: queued
initial_state: "on"
max: 10

Script used by TTS Announcment across multiple areas in the home:

alias: Whole Home Announcement
sequence:
  - parallel:
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_master_bedroom_pair
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_office_pair
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_living_room_speaker
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - continue_on_error: true
        metadata: {}
        data:
          entity_id: media_player.musicassist_guest_bedroom_speaker
          cache: false
          message: "{{ announcement_message }}"
        action: tts.cloud_say
      - if:
          - condition: template
            value_template: "{{ announce_outside }}"
        then:
          - parallel:
              - continue_on_error: true
                metadata: {}
                data:
                  entity_id: media_player.musicassist_shop_audio
                  cache: false
                  message: "{{ announcement_message }}"
                action: tts.cloud_say
  - set_conversation_response: Announcment completed.
fields:
  announcement_message:
    selector:
      text:
        multiline: true
    name: Announcement Message
    description: Message to play on all speakers
    required: true
  announce_outside:
    selector:
      boolean: {}
    name: Announce Outside?
    default: true
    required: false
    description: Play announcement on outside speakers?
description: Play an announcement on all speakers
mode: queued
max: 10

Nice work. Can you do one for pushover??

finity69x2 commented 1 month ago

Hey @T3chArmy , are you the same t3chArmy that is on the HA forum?

If so I'd like to continue our discussion in a PM there since I've got some questions/suggestions and I find the format in the forum better for those things.

If so then go ahead and pm me there (@finity) to get things started.

finity69x2 commented 1 month ago

@beyondunreal79

if you replace the "action: notify.all_devices" portion with this I think it should get you the same thing for pushover:

action: notify.pushover
data:
  target: my_phone
  title: "NWS: {{ repeat.item.Headline }}"
  message: |
    {{ repeat.item.Description }} {{ repeat.item.Instruction or "" }}
  data:
    sound: echo
    priority: 1
T3chArmy commented 1 month ago

Hey @T3chArmy , are you the same t3chArmy that is on the HA forum?

If so I'd like to continue our discussion in a PM there since I've got some questions/suggestions and I find the format in the forum better for those things.

If so then go ahead and pm me there (@finity) to get things started.

@finity69x2 I sent you a pm.

firstof9 commented 3 weeks ago

I do like the looks of these, I'm gonna give them a run myself with slight modifications. :+1:

T3chArmy commented 3 weeks ago

Yeah, the more I used them, the more I have found the need to tweak them, specifically the TTS alerts. Right now they are a bit over zealous. I definitely need to revise them a tad, but in general the logic seems to be working well.

finity69x2 commented 3 weeks ago

@T3chArmy

Did you see my reply to your PM?

T3chArmy commented 3 weeks ago

@finity69x2 Yes, sorry, I did see it, but I was out of town Friday - late Sunday night. Yesterday got unexpectedly hectic. I will try to respond this evening!

finity69x2 commented 3 weeks ago

no problem. I didn't want to nag but where the internet is concerned you never know.

GreyBandit commented 2 weeks ago

Question for the crowd, how does 'repeat' get defined? I keep running into this error message: "UndefinedError: 'repeat' is undefined". I copied T3chArmy's TTS automation exactly into my setup (including the accompanying script). Any help is appreciated!

firstof9 commented 2 weeks ago

What version of HA are you running?

beyondunreal79 commented 2 weeks ago

I was wondering this too. I get "UndefinedError: 'repeat' is undefined" if I try to test my messages in developer tools.

On Mon, Aug 26, 2024 at 10:47 PM GreyBandit @.***> wrote:

Question for the crowd, how does 'repeat' get defined? I keep running into this error message: "UndefinedError: 'repeat' is undefined". I copied T3chArmy's TTS automation exactly into my setup (including the accompanying script). Any help is appreciated!

— Reply to this email directly, view it on GitHub https://github.com/finity69x2/nws_alerts/issues/87#issuecomment-2311463796, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK6KWIHQSUZDGRLCRDKN2R3ZTPSF5AVCNFSM6AAAAABMCTWUR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJRGQ3DGNZZGY . You are receiving this because you were mentioned.Message ID: @.***>

GreyBandit commented 2 weeks ago

What version of HA are you running?

Ah yes, of course, rookie mistake. See below: Core 2024.8.3 Supervisor 2024.08.0 Operating System 13.1

firstof9 commented 2 weeks ago

Core 2024.8.3

should be working fine, likely some indention issues or something, check the code in a yaml linter

GreyBandit commented 2 weeks ago

The indentation is working and everything looks fine, so I'm not sure what's going on. I'm going to let it sit for a while and come back later with a fresh mind.

firstof9 commented 2 weeks ago

if I try to test my messages in developer tools.

You can't test these in dev tools, they'll only work in an automation.

finity69x2 commented 1 week ago

Here is what I'm using now based on the above suggestions:

automation:

  - alias: NWS - Mobile App Notifications
    id: nws_mobile_app_notifications
    trigger:
      - platform: state
        entity_id: sensor.nws_alerts
    condition:
      - condition: numeric_state
        entity_id: sensor.nws_alerts
        above: 0
    action:
      - repeat:
          sequence:
            - service: script.turn_on
              continue_on_error: true
              entity_id: script.notification_pushover_message
              data:
                variables:
                  target: my_phone
                  message: "NWS New: {{ repeat.item.Event }}"
                  sound: echo
            - delay:
                seconds: 5
          for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | sort(attribute='ID') | list() }}"
    mode: queued
    initial_state: "on"
    max: 10         

###############################################################################

  - alias: NWS - Persistent Notifications
    id: nws_persistent_notifications
    trigger:
      - platform: state
        entity_id: sensor.nws_alerts
    condition: 
      - condition: numeric_state
        entity_id: sensor.nws_alerts
        above: 0
    action:
      - repeat:
          sequence:
            - service: script.nws_alerts_persistent_notification
              data:
                notification_id: "NWS_{{ repeat.item.ID }}"
                title: "NWS New: {{ repeat.item.Event }}"
                message: "{{ repeat.item.Description }}"
            - delay:
                seconds: 5
          for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | sort(attribute='ID') | list() }}"
    mode: queued
    initial_state: "on"
    max: 10

###############################################################

  - alias: NWS - TTS Announcements
    id: nws_tts_announcements
    description: ""
    trigger:
      - platform: state
        entity_id: sensor.nws_alerts
    condition:
      - condition: numeric_state
        entity_id: sensor.nws_alerts
        above: 0
    action:
      - repeat:
          sequence:
            - variables:
                alert: "{{ repeat.item }}"
            - if:
                - condition: template
                  value_template: "{{ ('Tornado Warning' in alert.Event) and (alert.Type == 'Alert') }}"
              then:
                - service: script.turn_on
                  entity_id: script.nws_alerts_announce_tornado_warning
                - delay:
                    minutes: 1
          for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | list() | sort(attribute='ID') }}"
      - repeat:
          sequence:
            - variables:
                alert: "{{ repeat.item }}"
            - if:
                - condition: template
                  value_template: "{{ ('Severe Thunderstorm Warning' in alert.Event) and (alert.Type == 'Alert') }}"
              then:
                - service: script.turn_on
                  entity_id: script.nws_alerts_announce_thunderstorm_warning
                - delay:
                    minutes: 1
          for_each: "{{ trigger.to_state.attributes.Alerts | reject('in', trigger.from_state.attributes.Alerts) | list() | sort(attribute='ID') }}"
    mode: queued
    initial_state: "on"
    max: 10

script:

  nws_alerts_announce_tornado_warning:
    alias: NWS Alerts Announce Tornado Warning
    sequence:
      - service: media_player.volume_set
        data:
          entity_id:
            - media_player.basement_dot
            - media_player.bedroom_2_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
            - media_player.master_bedroom_dot
          volume_level: 0.9
      - service: notify.alexa_media
        data:
          target: 
            - media_player.basement_dot
            - media_player.bedroom_2_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
            - media_player.master_bedroom_dot
          data:
            type: tts
          message: Attention!,,,Attention!,,,The National Weather Service Has issued a tornado warning for our area.
      - delay: '00:00:15'
      - service: notify.alexa_media
        data:
          message: "<audio src='https://h7a3u8r0lt405rwrar1rcgi8ep9a1gez.ui.nabu.casa/local/mp3/nws_alert_tone.mp3' />"
          target: 
            - media_player.basement_dot
            - media_player.bedroom_2_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
            - media_player.master_bedroom_dot
          data:
            type: tts
      - delay: '00:00:25'
      - service: notify.alexa_media
        data:
          target: 
            - media_player.basement_dot
            - media_player.bedroom_2_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
            - media_player.master_bedroom_dot
          data:
            type: tts
          message: Attention!,,,Attention!,,,The National Weather Service Has issued a tornado warning for our area.

  nws_alerts_announce_thunderstorm_warning:
    alias: NWS Alerts Announce Thunderstorm Warning  
    sequence:
      - service: media_player.volume_set
        data:
          entity_id:
            - media_player.basement_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
          volume_level: 0.9
      - service: notify.alexa_media
        data:
          target: 
            - media_player.basement_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
          data:
            type: tts
          message: Attention!,,,Attention!,,,The National Weather Service Has issued a severe thunderstorm warning for our area.
      - delay: '00:00:15'
      - service: notify.alexa_media
        data:
          message: "<audio src='https://h7a3u8r0lt405rwrar1rcgi8ep9a1gez.ui.nabu.casa/local/mp3/nws_alert_tone.mp3' />"
          target: 
            - media_player.basement_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
          data:
            type: tts
      - delay: '00:00:25'
      - service: notify.alexa_media
        data:
          target: 
            - media_player.basement_dot
            - media_player.computer_room_dot
            - media_player.garage_dot
            - media_player.kitchen_dot
            - media_player.livingroom_dot
          data:
            type: tts
          message: Attention!,,,Attention!,,,The National Weather Service Has issued a severe thunderstorm warning for our area.  

there are two scripts - one to announce everywhere for tornado's and one to announce everywhere except bedrooms for other severe weather.

you can modify things to announce anywhere or for anything as you see fit.

I'll update the package info to include these.

I'm going to close this so any other further assistance should be directed to the HA forum thread.