-
Notifications
You must be signed in to change notification settings - Fork 16
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
Volume control logic could be improved! #55
Comments
Edit: sorry didn't notice this is the repo for the roon api interface! Don't know all the code that should be changed for this but roon/media_player.py line 192 could be something like this maybe?
Example my case: -127dB - 0dB (range 127, current volume -56dB) Example: -80dB - +10dB (range 90, current volume -56dB) |
That code looks sensible but there is also a similar problem here: https://github.com/pavoni/pyroon/blob/master/roonapi/roonapi.py#L268 What probably makes sense is to move the volume calculation from If you're a developer feel free to submit a Very happy to help if you fancy having a go. |
I’m going to take a look next week! Thanks. |
So, tried to change te code but not really into Python. So not sure how to test... |
What I would do is to modify one of the demo apps. Perhaps something that displays the volume of a zone, then reduces the volume, and then puts it back after a delay. But happy to help - you can just open a pull request with what you have and I can take a look. |
Found out by running your demo.py that the Matrix Mini i3 reports the volume as |
Does roon remote show db on the scale? Regardless it would be nice to make the roonapi handle this case if we can. Sure there will be other examples! |
The missing dB scale is a bug. It doesn't show it in the remote. They passed it on to the dev-team. |
What's your current thinking on this? I'm sure we could come up with a utility function that will work with the ranges (as long as they are correct) without needing to depend on the |
It’s crazy that you mention this, because this morning i was thinking about it. The example i gave above should work with every range because it converts the range to percentage. edit: Using the MIN and MAX volume from Roon API. |
Allright, so the following code works when changing the volume from Roon it updates the HA volume accordingly. media_player.py from line 179
I tested it with a Hifi Berry card (0-100 range) and the Matrix Mini i3 (-127,5 - 0 range): |
The same logic should probably apply to the |
This works for me when changing the volume from HA on both devices: set_volume_level()
volume_up()
volume_down()
|
Sorry, this works in the Roon component in HA... so my solution is on the wrong repository! |
Do you have a view? The question here is whether the 0-100 volume conversion should be in the library or outside. My sense is to leave the current raw volume functions and add a second set - or some conversion functions. The Roon wrapper in HA currently does this - but not always correctly for some endpoints! |
@juliusvaart no issues - wry easy for me to steal your hard work! |
This is good I think. Expose the raw control and some convenience functions |
Haha, please do. I'm to lazy to create a pull request! And wouldn't label this "hard work" ;-) |
Only don't know what this is, how this works. No min/max here... so an exception could be needed here to avoid errors in HA. |
@juliusvaart Having looked at this more carefully, it will need to be a breaking change, because the current So my current plan is to do a release of I can then do an HA library update - which is straightforward as it requires no code changes to HA. I will then look at the volume logic - and revise the library and HA wrapper. The HA guys prefer PRs that don't contain multiple changes - since they are easier to review. |
Sounds great! Thanks for all your work on the component and library! |
HA PR now here:- |
The roon api docs say:
The code in HA currently assumes that a number volume control is 0 to 100 and a db one is -80 to 0.
It should ask roon for the data before doing the calculation.
Probably best to add some utility conversion routines in the roon api.
Probably causing this issue: home-assistant/core#81138 (comment)
The text was updated successfully, but these errors were encountered: