Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaPlayer Onkyo Volume Scale #41655

Closed
JohanElmis opened this issue Oct 11, 2020 · 4 comments
Closed

MediaPlayer Onkyo Volume Scale #41655

JohanElmis opened this issue Oct 11, 2020 · 4 comments

Comments

@JohanElmis
Copy link

The problem

Onkyo Media-player Volume scale issues.
I got a few years old Onkyo receiver where the max volume is 200.
To be able to get a decent volume - I had to set the "receiver_max_volume".
Now I can get the wanted volume - but the slider jumps down to 50% of what I set - so there seems to be a scaling issue, probably in regards to the new maximum of 100 vs 80 that was the old default.
When I set a value of 70 - it jumps back to 34. 60->29, so 1/2 -1 it looks like. At lest when it is set to 200.
Without this parameter set - it worked just fine in an older version (but even at max - the volume was too low).

Environment

Running 0.116.2 in docker, otherwise nothing special.

  • Home Assistant Core release with the issue: 0.116.2
  • Last working Home Assistant Core release (if known): Don't know.
  • Operating environment (OS/Container/Supervised/Core): Docker homeassistant/home-assistant:stable
  • Integration causing this issue: onkyo
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/onkyo/

Problem-relevant configuration.yaml

 cat devices/media_players/onkyo.yaml
  - platform: onkyo
    host: 192.168.0.80
    name: Bio Receiver
    max_volume: 70
    receiver_max_volume: 200

Traceback/Error logs

No errors traceback.

Additional information

@probot-home-assistant
Copy link

onkyo documentation
onkyo source
(message by IssueLinks)

@JohanElmis
Copy link
Author

After some more testing - it appears that it's not the receiver_max_volume that creates the problem. I can limit the maximum output as wanted by just setting this to 160 (and not 200) that is my max.

If I specify the max_volume to say 70. then the slider starts jumping back (down) again after setting the value.
If I set it twice (by just clicking at the same point on the volume-slider twice) - then it normally stays there.
So the workaround is to specify the receiver_max_volume (where the limit is already included) then it works as expected.
Not sure if it's a calculation error - or a timing issue that results in the slider jumping down to half the value otherwise.
I saw this behaviour when having the receiver_max_volume to 100 as well.

@ZzetT
Copy link
Contributor

ZzetT commented Oct 21, 2020

I think the first question is how shall the max_volume be visible in the UI? I see these two options:
Either

  • the slider can be set to 100% and stays there but internally the max_volume is considered and thus converted to let's say 30% of that volume OR
  • the slider cannot be moved further than the max_volume (and is thus allowed to jump back)

Taking the first option, the method

def set_volume_level(self, volume):
already converts a volume set by the user:
f"volume {int(volume * (self._max_volume / 100) * self._receiver_max_volume)}"

For example:

receiver_max_volume = 200
max_volume = 80%
setVolume(50%) -> 0.5 * 0.8 * 200 = 80

-> 80 send to the receiver -> correct

in the update method we convert the volume from the receiver back to the volume that is returned to the user:

volume_raw[1] / self._receiver_max_volume * (self._max_volume / 100)

for the example: 80 / 200 * 0.8 = 0.32
-> which is not the same as 0.5

I think the simple fix is that a parenthesis is missing:
volume_raw[1] / (self._receiver_max_volume * (self._max_volume / 100)) -> gives 0.5

@github-actions
Copy link

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 has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 25, 2021
@github-actions github-actions bot closed this as completed Feb 2, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants