If device has volume disabled, the volume will be None. However in these (#32702)

instances whenever the volume was requested a division calculation was made
resulting in a TypeError. The volume adjustment from `0-100` to `0-1` is now
calculated during the `update()` method.
This commit is contained in:
Barry Williams 2020-03-12 08:54:25 +00:00 committed by GitHub
parent 76b0302c7f
commit 233568ac29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,7 @@ class OpenhomeDevice(MediaPlayerDevice):
self._supported_features |= (
SUPPORT_VOLUME_STEP | SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_SET
)
self._volume_level = self._device.VolumeLevel()
self._volume_level = self._device.VolumeLevel() / 100.0
self._volume_muted = self._device.IsMuted()
for source in self._device.Sources():
@ -222,7 +222,7 @@ class OpenhomeDevice(MediaPlayerDevice):
@property
def volume_level(self):
"""Volume level of the media player (0..1)."""
return self._volume_level / 100.0
return self._volume_level
@property
def is_volume_muted(self):