Implement capability attributes (#30545)
* Implement capability attributes * Fix HeOS update order * Fix test
This commit is contained in:
1 parent
4cd83e71dd
commit
ed6aef2fd7
6 files changed
+58
-14
No files matched your search
@@ -149,9 +149,7 @@ ATTR_TO_PROPERTY = [
|
||||
ATTR_APP_ID,
|
||||
ATTR_APP_NAME,
|
||||
ATTR_INPUT_SOURCE,
|
||||
ATTR_INPUT_SOURCE_LIST,
|
||||
ATTR_SOUND_MODE,
|
||||
ATTR_SOUND_MODE_LIST,
|
||||
ATTR_MEDIA_SHUFFLE,
|
||||
]
|
||||
|
||||
@@ -784,6 +782,24 @@ class MediaPlayerDevice(Entity):
|
||||
|
||||
return ENTITY_IMAGE_URL.format(self.entity_id, self.access_token, image_hash)
|
||||
|
||||
@property
|
||||
def capability_attributes(self):
|
||||
"""Return capabilitiy attributes."""
|
||||
supported_features = self.supported_features
|
||||
data = {}
|
||||
|
||||
if supported_features & SUPPORT_SELECT_SOURCE:
|
||||
source_list = self.source_list
|
||||
if source_list:
|
||||
data[ATTR_INPUT_SOURCE_LIST] = source_list
|
||||
|
||||
if supported_features & SUPPORT_SELECT_SOUND_MODE:
|
||||
sound_mode_list = self.sound_mode_list
|
||||
if sound_mode_list:
|
||||
data[ATTR_SOUND_MODE_LIST] = sound_mode_list
|
||||
|
||||
return data
|
||||
|
||||
@property
|
||||
def state_attributes(self):
|
||||
"""Return the state attributes."""
|
||||
|
||||
Reference in new issue
Block a user