Replace MediaPlayerState.STANDBY with MediaPlayerState.OFF in roku (#148137)

This commit is contained in:
Erik Montnemery 2025-07-04 16:23:18 +02:00 committed by GitHub
parent 783102f2f6
commit 3f752e13ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -142,7 +142,7 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
def state(self) -> MediaPlayerState | None: def state(self) -> MediaPlayerState | None:
"""Return the state of the device.""" """Return the state of the device."""
if self.coordinator.data.state.standby: if self.coordinator.data.state.standby:
return MediaPlayerState.STANDBY return MediaPlayerState.OFF
if self.coordinator.data.app is None: if self.coordinator.data.app is None:
return None return None
@ -308,21 +308,21 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
@roku_exception_handler() @roku_exception_handler()
async def async_media_pause(self) -> None: async def async_media_pause(self) -> None:
"""Send pause command.""" """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.roku.remote("play")
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
@roku_exception_handler() @roku_exception_handler()
async def async_media_play(self) -> None: async def async_media_play(self) -> None:
"""Send play command.""" """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.roku.remote("play")
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()
@roku_exception_handler() @roku_exception_handler()
async def async_media_play_pause(self) -> None: async def async_media_play_pause(self) -> None:
"""Send play/pause command.""" """Send play/pause command."""
if self.state != MediaPlayerState.STANDBY: if self.state != MediaPlayerState.OFF:
await self.coordinator.roku.remote("play") await self.coordinator.roku.remote("play")
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()

View File

@ -52,10 +52,10 @@ from homeassistant.const import (
SERVICE_VOLUME_MUTE, SERVICE_VOLUME_MUTE,
SERVICE_VOLUME_UP, SERVICE_VOLUME_UP,
STATE_IDLE, STATE_IDLE,
STATE_OFF,
STATE_ON, STATE_ON,
STATE_PAUSED, STATE_PAUSED,
STATE_PLAYING, STATE_PLAYING,
STATE_STANDBY,
STATE_UNAVAILABLE, STATE_UNAVAILABLE,
) )
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -112,7 +112,7 @@ async def test_idle_setup(
"""Test setup with idle device.""" """Test setup with idle device."""
state = hass.states.get(MAIN_ENTITY_ID) state = hass.states.get(MAIN_ENTITY_ID)
assert state assert state
assert state.state == STATE_STANDBY assert state.state == STATE_OFF
@pytest.mark.parametrize("mock_device", ["roku/rokutv-7820x.json"], indirect=True) @pytest.mark.parametrize("mock_device", ["roku/rokutv-7820x.json"], indirect=True)