Fix dangling task for homeassistant integration (#88288)

This commit is contained in:
Paulus Schoutsen 2023-02-16 23:23:44 -05:00 committed by GitHub
parent 509d968814
commit 0904848579
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,7 +156,8 @@ async def async_setup(hass: ha.HomeAssistant, config: ConfigType) -> bool: # no
)
if call.service == SERVICE_HOMEASSISTANT_STOP:
asyncio.create_task(hass.async_stop())
# Track trask in hass.data. No need to cleanup, we're stopping.
hass.data["homeassistant_stop"] = asyncio.create_task(hass.async_stop())
return
errors = await conf_util.async_check_ha_config_file(hass)
@ -179,7 +180,10 @@ async def async_setup(hass: ha.HomeAssistant, config: ConfigType) -> bool: # no
)
if call.service == SERVICE_HOMEASSISTANT_RESTART:
asyncio.create_task(hass.async_stop(RESTART_EXIT_CODE))
# Track trask in hass.data. No need to cleanup, we're stopping.
hass.data["homeassistant_stop"] = asyncio.create_task(
hass.async_stop(RESTART_EXIT_CODE)
)
async def async_handle_update_service(call: ha.ServiceCall) -> None:
"""Service handler for updating an entity."""