Skip to content

Commit

Permalink
Solve cast delaying startup when discovered devices are slow to setup (
Browse files Browse the repository at this point in the history
…#48755)

* Solve cast delaying startup when devices are slow to setup

* Update homeassistant/components/cast/media_player.py

Co-authored-by: Erik Montnemery <[email protected]>

Co-authored-by: Erik Montnemery <[email protected]>
  • Loading branch information
2 people authored and frenck committed Apr 7, 2021
1 parent 537d641 commit bfb8141
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion homeassistant/components/cast/media_player.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Provide functionality to interact with Cast devices on the network."""
from __future__ import annotations

import asyncio
from contextlib import suppress
from datetime import timedelta
import functools as ft
Expand Down Expand Up @@ -185,7 +186,9 @@ async def async_added_to_hass(self):
)
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self._async_stop)
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())
)

Expand Down

0 comments on commit bfb8141

Please sign in to comment.