mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Only lookup supported_features once in media_player capability_attributes (#96510)
This commit is contained in:
parent
c44c7bba84
commit
0e8c85c5fc
@ -1001,13 +1001,14 @@ class MediaPlayerEntity(Entity):
|
||||
def capability_attributes(self) -> dict[str, Any]:
|
||||
"""Return capability attributes."""
|
||||
data: dict[str, Any] = {}
|
||||
supported_features = self.supported_features
|
||||
|
||||
if self.supported_features & MediaPlayerEntityFeature.SELECT_SOURCE and (
|
||||
if supported_features & MediaPlayerEntityFeature.SELECT_SOURCE and (
|
||||
source_list := self.source_list
|
||||
):
|
||||
data[ATTR_INPUT_SOURCE_LIST] = source_list
|
||||
|
||||
if self.supported_features & MediaPlayerEntityFeature.SELECT_SOUND_MODE and (
|
||||
if supported_features & MediaPlayerEntityFeature.SELECT_SOUND_MODE and (
|
||||
sound_mode_list := self.sound_mode_list
|
||||
):
|
||||
data[ATTR_SOUND_MODE_LIST] = sound_mode_list
|
||||
|
Loading…
x
Reference in New Issue
Block a user