Skip to content

Numeric volume in HASS same as Soundbar - #11

Open
aabafra wants to merge 22 commits into
macbury:masterfrom
dariornelas:master
Open

Numeric volume in HASS same as Soundbar#11
aabafra wants to merge 22 commits into
macbury:masterfrom
dariornelas:master

Conversation

@aabafra

@aabafra aabafra commented May 23, 2021

Copy link
Copy Markdown

Hi,

First of all, thanks a million for this great add-on. I really love it!

I use Alexa to control the soundbar thanks to your integration. However, if you put a max_volume parameter, I found difficult to accurate change the volume with my voice as I ordered a number and it calculates a different one as a multiple of the limit.

I made a small change to make it work as I wanted. I set a limit and if I ask for a greater number it just sets that limit. If I order any number under it, I get that exact volumen.

Please find attached the code.

The only chages are the following:

async def async_set_volume_level(self, volume):
"""Sets the volume level."""
newVolume = volume * 100 # * self._max_volume
#newVolume = min(volume,self._max_volume)*100
await self.api.set_volume(newVolume)
self._volume = volume

__

    if volume[0]:
      self._volume = int(volume[0]) /100 #/ self._max_volume
    "Get Mute State"

__

async def set_volume(self, volume):
await self._exec_set('UIC','SetVolume', 'volume', min(int(volume),40))

NOTE: I tried to put here the variable max_volume but didn't get it work so I put manually my desired real volumen limit as 40..

__

Once again, thanks for your great add-on.

media_player_modified.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants