Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion homeassistant/components/roku/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,12 @@ async def async_select_source(self, source: str) -> None:
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:
Expand Down
14 changes: 12 additions & 2 deletions tests/components/roku/test_media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,25 @@ 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,
{ATTR_ENTITY_ID: MAIN_ENTITY_ID, ATTR_INPUT_SOURCE: "Netflix"},
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(
Expand Down