Add WebSocket support for real-time media status updates
Replace HTTP polling with WebSocket push notifications for instant state change responses. Server broadcasts updates only when significant changes occur (state, track, volume, etc.) while letting Home Assistant interpolate position during playback. Includes seek detection for timeline updates and automatic fallback to HTTP polling if WebSocket disconnects. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,6 +138,12 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
if unload_ok:
|
||||
# Close client and remove data
|
||||
data = hass.data[DOMAIN].pop(entry.entry_id)
|
||||
|
||||
# Shutdown coordinator (WebSocket cleanup)
|
||||
if "coordinator" in data:
|
||||
await data["coordinator"].async_shutdown()
|
||||
|
||||
# Close HTTP client
|
||||
await data["client"].close()
|
||||
|
||||
# Remove services if this was the last entry
|
||||
|
||||
Reference in New Issue
Block a user