Bluesound volume stepper bugfix (#33404)

This commit is contained in:
Anders Liljekvist 2020-03-29 22:38:03 +02:00 committed by GitHub
parent 68e86c5e3a
commit 0f9790f5f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1021,16 +1021,16 @@ class BluesoundPlayer(MediaPlayerDevice):
async def async_volume_up(self): async def async_volume_up(self):
"""Volume up the media player.""" """Volume up the media player."""
current_vol = self.volume_level current_vol = self.volume_level
if not current_vol or current_vol < 0: if not current_vol or current_vol >= 1:
return return
return self.async_set_volume_level(((current_vol * 100) + 1) / 100) return await self.async_set_volume_level(current_vol + 0.01)
async def async_volume_down(self): async def async_volume_down(self):
"""Volume down the media player.""" """Volume down the media player."""
current_vol = self.volume_level current_vol = self.volume_level
if not current_vol or current_vol < 0: if not current_vol or current_vol <= 0:
return return
return self.async_set_volume_level(((current_vol * 100) - 1) / 100) return await self.async_set_volume_level(current_vol - 0.01)
async def async_set_volume_level(self, volume): async def async_set_volume_level(self, volume):
"""Send volume_up command to media player.""" """Send volume_up command to media player."""