diff --git a/homeassistant/components/homeassistant/__init__.py b/homeassistant/components/homeassistant/__init__.py index 96bb68bfb65..d5dabfa2e08 100644 --- a/homeassistant/components/homeassistant/__init__.py +++ b/homeassistant/components/homeassistant/__init__.py @@ -17,6 +17,7 @@ from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_LATITUDE, ATTR_LONGITUDE, + EVENT_HOMEASSISTANT_STARTED, RESTART_EXIT_CODE, SERVICE_RELOAD, SERVICE_SAVE_PERSISTENT_STATES, @@ -25,6 +26,7 @@ from homeassistant.const import ( SERVICE_TURN_ON, ) from homeassistant.core import ( + Event, HomeAssistant, ServiceCall, ServiceResponse, @@ -404,45 +406,50 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: hass.data[DATA_EXPOSED_ENTITIES] = exposed_entities async_set_stop_handler(hass, _async_stop) - info = await async_get_system_info(hass) + async def _async_check_deprecation(event: Event) -> None: + """Check and create deprecation issues after startup.""" + info = await async_get_system_info(hass) - installation_type = info["installation_type"][15:] - if installation_type in {"Core", "Container"}: - deprecated_method = installation_type == "Core" - bit32 = _is_32_bit() - arch = info["arch"] - if bit32 and installation_type == "Container": - arch = info.get("container_arch", arch) - ir.async_create_issue( - hass, - DOMAIN, - "deprecated_container", - learn_more_url=DEPRECATION_URL, - is_fixable=False, - severity=IssueSeverity.WARNING, - translation_key="deprecated_container", - translation_placeholders={"arch": arch}, - ) - deprecated_architecture = bit32 and installation_type != "Container" - if deprecated_method or deprecated_architecture: - issue_id = "deprecated" - if deprecated_method: - issue_id += "_method" - if deprecated_architecture: - issue_id += "_architecture" - ir.async_create_issue( - hass, - DOMAIN, - issue_id, - learn_more_url=DEPRECATION_URL, - is_fixable=False, - severity=IssueSeverity.WARNING, - translation_key=issue_id, - translation_placeholders={ - "installation_type": installation_type, - "arch": arch, - }, - ) + installation_type = info["installation_type"][15:] + if installation_type in {"Core", "Container"}: + deprecated_method = installation_type == "Core" + bit32 = _is_32_bit() + arch = info["arch"] + if bit32 and installation_type == "Container": + arch = info.get("container_arch", arch) + ir.async_create_issue( + hass, + DOMAIN, + "deprecated_container", + learn_more_url=DEPRECATION_URL, + is_fixable=False, + severity=IssueSeverity.WARNING, + translation_key="deprecated_container", + translation_placeholders={"arch": arch}, + ) + deprecated_architecture = bit32 and installation_type != "Container" + if deprecated_method or deprecated_architecture: + issue_id = "deprecated" + if deprecated_method: + issue_id += "_method" + if deprecated_architecture: + issue_id += "_architecture" + ir.async_create_issue( + hass, + DOMAIN, + issue_id, + learn_more_url=DEPRECATION_URL, + is_fixable=False, + severity=IssueSeverity.WARNING, + translation_key=issue_id, + translation_placeholders={ + "installation_type": installation_type, + "arch": arch, + }, + ) + + # Delay deprecation check to make sure installation method is determined correctly + hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _async_check_deprecation) return True