Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 96123

Cleaning up an automation... has to be a better way to do this

$
0
0

@mattlward wrote:

The following automation sets the volume up on my alexa’s, makes an announcement and sets the volume back down.

I am using the Alexa Media integration installed via HACS. There is a media_player.everywhere, but in operation it caused all of my original Dots not to speak. So, I had to set volume on each device and change it again on each device.

There has to be a way to clean this up, I tried 1 media_player.volume_set with multiple entity_id’s but I could not get it formatted to pass muster on the automation verify.

Any help would be appreciated as this all slows down the entire automation.

Thanks Matt

- alias: Announce Input to all alexa
  trigger:
    - platform: state
      entity_id: input_text.alexa_tts
  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.work
      volume_level: '0.9'
  - service: media_player.volume_set
    data:
      entity_id: media_player.kids
      volume_level: '0.9'
  - service: media_player.volume_set
    data:
      entity_id: media_player.kitchen
      volume_level: '0.9'
  - service: media_player.volume_set
    data:
      entity_id: media_player.bedroom
      volume_level: '0.9'
  - service: notify.alexa_media
    data:
        target: 
          - media_player.living_room
          - media_player.work
          - media_player.kids
          - media_player.bedroom
          - media_player.echo
          - media_player.kitchen
        #title: "My title for Echo show"
        data:
          type: announce
          #method: all
        message: '{{ states.input_text.alexa_tts.state }}'
  - service: media_player.volume_set
    data:
      entity_id: media_player.work
      volume_level: '0.5'
  - service: media_player.volume_set
    data:
      entity_id: media_player.kids
      volume_level: '0.5'
  - service: media_player.volume_set
    data:
      entity_id: media_player.kitchen
      volume_level: '0.5'
  - service: media_player.volume_set
    data:
      entity_id: media_player.bedroom
      volume_level: '0.5'

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>