diff --git a/custom_components/eversolo/media_player.py b/custom_components/eversolo/media_player.py index 8b3289c..ec855c9 100644 --- a/custom_components/eversolo/media_player.py +++ b/custom_components/eversolo/media_player.py @@ -330,9 +330,14 @@ async def async_select_source(self, source): if sources is None: return - index, tag = next( - (index, key) for index, key in enumerate(sources) if sources[key] == source - ) + try: + index, tag = next( + (index, key) + for index, key in enumerate(sources) + if sources[key] == source or key == source + ) + except StopIteration: + raise ValueError(f"Source {source} not found") await self.coordinator.client.async_set_input(index, tag)