"SOLVED" Chromecast Audio "media_player.volume_set"

I have a coupple of Chromecast Audios (CCA), where I use 2 different phones to cast from.
I want to set a volume every time I start casting, so I have the same volume to start with, no matter what the CCA was left at.
I can set the volume with the automation, but if I change the volume, using one of the phones, later, the volume jumps back to the defined value in the automation.
What is wrong?

- alias: Stue amp on
  description: ''
  trigger:
  - entity_id: media_player.stue
    platform: state
  condition:
  - condition: state
    entity_id: media_player.stue
    state: playing
  action:
  - entity_id: media_player.stue
    service: media_player.volume_set
    data:
      volume_level: 0.5

Your automation will fire any time the state changes and the current state is “playing”. That will happen more often than you think. Either use a different trigger if you only want it to happen on startup or create an more sophisticated condition.

Thanks micque.
You were right.
I made a more sophisticated automation.

1 Like

Hello. I have exactly the same issue. But how have you solved it?

`

  • id: ‘12’
    alias: Denon AVR on
    description: ‘’
    trigger:
    • entity_id: input_boolean.cc_stue_on_off
      from: ‘off’
      platform: state
      to: ‘on’
      condition: []
      action:
    • data:
      volume_level: 0.5
      entity_id: media_player.stue
      service: media_player.volume_set
    • entity_id: media_player.denon_avr
      service: media_player.turn_on
    • delay: 00:00:02
    • data:
      source: SAT/CBL
      entity_id: media_player.denon_avr
      service: media_player.select_source
    • delay: 00:00:01
    • data:
      volume_level: 0.4
      entity_id: media_player.denon_avr
      service: media_player.volume_set
    • delay: 00:00:01
    • data:
      sound_mode: DTS SURROUND
      `

Great. Thanks