brianhealey / hacs_amplipi

Adds media player support for the AmpliPi MultiZone Audio Player
MIT License
12 stars 9 forks source link

Volume control #13

Open bs42 opened 1 year ago

bs42 commented 1 year ago

Can we get the volume control updated? Currently the slider is the only way to control the volume when you are in the interface, if you use the +/- buttons it jumps by 10 instead of 1.

I believe the volume_up and volume_down methods need to be implemented in the interface to HA to fix that and then those would send the proper increment.

linknum23 commented 1 year ago

It looks like we are currently using the default in HA's MediaPlayerEntity: check out: https://github.com/home-assistant/core/blob/dev/homeassistant/components/media_player/__init__.py#L935

I agree that 10% volume level increases are fairly large and make it hard to find the perfect volume. 1, 2, or 3% adjustment would probably make more sense. I wonder what others think about this?

As a workaround have you considered configuring each zone's vol_min and vol_max fields to reduce the adjustable range? This would make percent changes smaller.

bs42 commented 1 year ago

When I was using my home-brew REST media player before this addon was around, I had it set to 1% and it was very similar to the volume increases I have with other media devices.

I have not tried to set vol_min/vol_max, I'll take a look at that for a short term fix.

linknum23 commented 1 year ago

I added a 1% step size to a branch on my fork but haven't had a chance to test it yet: https://github.com/linknum23/hacs_amplipi/tree/vol_step_size

bs42 commented 1 year ago

I copied that file over into my custom_components and restarted HA, but it still does 10%. I wonder if there is something that has to be registered for HA to know the vol functions are available that's missing.

linknum23 commented 1 year ago

Thanks for testing it out. I will check back see if there's something I missed in how this works.

On Wed, Mar 1, 2023 at 10:49 AM bs42 @.***> wrote:

I copied that file over into my custom_components and restarted HA, but it still does 10%. I wonder if there is something that has to be registered for HA to know the vol functions are available that's missing.

— Reply to this email directly, view it on GitHub https://github.com/brianhealey/hacs_amplipi/issues/13#issuecomment-1450375088, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEZPO7IEQCE4NRUAZQGGKDWZ5VWZANCNFSM6AAAAAAVJ52PWY . You are receiving this because you commented.Message ID: @.***>

linknum23 commented 1 year ago

Just searching for help on this led me to the mini-media-player. It looks like it has a configurable volume step size:

Name Type Default Since Description
volume_step number optional v1.9.0 Change the volume step size of the volume buttons and the volume slider (number between 1 - 100)1.

If we can't override this behavior easily using that media player with this configuration might be a simpler route.

bs42 commented 1 year ago

I found it, the vol options were added to the AmpliPiSource class instead of the AmpliPiZone class. I updated a few things in there, so I'll confirm exactly which item 100% fixed it and give you a patch for it.

bs42 commented 1 year ago

Done, I've never done a pull request into a branch on a fork before so fingers crossed I did that right.