Core: Onkyo volume incorrect on some amplifier models

Created on 21 Nov 2017  路  35Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):
0.58.0

Python release (python3 --version):
3.5.3

Component/platform:
media_player/onkyo.py

Description of problem:

On some more recent models of Onkyo amplifiers (for instance the TX-RZ710) the volume supports half steps, so while the volume display still ranges from 0 to 80 it has 160 steps and the remote control commands for volume expect a value in the range 0 to 160, not 0 to 80. As a result on the TX-RZ710 calling the volume_set service with a volume_level value of 1.0 sets the amplifier to half volume. Similarly if the volume control is manually set to 60.0 on the amplifier then Home Assistant reports a state attribute volume level of 1.5.

Expected:

Setting a volume level in the range 0.0 to 1.0 should set the volume level across the full volume range of the amplifier and manually set volumes should be reported as a state in the range 0.0 to 1.0.

It should be noted that this problem does NOT show up on older models such as my previous TX-NR616 amplifier where the volume control does not support half steps.

Problem-relevant configuration.yaml entries and steps to reproduce:

I'm using the following configuration with my current TX-RZ710
```yaml:
media_player:

  • platform: onkyo
    host: 10.0.0.117
    name: receiver
    ```
  1. Call the media_player set_volume service with a volume_level value of 1.0; observe that the amplifier is set to a volume level of 40.0
  2. Manually set the volume level on the TX-RZ710 to a displayed 60.0; observe that the Home Assistant state reports a volume_level attribute of 1.5

Traceback (if applicable):
N/A

Additional info:

The volume can be set correctly using the underlying Python eiscp library by sending values in the range 0 to 160, which get displayed on the amplifier in the range 0.0 to 80.0.

I have not identified a reliable way to test if the amplifier expects a volume range of 0-80 or 0-160. It seems likely that either a configuration setting might be needed or that some look-up table might need to be built with all known Onkyo amplifier models.

onkyo waiting-for-reply

Most helpful comment

The fixed version of the Onkyo eISCP support module has been released to PyPI. I will have a go at writing a fix for this issue when I get a little time.

All 35 comments

Rz 810 does the same

The good news is that there is a way to query the receiver to find out if it uses 1db or 0.5db steps, using the NRI command to the receiver (which the eiscp library maps to their receiver-information command).

The bad news that there is currently a bug in the onkyo-eiscp Python library which means that this command doesn't work reliably. I will look into submitting a pull request to fix the bug in the underlying library but fixing the bug in Home Assistant will need someone who understands that code base better than I currently do.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

This is actually still an issue. I just recently switched to a Pioneer receiver and I'm seeing this, I'll try to take a look this weekend at the upstream fix and use it in the component.

This is still an issue. I know how to fix the HA library but it requires a bug to be fixed in the supporting library. A fix has been accepted for the bug but the maintainer of the library has not released a new version to PyPI so right now we can't easily fix the HA component. I'll try prodding the library owner again and see if he can tag a new release that pip will be able to find.

The fixed version of the Onkyo eISCP support module has been released to PyPI. I will have a go at writing a fix for this issue when I get a little time.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

This is still an issue in version 0.75.0. I have a newer Pioneer receiver (VSX-832), which goes to 200 in eiscp.
At this point I have to do the following to utilize the full volume range:

  • Change the SUPPORTED_MAX_VOLUME variable to 200 in onkyo.py
  • Set the max_volume to 200 in my configuration.yaml

In the short term changing SUPPORTED_MAX_VOLUME to at least 160 will allow users to configure the max_volume parameter for each amplifier and get around the issue, although that doesn't work for auto-discovered receivers.

In the longer term the answer appears to be to request the receiver information from the amplifier using the NRIQSTN command, parse the XML reply and extract whether the unit uses 1db or 0.5db steps for the volume setting. I've been meaning to do this for a while since now two of my three receivers are the newer, 0.5db versions and don't work properly with Home Assistant. Writing the fix is fairly easy; writing the test cases and making sure that it's stable enough to release requires more time than I've had to spare recently!

This is still an issue in version 0.75.0. I have a newer Pioneer receiver (VSX-832), which goes to 200 in eiscp.
At this point I have to do the following to utilize the full volume range:

  • Change the SUPPORTED_MAX_VOLUME variable to 200 in onkyo.py
  • Set the max_volume to 200 in my configuration.yaml

In addition, I noticed that there are still a few hard-coded "80"s down in the section that controls the zones. I have two different models of Pioneer receivers that both work with the Onkyo media_player component, and they both have a range of 200.

@SteveDinn I think that all of the newer models of Pioneer and Onkyo use the new 0.5dB step. Fixing this is on my list of bugs that I want to fix when I have some spare time, but that has been in sadly short supply of late.

Maybe I can submit a PR. I always just end up fixing my file locally. I have a couple of other bugs that I'm finally going to write up too. Thanks for the component in the first place!

@SteveDinn Firstly, I can't take credit for this component, I'm just an interested bystander!

It would be great if you could build a patch for this. With regard to the fix, there is the easy fix and the right fix. The easy fix is to just change the constants to allow the maximum volume to be set to higher values. The right fix is to update the device discovery mechanism to query the receiver information, parse the result and extract the volume step size information so that this works correctly for both the older and newer models. The underlying library should now work correctly for querying the receiver so "all you need to do" is find the right place to add the new code!

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

This issue is still present. If I do not manually change SUPPORTED_MAX_VOLUME from 80 to 200 in onkyo.py, I will only be able to control the volume from -80 to -42.

Just tested that in 0.89.1.

I have tried to figure out how to query the receiver max volume information, and found I could get a lot of information with the following command:
onkyo --host <IP-ADDRESS> dock.receiver-information=query (which is the same as the NRIQSTN command)

I get a long reply which I have pasted here: https://pastebin.com/BnbwSuss
What I notice is the field "volmax="82" in zone "main". However, for my receiver it is 200.

Maybe if someone else with another receiver can run the command, so that we can compare the output for different receivers.

I tried, but I got this error when running against both my receivers:

Traceback (most recent call last):
  File "/srv/hass/bin/onkyo", line 11, in <module>
    sys.exit(run())
  File "/srv/hass/lib/python3.5/site-packages/eiscp/script.py", line 179, in run
    sys.exit(main() or 0)
  File "/srv/hass/lib/python3.5/site-packages/eiscp/script.py", line 136, in main
    response = receiver.raw(iscp_message)
  File "/srv/hass/lib/python3.5/site-packages/eiscp/core.py", line 463, in raw
    return filter_for_message(self.get, iscp_message)
  File "/srv/hass/lib/python3.5/site-packages/eiscp/core.py", line 260, in filter_for_message
    candidate = getter_func(0.05)
  File "/srv/hass/lib/python3.5/site-packages/eiscp/core.py", line 440, in get
    return ISCPMessage.parse(message)
  File "/srv/hass/lib/python3.5/site-packages/eiscp/core.py", line 49, in parse
    assert data[eof_offset] == EOF
AssertionError

I have an Integra DRX-4 which also is made by Onkyo group.

https://pastebin.com/ezNG0DQG

My main's volmax=82, though the receiver does indeed have 200 steps. When set in configuration.yaml, slider max is 40, though the volume.up button does allow it to go higher.

Edit:

My workaround for 0.89.2 is:

  1. make a copy of media_player/onkyo.py > custom_components/onkyo_custom/media_player.py
  2. find and replace 80 with 200
  3. in configuration.yaml:
    media_player: <ul> <li>platform: onkyo_custom<br /> host: 192.168.1.x<br /> name: receiver<br /> max_volume: 200<br />

@nickovs What field in the NRI xml result indicates the volume step, my results are the same as @tomatpasser

<zone id="1" value="1" name="Main" volmax="82" volstep="0" src="1" dst="1" lrselect="0" />

Same issue with Onkyo 676
Max volume must be 100 for proper work.

I'm not a programmer, but isn't it possible to set max_volume in the configuration file and use that value?

Now every time HA updates I have to recopy the python file with the proper max volume.

+1 for letting the user set the value in the config along with since documentation about what the default value is and why you'd want to change it in certain cases

@prairiesnpr Based on my observations (from a sampling of five units) it seems that with older units that have a 1 db step, zones show up like:

<zone id="1" name="Main" value="1" volmax="80" volstep="1">

whereas on newer models with with a 0.5 db step they show up like:

<zone id="1" name="Main" value="1" volmax="82" volstep="0">

(possibly with extra attributes). So the differences are both in the value of the volmax attribute (80 means 80 full steps, 82 means 80 half steps) and in the value of the volstep (1 means 1.0db, 0 means 0.5db). This seems consistent with what others have reported on this thread.

@nickovs Thanks! I've been working to modify the component so that it will query the receiver and set the max volume automatically, but I wasn't sure what a non half step receiver would look like. The only outlier would be the version with a max of 100, not sure what it reports.

@prairiesnpr Thank you for making the changes to the component; doing so has been on my (rather long) to-do list of for various open source projects for some time but hadn't made it to the top yet.

I suspect that it would be a good thing to remove any hard-wired, artificial caps for the max_volume value as well as querying the amplifier or receiver to determine the likely desired value. That way if new models come along with new settings there will be an easier workaround.

Ok, this is my poor attempt at a fix if anyone wants to look it over and/or try it and provide feedback. https://gist.github.com/prairiesnpr/8dee06fafab4d4f5fa9da9f107d3cb75

@prairiesnpr Thank you for taking the time to solve this issue. I do have a few minor comments:

  • The actual value of DEVICE_MAX_VOLUME does not seem to be used.
  • You can use dev_info.encode() instead of bytes(bytearray(dev_info, encoding = 'utf-8')) (as the default value is utf-8)
  • You will have to base your changes on the new dev branch, there was a few changes.

I don't think it's poor, you should submit a pull request with it.

That part of the code (line 39):

MAX_VOL_OPTS = {"80":{"0":100,"1":80},
                "82":{"0":200,"1":80}}

won't work with Onkyo TX-NR676. Its config is:

...
name="Main" volmax="82" volstep="1" 
...

But its volume goes to 100. But with the current code it would be reduced to 80.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

latest HA and volume is still 40 when I set volume to 50 in HA

Is this fixed in HA 0.99? I have a pioneer SC-LX801 which uses half steps, and it's always at half the expected volume still.

This is still not fixed, no. An attempt was given by @prairiesnpr, but according to @bprus that would not work. Looking through the thread, @bprus is the only one who has a receiver which returns the
volmax="82" volstep="1" combination, so the solution could be

MAX_VOL_OPTS = {"80":{"0":100,"1":80},
                "82":{"0":200,"1":100}}

Hi - I was working on a fix for this and just found this issue. We've managed to get the onkyo-eiscp library updated with one of the fixes required. My plan was then to allow the user to set their receivers max volume and also still honour the ability to set what 100% in HA is on the amp (so HA 100% isn't blow your speakers out).

That is different from the approach of trying to figure it out automatically but it doesn't look like that works 100%?

My fix is on a branch here at the moment: https://github.com/foxy82/home-assistant/tree/temp_pioneer_fix

It still needs a little more work but hopefully I'll create a PR for it this weekend.

PR submitted. Expected config is:

    - platform: onkyo
      host: 192.168.0.80
      name: Amplifier
      # A HA volume of 100 will convert to 80% of the receivers max volume
      max_volume: 80 
      # The max volume number the receiver expects
      receiver_max_volume: 164

To find maximum volume set the receiver to its maximum volume (don't do this whilst playing something!) and run this assuming onkyo-eiscp is installed.

onkyo --host 192.168.0.100 volume=query
unknown-model: master-volume = 191

@foxy82, there has been no one here reporting return values from the onkyo-eiscp command which would not work with my solution in https://github.com/home-assistant/home-assistant/issues/10712#issuecomment-538103564, but I did not have the time to submit at pull request for it. In your examples you have receiver_max_volume: 164, is that what works for your receiver? And if so, which model is it?

I think your pull request is good, we can add the code to find receiver_max_volume automatically at a later time.

Interestingly I found out that isn't the right number for my receiver whilst finishing the pull request. The 164 was the max volume I got when I used the Pioneer Android app to set the max volume - however when I did it on the actual receiver I got 200

So in my house I have LSX-V303 at 200 and a Network Receiver N30AE (I think - i'm not home at the moment) that has a max of 191.

Was this page helpful?
0 / 5 - 0 ratings