mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 23:57:06 +00:00
Migrate homeassistant_sky_connect to use eager_start for tasks (#114706)
This commit is contained in:
parent
3eafdadc8f
commit
a767530970
@ -30,7 +30,9 @@ async def _async_usb_scan_done(hass: HomeAssistant, entry: ConfigEntry) -> None:
|
|||||||
|
|
||||||
if not usb.async_is_plugged_in(hass, matcher):
|
if not usb.async_is_plugged_in(hass, matcher):
|
||||||
# The USB dongle is not plugged in, remove the config entry
|
# The USB dongle is not plugged in, remove the config entry
|
||||||
hass.async_create_task(hass.config_entries.async_remove(entry.entry_id))
|
hass.async_create_task(
|
||||||
|
hass.config_entries.async_remove(entry.entry_id), eager_start=True
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
usb_dev = entry.data["device"]
|
usb_dev = entry.data["device"]
|
||||||
@ -73,7 +75,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
@callback
|
@callback
|
||||||
def async_usb_scan_done() -> None:
|
def async_usb_scan_done() -> None:
|
||||||
"""Handle usb discovery started."""
|
"""Handle usb discovery started."""
|
||||||
hass.async_create_task(_async_usb_scan_done(hass, entry))
|
hass.async_create_task(_async_usb_scan_done(hass, entry), eager_start=True)
|
||||||
|
|
||||||
unsub_usb = usb.async_register_initial_scan_callback(hass, async_usb_scan_done)
|
unsub_usb = usb.async_register_initial_scan_callback(hass, async_usb_scan_done)
|
||||||
entry.async_on_unload(unsub_usb)
|
entry.async_on_unload(unsub_usb)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user