Cast the volume_level of a universal media_player to a float (#29045)
* Make sure to cast the volume_level of a universal media_player to a float * Fix test that expects the wrong bahaviour * Catch exception instead of checking for None
This commit is contained in:
1 parent
8a413b152d
commit
cc346e57e6
2 files changed
+6
-3
No files matched your search
@@ -255,7 +255,10 @@ class UniversalMediaPlayer(MediaPlayerDevice):
|
||||
@property
|
||||
def volume_level(self):
|
||||
"""Volume level of entity specified in attributes or active child."""
|
||||
return self._override_or_child_attr(ATTR_MEDIA_VOLUME_LEVEL)
|
||||
try:
|
||||
return float(self._override_or_child_attr(ATTR_MEDIA_VOLUME_LEVEL))
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
@property
|
||||
def is_volume_muted(self):
|
||||
|
||||
Reference in new issue
Block a user