Alexa media_player volume control help

Hi, I’m setting up HA to control a Denon AVR volume, I have configured it with denonavr, as media_player.denon, it is found by Alexa as a TV, and I’m using Nabu Casa cloud connection.
In the Alexa app I only see command to switch on/off, no volume commands.
Also, what would it be the Alexa command for it? I couldn’t find a guide about commanding media_player volume through Alexa, do I have to add scripts?

Thank you.

Have you find any solution?
I’ve got the same issue with LMS players.

Thank you.

@lucala @lucala

Alexa requires the “TV” to have the ability to set a volume. I.E. the device needs to report a volume level. If your device does not report a volume level, the volume will not be controllable in alexa. This is a restriction on the alexa side, not home assistant side.

If you’re feeling saucy. You can attempt to fake it out with the universal media player. This will require you to override the volume_set command. And the volume_level attribute. It would look something like this:

input_number:
  fake_denon_volume:
    name: Denon Volume Slider
    initial: 0.5
    min: 0
    max: 1
    step: 0.01
media_player:
- platform: universal
  name: TV
  children:
  - media_player.denon
  commands:
    volume_set:
    - service_template: >
        {% set current = states('input_number.fake_denon_volume') | float %}
        media_player.volume_{{ 'up' if volume_level - current > 0 else 'down' }}
      data:
        entity_id: media_player.denon
  attributes:
    volume_level: input_number.fake_denon_volume

This will most likely work but alexa might complain and say “The device isn’t responding” if she doesn’t see the volume_level update. If that’s the case, then you’ll need to jump through some hoops every time you restart home assistant. You’d use this universal media player and input_number:

input_number:
  fake_denon_volume:
    name: Denon Volume Slider
    initial: 0.5
    min: 0
    max: 1
    step: 0.01
media_player:
- platform: universal
  name: TV
  children:
  - media_player.denon
  commands:
    volume_set:
    - service_template: >
        {% set current = states('input_number.fake_denon_volume') | float %}
        media_player.volume_{{ 'up' if volume_level - current > 0 else 'down' }}
      data:
        entity_id: media_player.denon
    - service: input_number.set_value
      data_template:
        entity_id: input_number.fake_denon_volume
        value: "{{ volume_level }}"
  attributes:
    volume_level: input_number.fake_denon_volume

Then BEFORE you restart home assistant. Set your receiver volume half way between your min and max volume level.

The nice thing about this method is that she won’t ever complain about the device not working. The down side is that you can get out of sync.

1 Like

I will try it, thank you!

I am facing the same problem with my onkyo avr. The integration creates a media_player device and I synced that one as TV to Alexa. When checking the attributes I can see a

volume_level: 0.4125

However, Alexa sais that the device does not support that.
Had the same thing working with Domoticz before. Any ideas?

I just exposed my recievers instead of the universal media_player. The problem with universal meda_player is that when your ‘child’ media_players are off, the supported features is zero. When they are zero, alexa thinks it can’t do anything.

It’s a flaw in universal media_player.

1 Like

As I am fairly new to home-assistant, can you give me a hint how you managed that? Would be very appreciated!

What are you exposing to Alexa right now? A universal media player or the media player made by the onkyo integration?

I am exposing the media player made by the onkyo integration.
I just realized that it is working, with a different phrase!

Then unfortunately there’s nothing you can do until universal media player is changed.

Ok, that’s great then! Nothing to worry about.

One cherry on top might be to be able to set the absolute value and not the volume percentage, like 27 = 50%
I just added a receiver_max_volume: 100 and i am good to go :smiley:

I’m guessing that those recievers don’t supply a volume level through the API and the integration has to use ‘assumed’ states. Either way, good thing you got it working with the base integration.

1 Like

Sorry to dig this out :slight_smile:

So I’ve checked the code of the universal media_player and it seems to report the right supported features now.

Also I’ve checked the supported features on my universal media_player exposed to Alexa. This is the number:
image

We can see that SUPPORT_VOLUME_SET (4), SUPPORT_VOLUME_STEP (1024) and SUPPORT_VOLUME_MUTE (8) are supported. However, Alexa still reports that the feature is unsupported when I try to act on anything related to volume on this media player.

My device is discovered as being a TV in Alexa and I’ve even run the discovery when the device was on to be sure it was discovered with the right capabilities by Alexa.

Is there anything I’m missing?

PS: There’s no native integration for my amplifier as it’s controlled over a serial interface through MQTT :smiley:

what do the supported features look like when the device is off? I’d wager it drops to almost no supported features. IIRC, if discovered when off, it won’t work.

It reports the same while off:

this is the code for alexa

image

All you need is support_volume_set and it should work.

for what it’s worth, my device does not support SUPPORT_VOLUME_STEP but it does support SUPPORT_VOLUME_SET and it works fine.

Thanks @petro.
I believe it is there (number is 4, the third bit is 1 in binary)

I’m gonna try something. It seems my locale fr-FR is not supported in the code:

I’m going to change the code and see the result.

@petro that was it !! The locale was missing! It’s working now!
I’m gonna do a PR :slight_smile:

1 Like