diff --git a/homeassistant/components/roku/media_player.py b/homeassistant/components/roku/media_player.py index 0deeb44dbc2..69c9e24ad89 100644 --- a/homeassistant/components/roku/media_player.py +++ b/homeassistant/components/roku/media_player.py @@ -222,7 +222,12 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity): await self.coordinator.roku.remote("home") appl = next( - (app for app in self.coordinator.data.apps if app.name == source), None + ( + app + for app in self.coordinator.data.apps + if source in (app.name, app.app_id) + ), + None, ) if appl is not None: diff --git a/tests/components/roku/test_media_player.py b/tests/components/roku/test_media_player.py index 9d809cae433..9ac758585e9 100644 --- a/tests/components/roku/test_media_player.py +++ b/tests/components/roku/test_media_player.py @@ -332,7 +332,7 @@ async def test_services( remote_mock.assert_called_once_with("home") - with patch("homeassistant.components.roku.Roku.launch") as remote_mock: + with patch("homeassistant.components.roku.Roku.launch") as launch_mock: await hass.services.async_call( MP_DOMAIN, SERVICE_SELECT_SOURCE, @@ -340,7 +340,17 @@ async def test_services( blocking=True, ) - remote_mock.assert_called_once_with("12") + launch_mock.assert_called_once_with("12") + + with patch("homeassistant.components.roku.Roku.launch") as launch_mock: + await hass.services.async_call( + MP_DOMAIN, + SERVICE_SELECT_SOURCE, + {ATTR_ENTITY_ID: MAIN_ENTITY_ID, ATTR_INPUT_SOURCE: 12}, + blocking=True, + ) + + launch_mock.assert_called_once_with("12") async def test_tv_services(