mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
* SongPal: error handling if active_source can't be detected * sonpal: Add comment to the use of getattr() for property source * songpal: make comment single-line
This commit is contained in:
parent
7038dd484a
commit
0be922dc9c
@ -288,7 +288,8 @@ class SongpalDevice(MediaPlayerDevice):
|
|||||||
@property
|
@property
|
||||||
def source(self):
|
def source(self):
|
||||||
"""Return currently active source."""
|
"""Return currently active source."""
|
||||||
return self._active_source.title
|
# Avoid a KeyError when _active_source is not (yet) populated
|
||||||
|
return getattr(self._active_source, 'title', None)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def volume_level(self):
|
def volume_level(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user