Set a maximum volume for your media player

This blueprint allows you to set a maximum volume for your media player. If the volume is raised above the level you’ve set, it will automatically back down. The motivation for this is my kids constantly raising the volume on the family room tv to ear-splitting volumes :slight_smile:

blueprint:
  name: Media Player - Set Maximum Volume
  description: Set a maximum volume for your media player
  domain: automation
  input:
    media_player:
      name: Media Player
      description: The media player for which you'd like to limit the volume
      selector:
        entity:
          domain: media_player
    max_volume:
      name: Maximum volume
      default: 0.5
      selector:
        number:
          min: 0
          max: 1
          mode: slider
          step: 0.01
mode: parallel
max: 5
variables:
  media_player: !input media_player
  current_volume: states[media_player].attributes.volume_level
  max_volume: !input max_volume
trigger:
  - platform: state
    entity_id: !input 'media_player'
condition:
  condition: template
  value_template: "{{ trigger.to_state.attributes.volume_level | float > max_volume | float }}"
action:
  - delay: '00:00:00.100'
  - service: media_player.volume_set
    data:
      entity_id: !input 'media_player'
      volume_level: !input 'max_volume'
11 Likes

Thank you very much for this blueprint!!!

It works like a charm (or at least good enough) with a Denon CEOL N12-DAB (HEOS) system.

It doesn’t seem to catch volume changes by the remote control, but that is not too bad (volume change by remote control is always gradual).

But it works perfectly when, mostly accidentally, mistaking the volue slider in Spotify or in the HEOS app for a progress bar, which can lead to accidental ear-damaging (or speaker damaging) volumes. Most of the time, it sets the volume back to a ‘safe’ level in the blink of an eye :smiley: