mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Solve cast delaying startup when discovered devices are slow to setup (#48755)
* Solve cast delaying startup when devices are slow to setup * Update homeassistant/components/cast/media_player.py Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
b558f20ad2
commit
5f8fcca5ad
@ -1,6 +1,7 @@
|
|||||||
"""Provide functionality to interact with Cast devices on the network."""
|
"""Provide functionality to interact with Cast devices on the network."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import asyncio
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import functools as ft
|
import functools as ft
|
||||||
@ -185,7 +186,9 @@ class CastDevice(MediaPlayerEntity):
|
|||||||
)
|
)
|
||||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self._async_stop)
|
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self._async_stop)
|
||||||
self.async_set_cast_info(self._cast_info)
|
self.async_set_cast_info(self._cast_info)
|
||||||
self.hass.async_create_task(
|
# asyncio.create_task is used to avoid delaying startup wrapup if the device
|
||||||
|
# is discovered already during startup but then fails to respond
|
||||||
|
asyncio.create_task(
|
||||||
async_create_catching_coro(self.async_connect_to_chromecast())
|
async_create_catching_coro(self.async_connect_to_chromecast())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user