Calling All Echos

Below is a WORKING automation that makes the same announcement across all echos in the house developed and deployed using the GUI automation tool.

is there a more succinct way of scripting this? The coder in me hates the repeated code bits!

- id: '123'
  alias: Shannon's Home
  trigger:
  - entity_id: device_tracker.life360_shannon_roux_pitts
    from: not_home
    platform: state
    to: home
  condition: []
  action:
  - alias: ''
    data:
      data:
        type: tts
      message: Shannon has arrived home
      target: media_player.office_echo
    service: notify.alexa_media_office_echo
  - alias: ''
    data:
      data:
        type: tts
      message: Shannon has arrived home
      target: media_player.family_room_echo
    service: notify.alexa_media_family_room_echo
  - data:
      data:
        type: tts
      message: Shannon has arrived home
      target: media_player.living_room_echo
    service: notify.alexa_media_living_room_echo
  - data:
      data:
        type: tts
      message: Shannon has arrived home
      target: media_player.kitchen_echo
    service: notify.alexa_media_kitchen_echo

Create a group in groups.yaml with all the echos you want the message to go. This is an example of what I did for an automation:

  - service: notify.alexa_media
    data:
      target: group.notify_dots
      message: "The garage door is still open."
      data:
        type: announce
        method: speak
1 Like

Great… big question… you syntax is very different from what HA is creating via the UI everythiing past the sequence tag

in my scripts.yamal I created … after creating a group (great idea BTW)
I;m guessing “house_announcment” takes the place of a UUID./. unique identifier for the snippit… but HA uses the “- data” tag in a different way… I’m just trying to find some definable pattern to the syntax in the yamal.

And where can I find more information on “announce” and “speak”

house_announcment:
  alias: Second Test House Wide Announcement
  sequence:
  - service: notify.alexa_media
    data:
      target: group.wenogotta_echos
      message: "The garage door is still open."
      data:
        type: announce
        method: speak

and I managed to get this to work as well (I like yours better)

'Test12345#':
  alias: Test House Wide Announcement
  sequence:
  - data:
      data:
        type: announce
      message: Shannon has arrived home
      target:
      - media_player.office_echo
      - media_player.family_room_echo
      - media_player.living_room_echo
      - media_player.kitchen_echo
    service: notify.alexa_media

Check out the wiki here: https://github.com/keatontaylor/alexa_media_player/wiki/Notification-Component

There’s also the mega thread on the custom_component.

In terms of my formatting being different, you can do it different ways, I just fell into my pattern/format but know that the ui editor does things differently.

Yes, the UI editor puts everything in alphabetical order. Which is different than the way most people actually hand write their code and the way all the examples are in the documentation.

It’s one of the reasons I don’t use the editors in HA for anything. It ends up confusing things more that are already potentially confusing.

Alpha order… Ha I didn’t even notice…

Thanks All!