Custom component: cast volume tracking and control

Update: I split the repo into two – ha-cast_volume_tracker and ha-input_number – and structured them so they can be used via HACS.

For the most up-to-date information, please see the README.

Cast Volume Tracker

This component does the following:

  • When an individual speaker is off, by default its media player volume will be set to zero – effectively muting it – but its “desired” volume level will be retained
  • When an individual speaker turns on, its volume level will be set to its desired volume level
    • As a result, you won’t hear the “blip” noise when the device turns on
  • When a group turns on, the volume for each of its members will be set to the average value of its members (excluding any members provided in its members_excluded_when_off parameter)
  • During group playback, the volume of all of its members will be kept normalized

The idea is that for all your cast devices, you would setup a cast_volume_tracker and replace all media_player.volume_set service calls with cast_volume_tracker.volume_set. The usage is the same, except that the entity ID should be for the cast_volume_tracker instead of the media_player (i.e., cast_volume_tracker.computer_speakers instead of media_player.computer_speakers).

Example Configuration

cast_volume_trackers.yaml

For setting up switches that mute/un-mute the speakers: switches.yaml

Input Number (with template functionality)

This component is to the built-in input_number what a template switch is to an input boolean. It accomplishes two things:

  1. Its value can track other entities by way of a template.
  2. When its value is changed, it can run a script.

Example Configuration

input_numbers.yaml

Issues and Pull Requests

  • Please report issues on GitHub.
  • Pull requests are welcome!
3 Likes

Oh this is legit, thank you.

@JeffLIrion, I can successfully add and download both repo’s from HACS without issue but once I try to use them in my configuration I get integration not found errors. I have tried using your examples verbatim (just changed the device names) and my once from scratch and have been unsuccessful. What am I doing wrong?

did you restart HA after you added them and before tried to configure them?

@finity restarted HA and cleared cache before hand

Ok, I don’t use this (and it’s a really old thread) so I don’t know if this integration is still valid or not but that is a pretty common user error.