Media Player Up/Down Volume Steps too Large on Anthem Receiver

When I use the Turn Up/Down Volume service calls to change volume on my Anthem MRX-1140 Receiver, the volume moves in 10% steps. Is there a way to reduce the size of the steps? I’m able to adjust the volume in 1% increments on the entity info page, but not through service calls.

Maybe this will help someone in the future since this doesn’t seem possible with the current volume_up/down service calls. Instead, I made a couple scripts:

- volume_down_anthem_receiver:
    alias: 'Volume Down Anthem Receiver'
    mode: single
    icon: mdi:volume-plus
    sequence:
      - service: media_player.volume_set
        target:
          entity_id: media_player.anthem_receiver
        data:
          volume_level:
            '{{state_attr("media_player.anthem_receiver", "volume_level") - 0.011111}}'
- volume_up_anthem_receiver:
    alias: 'Volume Up Anthem Receiver'
    mode: single
    icon: mdi:volume-minus
    sequence:
      - service: media_player.volume_set
        target:
          entity_id: media_player.anthem_receiver
        data:
          volume_level:
            '{{state_attr("media_player.anthem_receiver", "volume_level") + 0.011111}}'

Replace the 0.011111 with whatever step you would prefer, but it must be a float between 0.0 and 1.0. In my case 0.0=-90 dB and 1.0=0dB. I wanted 1dB increments and 1/90=0.011111.

It seems a similar function could be added to the built-in volume_up/down service calls with an additional data field, but this works great in the meantime.

Hi.
where exactly do I have to put the code?
To configuration.yaml ?

Scripts - Home Assistant (home-assistant.io)

1 Like

I edited the scripts.yaml
I restarted HASIIO
But unfortunately no change, the volume still has a step of 0.1

script:
- volume_down_detsky_pokoj:
    alias: 'Volume Down'
    mode: single
    icon: mdi:volume-plus
    sequence:
      - service: media_player.volume_set
        target:
          entity_id: media_player.detsky_pokoj
        data:
          volume_level:
            '{{state_attr("media_player.detsky_pokoj", "volume_level") - 0.05}}'
            
- volume_up_detsky_pokoj:
    alias: 'Volume Up'
    mode: single
    icon: mdi:volume-minus
    sequence:
      - service: media_player.volume_set
        target:
          entity_id: media_player.detsky_pokoj
        data:
          volume_level:
            '{{state_attr("media_player.detsky_pokoj", "volume_level") + 0.05}}'

Some things to check/change:

  1. If you put it in scripts.yaml, you must already be using the !include method to keep your configuration.yaml clean. More here.
  2. If you are splitting your configuration, then you should removed the script: from your scripts.yaml file.
  3. You do not need to restart HA each time you modify a script. Just reload scripts from Developer Tools > YAML.
  4. The script will still need to be called via a service call. To check the functionality (after you’ve done the above), go to Developer Tools > Services, type volume_down_detsky_pokoj in the Service field, and click CALL SERVICE. If it works, you can copy that .yaml into whatever card you’re using it in.
  5. Let us know how it went.

Also, here’s a cleaner script that incorporates the ability to increase and decrease the volume as well as set the increment on the frontend. You should use this instead.

- volume_change_incremental:
    alias: Volume Change Incremental
    fields:
      media_player:
        description: Media Player with volume to adjust..
        example: media_player.anthem_receiver
      increment:
        description: Change from current volume. If changing a percentage value, convert to decimals first (e.g. +5% should be 0.05). (+) Louder. (-) Quieter.
        example: 0.01
    sequence:
      service: media_player.volume_set
      target:
        entity_id: "{{ media_player }}"
      data:
        volume_level:  >-
                      {{state_attr(media_player, "volume_level")|float + increment}}
1 Like

For my (4) above, here’s an example from my own dashboard:

                  - type: custom:mushroom-template-card
                    primary: ''
                    secondary: ''
                    icon: mdi:volume-minus
                    icon_color: 'null'
                    layout: vertical
                    fill_container: true
                    tap_action:
                      action: call-service
                      service: script.volume_change_incremental
                      data:
                        media_player: media_player.anthem_receiver
                        increment: -0.01

Now I had the same problem. The Media player did much too big steps for some device (Radio Frontier Silicon Silvercrest SIRD 14 C2). But when I use 0.01, I have to tap 5 times to hear some change, and then it does a big step. Now I use 0.05 for the step and it seems to change every time, which wasn’t the case using 0.04. The wish would be to use 0.025 - but that is just not working. Is it possible to find out which steps are supported by a device?

(Thank you very much for the script, btw)

1 Like

Other than experimenting with changing the step value in the script, I don’t know of a way to discover the best steps. Although, the script could probably be modified by making the step value a configurable parameter allowing for more efficient experimenting via Developer tools < Services.

1 Like

I have Anthem receivers. I see -90db as lowest volume. Highest volume is 10db. But I limit to -15db in web ui. Do I need to use upper limit as 10db or my limit -15db? I set default value as -34.5db and I find home assistant is reporting it received 0.2. Not sure if it is factor for anything. Thanks.

Thanks.

Just try -15 and see if it works.

Thanks for the quick response. It is working upto .006. Somehow when I set to .005 it is not reacting (reacting once and stops doing anything).

volume_level: “{{ states.media_player.anthem_mrx_1140.attributes.volume_level - 0.006 }}”

The Anthem app increments and decrements .5db all the time. But these controls are decreasing at very low volumes increments of 3db, 2db and then 1db and very high volume level by .5 db.

At least working. But it would be good to mimic the app.

Ultimately, this script just increments/decrements the current volume by a set amount (the interval). Any non-linearities could be sampled and graphed (e.g. Excel) to determine a more accurate equation.

Use/adjust this script and let me know if it works along with a screenshot of the developer page showing your MRX 1140 attributes.

- volume_change_incremental:
    alias: Volume Change Incremental
    fields:
      media_player:
        description: Media Player with volume to adjust..
        example: media_player.anthem_receiver
      increment:
        description: Change from current volume. If changing a percentage value, convert to decimals first (e.g. +5% should be 0.05). (+) Louder. (-) Quieter.
        example: 0.01
    sequence:
      service: media_player.volume_set
      target:
        entity_id: "{{ media_player }}"
      data:
        volume_level:  >-
                      {{state_attr(media_player, "volume_level")|float + increment}}
1 Like