ha_samsung_multi_room icon indicating copy to clipboard operation
ha_samsung_multi_room copied to clipboard

Numeric volume in HASS same as Soundbar

Open aabafra opened this issue 3 years ago • 0 comments

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

aabafra avatar May 23 '21 17:05 aabafra