WTH Limited volume controls

Unusable volume control

Hi,
In my streaming boxes, a typical volume is “12”, for example. Anything above 20 means I’m literally blowing my music into the neighborhood. One misplaced scroll in the app and there’s a crater where my house used to be.

This makes the volume controls almost completely unusable on a touchscreen, because often only 1 pixel decides between “too quiet” and “way too loud”. I would like to be able to limit the values, for example to 20, and have this be the right stop in the UI!

I approach volume control differently in my setup by using predefined volume profiles in Home Assistant. For example:

  • Night Peace (Nocny Spokój)
  • Conversation at the Table (Rozmowa Przy Stole)
  • Relaxation Time (Chwila Relaksu)
  • Playful Fun (Głośna Zabawa)
  • Party Mode (Impreza)

Each profile adjusts the volume of specific speakers to suit the mood or activity. For instance, during the night, the volume drops to 5%, ensuring peace, while during a party, the system increases the volume appropriately.

Here’s how I implemented it using a script in Home Assistant. It allows me to set the volume profile for either all speakers or a specific one, depending on the selected_only parameter:

YAML PL:

alias: Ustaw profil głośności
description: >-
  Ustawia profil głośności dla wybranego odtwarzacza lub wszystkich głośników w
  zależności od parametru 'selected_only'.
variables:
  volume_profiles:
    Nocny Spokój:
      _default: 0.05
    Rozmowa Przy Stole:
      _default: 0.12
      glosnik_salon_l: 0.18
      glosnik_salon_p: 0.18
    Chwila Relaksu:
      _default: 0.18
      glosnik_salon_l: 0.32
      glosnik_salon_p: 0.32
    Głośna Zabawa:
      _default: 0.3
      glosnik_salon_l: 0.46
      glosnik_salon_p: 0.46
    Impreza:
      _default: 0.4
      glosnik_salon_l: 0.64
      glosnik_salon_p: 0.64
fields:
  selected_only:
    name: Tylko wybrany głośnik
    description: Jeśli true, zmieni głośność tylko dla wybranego głośnika
    selector:
      boolean: null
sequence:
  - if:
      - condition: template
        value_template: "{{ selected_only }}"
    then:
      - action: media_player.volume_set
        target:
          entity_id: "{{ states('sensor.wybrany_odtwarzacz') }}"
        data:
          volume_level: >
            {% set profile =
            volume_profiles[states('input_select.tryb_glosnosci_dla_wszystkich_glosnikow')]
            %} {% set player = states('sensor.wybrany_odtwarzacz').split('.')[1]
            %} {{ profile[player] if player in profile else profile._default }}
    else:
      - repeat:
          for_each: |
            {{ [
              'glosnik_kuchnia_p2_l',
              'glosnik_kuchnia_p2_p',
              'glosnik_lazienka_midi',
              'glosnik_salon_l',
              'glosnik_salon_p',
              'glosniki_na_klatce_schodowej_p2',
              'glosniki_na_klatce_schodowej_p3',
              'glosnik_sypialnia'
            ] }}
          sequence:
            - action: media_player.volume_set
              target:
                entity_id: media_player.{{ repeat.item }}
              data:
                volume_level: >
                  {% set profile =
                  volume_profiles[states('input_select.tryb_glosnosci_dla_wszystkich_glosnikow')]
                  %} {{ profile[repeat.item] if repeat.item in profile else
                  profile._default }}
mode: single
icon: mdi:volume-high

I’ve also integrated these volume profiles directly into the Home Assistant interface for convenience:

  • On the main dashboard, I have five buttons below the currently active media player. Clicking any of them applies the selected profile to all speakers in the house.
  • On the room-specific dashboards, I use the same five buttons, but clicking one of them applies the chosen volume profile only to the speakers in that specific room.

This setup allows me to quickly and intuitively adjust the sound level in the entire house or a single room, depending on the context. It’s a simple and effective way to manage audio without fiddling with individual volume controls.

This setup keeps things simple and predictable, without needing dozens of volume levels or sliders. Let me know if you have any questions.