Delay deprecation checks until Home Assistant is fully initialized

This aims to delay the async_get_system_info() call until the hassio
integration is fully initialized, to make sure the installation method
is determined correctly.
This commit is contained in:
Stefan Agner
2025-06-24 00:01:30 +02:00
parent 2f736a5bf3
commit 1415d6cf0b

View File

@ -17,6 +17,7 @@ from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
ATTR_LATITUDE, ATTR_LATITUDE,
ATTR_LONGITUDE, ATTR_LONGITUDE,
EVENT_HOMEASSISTANT_STARTED,
RESTART_EXIT_CODE, RESTART_EXIT_CODE,
SERVICE_RELOAD, SERVICE_RELOAD,
SERVICE_SAVE_PERSISTENT_STATES, SERVICE_SAVE_PERSISTENT_STATES,
@ -25,6 +26,7 @@ from homeassistant.const import (
SERVICE_TURN_ON, SERVICE_TURN_ON,
) )
from homeassistant.core import ( from homeassistant.core import (
Event,
HomeAssistant, HomeAssistant,
ServiceCall, ServiceCall,
ServiceResponse, ServiceResponse,
@ -404,6 +406,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
hass.data[DATA_EXPOSED_ENTITIES] = exposed_entities hass.data[DATA_EXPOSED_ENTITIES] = exposed_entities
async_set_stop_handler(hass, _async_stop) async_set_stop_handler(hass, _async_stop)
async def _async_check_deprecation(event: Event) -> None:
"""Check and create deprecation issues after startup."""
info = await async_get_system_info(hass) info = await async_get_system_info(hass)
installation_type = info["installation_type"][15:] installation_type = info["installation_type"][15:]
@ -444,6 +448,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa:
}, },
) )
# Delay deprecation check to make sure installation method is determined correctly
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _async_check_deprecation)
return True return True