Skip to content

Commit

Permalink
[fixup] sort source list
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalle19 committed Sep 10, 2024
1 parent a70cc25 commit 688b3f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/vinx/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ def __init__(self, lw3: LW3, device_information: DeviceInformation) -> None:
_attr_supported_features = MediaPlayerEntityFeature.SELECT_SOURCE

async def async_update(self):
# Populate the source list only once
# Populate the source list only once. Sort it alphabetically, since the order of discovered devices
# may differ from device to device.
if self._source_list is None:
await self.populate_source_bidict()
self._source_list = list(self._source_bidict.values())
self._source_list = sorted(list(self._source_bidict.values()))
_LOGGER.info(f"{self.name} source list populated with {len(self._source_list)} sources")

async with self._lw3.connection():
Expand Down

0 comments on commit 688b3f0

Please sign in to comment.