Revert "Reduce unnecessary state refreshes to prevent UI dialog closure"
All checks were successful
Validate / Hassfest (push) Successful in 3s
All checks were successful
Validate / Hassfest (push) Successful in 3s
This reverts commit 8419b0de8c.
This commit is contained in:
@@ -161,16 +161,16 @@ class EmbyCoordinator(DataUpdateCoordinator[dict[str, EmbySession]]):
|
|||||||
sessions = self._parse_sessions(data)
|
sessions = self._parse_sessions(data)
|
||||||
self.async_set_updated_data(sessions)
|
self.async_set_updated_data(sessions)
|
||||||
|
|
||||||
elif message_type in (WS_MESSAGE_PLAYBACK_START, WS_MESSAGE_PLAYBACK_STOP):
|
elif message_type in (
|
||||||
# Playback started or stopped - refresh to get full state
|
WS_MESSAGE_PLAYBACK_START,
|
||||||
|
WS_MESSAGE_PLAYBACK_STOP,
|
||||||
|
WS_MESSAGE_PLAYBACK_PROGRESS,
|
||||||
|
):
|
||||||
|
# Individual session update - trigger a refresh to get full state
|
||||||
|
# We could optimize this by updating only the affected session,
|
||||||
|
# but a full refresh ensures consistency
|
||||||
self.hass.async_create_task(self.async_request_refresh())
|
self.hass.async_create_task(self.async_request_refresh())
|
||||||
|
|
||||||
elif message_type == WS_MESSAGE_PLAYBACK_PROGRESS:
|
|
||||||
# Progress updates are frequent - don't trigger full refresh
|
|
||||||
# to avoid UI flicker. Regular polling will update position.
|
|
||||||
# We could extract position from the message here if needed.
|
|
||||||
pass
|
|
||||||
|
|
||||||
async def _async_update_data(self) -> dict[str, EmbySession]:
|
async def _async_update_data(self) -> dict[str, EmbySession]:
|
||||||
"""Fetch sessions from Emby API (polling fallback)."""
|
"""Fetch sessions from Emby API (polling fallback)."""
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -404,8 +404,7 @@ class EmbyMediaPlayer(CoordinatorEntity[EmbyCoordinator], MediaPlayerEntity):
|
|||||||
self._session_id,
|
self._session_id,
|
||||||
item_ids=[media_id],
|
item_ids=[media_id],
|
||||||
)
|
)
|
||||||
# Don't refresh immediately - WebSocket will send PlaybackStart event,
|
await self.coordinator.async_request_refresh()
|
||||||
# or polling will update state. Immediate refresh can close UI dialogs.
|
|
||||||
|
|
||||||
async def async_browse_media(
|
async def async_browse_media(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user