From 3f752e13ff8aad45b0af0845a5080fb5f95ccf07 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Fri, 4 Jul 2025 16:23:18 +0200 Subject: [PATCH] Replace MediaPlayerState.STANDBY with MediaPlayerState.OFF in roku (#148137) --- homeassistant/components/roku/media_player.py | 8 ++++---- tests/components/roku/test_media_player.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/roku/media_player.py b/homeassistant/components/roku/media_player.py index d0e1e3a53c0..7f815c4e458 100644 --- a/homeassistant/components/roku/media_player.py +++ b/homeassistant/components/roku/media_player.py @@ -142,7 +142,7 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity): def state(self) -> MediaPlayerState | None: """Return the state of the device.""" if self.coordinator.data.state.standby: - return MediaPlayerState.STANDBY + return MediaPlayerState.OFF if self.coordinator.data.app is None: return None @@ -308,21 +308,21 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity): @roku_exception_handler() async def async_media_pause(self) -> None: """Send pause command.""" - if self.state not in {MediaPlayerState.STANDBY, MediaPlayerState.PAUSED}: + if self.state not in {MediaPlayerState.OFF, MediaPlayerState.PAUSED}: await self.coordinator.roku.remote("play") await self.coordinator.async_request_refresh() @roku_exception_handler() async def async_media_play(self) -> None: """Send play command.""" - if self.state not in {MediaPlayerState.STANDBY, MediaPlayerState.PLAYING}: + if self.state not in {MediaPlayerState.OFF, MediaPlayerState.PLAYING}: await self.coordinator.roku.remote("play") await self.coordinator.async_request_refresh() @roku_exception_handler() async def async_media_play_pause(self) -> None: """Send play/pause command.""" - if self.state != MediaPlayerState.STANDBY: + if self.state != MediaPlayerState.OFF: await self.coordinator.roku.remote("play") await self.coordinator.async_request_refresh() diff --git a/tests/components/roku/test_media_player.py b/tests/components/roku/test_media_player.py index 5f8a41d16ac..7586e85b715 100644 --- a/tests/components/roku/test_media_player.py +++ b/tests/components/roku/test_media_player.py @@ -52,10 +52,10 @@ from homeassistant.const import ( SERVICE_VOLUME_MUTE, SERVICE_VOLUME_UP, STATE_IDLE, + STATE_OFF, STATE_ON, STATE_PAUSED, STATE_PLAYING, - STATE_STANDBY, STATE_UNAVAILABLE, ) from homeassistant.core import HomeAssistant @@ -112,7 +112,7 @@ async def test_idle_setup( """Test setup with idle device.""" state = hass.states.get(MAIN_ENTITY_ID) assert state - assert state.state == STATE_STANDBY + assert state.state == STATE_OFF @pytest.mark.parametrize("mock_device", ["roku/rokutv-7820x.json"], indirect=True)