fix: await the async ADB poller-factory builder during entry setup (keeps setup non-blocking, no ConfigEntryNotReady)
This commit is contained in:
1 parent
0da84a5a6e
commit
48c30463ec
1 file changed
+2
-2
@@ -27,7 +27,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
PLATFORMS = [Platform.MEDIA_PLAYER, Platform.SENSOR, Platform.BUTTON]
|
PLATFORMS = [Platform.MEDIA_PLAYER, Platform.SENSOR, Platform.BUTTON]
|
||||||
|
|
||||||
|
|
||||||
def _build_poller_factory(hass: HomeAssistant, entry: ConfigEntry):
|
async def _build_poller_factory(hass: HomeAssistant, entry: ConfigEntry):
|
||||||
"""Poller factory when ADB is configured AND usable today, else None.
|
"""Poller factory when ADB is configured AND usable today, else None.
|
||||||
|
|
||||||
Returning None leaves the manager passive: the entry still sets up, the
|
Returning None leaves the manager passive: the entry still sets up, the
|
||||||
@@ -69,7 +69,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
hass.data[DOMAIN][entry.entry_id] = entry
|
hass.data[DOMAIN][entry.entry_id] = entry
|
||||||
|
|
||||||
manager = ShieldConnectionManager(
|
manager = ShieldConnectionManager(
|
||||||
hass, entry, poller_factory=_build_poller_factory(hass, entry)
|
hass, entry, poller_factory=await _build_poller_factory(hass, entry)
|
||||||
)
|
)
|
||||||
entry.runtime_data = manager
|
entry.runtime_data = manager
|
||||||
await manager.async_start()
|
await manager.async_start()
|
||||||
|
|||||||
Reference in new issue
Block a user