Volume Automation for Chromecasts

EDIT: See the next message for a Blueprint of this approach

One issue I have perpetually had with my multiroom audio setup using Chromecast is that inevitably my amplifier volumes and the chromecast volumes get out of sync.

For example, someone will be in a room and the audio will be too loud in that room. Rather than adjusting the Chromecast volume, they will lower the volume using the amplifier’s knob (or remote control) in that room. Later someone will notice the volume is too low in that room but rather than adjusting the amplifier volume, they’ll bump up the Chromecast volume. Or vice-versa – in any case, eventually the volume on the amplifer ends up set way too low and maxing out the chromecast is still barely audible.

It just occurred to me today that I could use Home Assistant to automate fixing this in a pretty simple and intuitive way.

I created an automation that will forward / proxy volume changes from the Chromecast to the amplifier so that it is easier to get the whole range of volume exposed.

This is a very simple automation, it monitors the Chromecast volume and if someone sets the volume above 99% (e.g. to 100%), it calls volume_up service on the corresponding amplifier and resets the Chromecast volume to 98.

Such a simple thing but solves a real annoyance that I’ve had for years!

Here is the YAML:

alias: Volume Management for TV Chromecast
description: ''
trigger:
  - platform: numeric_state
    entity_id: media_player.chromecast
    above: '0.99'
    attribute: volume_level
condition: []
action:
  - service: media_player.volume_up
    target:
      entity_id: media_player.downstairs_tx_rz820
  - service: media_player.volume_set
    target:
      entity_id:
        - media_player.chromecast
    data:
      volume_level: 0.98
mode: single

In my experience the problem has always been that the amplifier volume is too low rather than too high, so I only automated the increase side rather than doing both high and low.

3 Likes

I converted this automation into a blueprint that works on both low and high volume ranges.

You select a source Chromecast and then a target Receiver and it will capture volume changes on the Chromecast and if you set the volume < 5% or > 95% on the Chromecast then it will adjust the volume on the Receiver down or up, respectively and reset the Chromecast to 5% or 95% respectively so you can then re-adjust to your preference.

Thresholds default to 0.05 / 0.95 but can be adjusted, it’s even possible to set them to the same value and it works OK like 0.50 / 0.50 to basically turn the Chromecast’s volume into a proxy for up/down control of the receiver.

See the source code here: Chromecast Volume Managment · GitHub

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

hey, this is amazing.
I was trying to solve my volume setup when casting with some complex things and unlikely to work. your idea works magically and it’s better than my initial approach. ty guys!! ty @a3a, the blueprint work is 100%!

1 Like

Hi, thanks for the brilliant contribution!

I was wondering: did you find a way to compensate for Chromecasts maxxing out their volume when they restart (e.g. after an update)?

That behavior is a pain as there doesn’t seem to be any way HA can be made aware that the volume has become full (HA sees it at the level it was before the restart).

D.

I haven’t noticed this problem, but it does sound like a pain in the ears. I don’t have any ideas right now on how to address this problem robustly. It seems like we need an automation that can be triggered when the Chromecast reboots.

Maybe there is a way to capture undefinedoff and then send a fixed volume of say 50%, probably not ideal but it might avoid speaker damage. I will think about this a bit.