mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Update roku state faster after actions (#39453)
* update roku state faster after actions * Update media_player.py * Update remote.py
This commit is contained in:
parent
8b893173fd
commit
bd7682a694
@ -192,44 +192,52 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
||||
async def async_turn_on(self) -> None:
|
||||
"""Turn on the Roku."""
|
||||
await self.coordinator.roku.remote("poweron")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_turn_off(self) -> None:
|
||||
"""Turn off the Roku."""
|
||||
await self.coordinator.roku.remote("poweroff")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_media_pause(self) -> None:
|
||||
"""Send pause command."""
|
||||
if self.state not in (STATE_STANDBY, STATE_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 (STATE_STANDBY, STATE_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 != STATE_STANDBY:
|
||||
await self.coordinator.roku.remote("play")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_media_previous_track(self) -> None:
|
||||
"""Send previous track command."""
|
||||
await self.coordinator.roku.remote("reverse")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_media_next_track(self) -> None:
|
||||
"""Send next track command."""
|
||||
await self.coordinator.roku.remote("forward")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_mute_volume(self, mute) -> None:
|
||||
"""Mute the volume."""
|
||||
await self.coordinator.roku.remote("volume_mute")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_volume_up(self) -> None:
|
||||
@ -253,6 +261,7 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
||||
return
|
||||
|
||||
await self.coordinator.roku.tune(media_id)
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_select_source(self, source: str) -> None:
|
||||
@ -271,3 +280,5 @@ class RokuMediaPlayer(RokuEntity, MediaPlayerEntity):
|
||||
|
||||
if appl is not None:
|
||||
await self.coordinator.roku.launch(appl.app_id)
|
||||
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
@ -47,11 +47,13 @@ class RokuRemote(RokuEntity, RemoteEntity):
|
||||
async def async_turn_on(self, **kwargs) -> None:
|
||||
"""Turn the device on."""
|
||||
await self.coordinator.roku.remote("poweron")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_turn_off(self, **kwargs) -> None:
|
||||
"""Turn the device off."""
|
||||
await self.coordinator.roku.remote("poweroff")
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
||||
@roku_exception_handler
|
||||
async def async_send_command(self, command: List, **kwargs) -> None:
|
||||
@ -61,3 +63,5 @@ class RokuRemote(RokuEntity, RemoteEntity):
|
||||
for _ in range(num_repeats):
|
||||
for single_command in command:
|
||||
await self.coordinator.roku.remote(single_command)
|
||||
|
||||
await self.coordinator.async_request_refresh()
|
||||
|
Loading…
x
Reference in New Issue
Block a user