diff --git a/homeassistant/components/config/__init__.py b/homeassistant/components/config/__init__.py index d71a00ce3bd..1f6dc2c2122 100644 --- a/homeassistant/components/config/__init__.py +++ b/homeassistant/components/config/__init__.py @@ -7,7 +7,7 @@ from homeassistant.const import EVENT_COMPONENT_LOADED from homeassistant.core import HomeAssistant from homeassistant.helpers import config_validation as cv from homeassistant.helpers.typing import ConfigType -from homeassistant.setup import ATTR_COMPONENT +from homeassistant.setup import EventComponentLoaded from . import ( area_registry, @@ -56,6 +56,8 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: if panel.async_setup(hass): name = panel.__name__.split(".")[-1] key = f"{DOMAIN}.{name}" - hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: key}) + hass.bus.async_fire( + EVENT_COMPONENT_LOADED, EventComponentLoaded(component=key) + ) return True diff --git a/homeassistant/components/homeassistant_alerts/__init__.py b/homeassistant/components/homeassistant_alerts/__init__.py index 7d0a7c588dd..b0eefad053e 100644 --- a/homeassistant/components/homeassistant_alerts/__init__.py +++ b/homeassistant/components/homeassistant_alerts/__init__.py @@ -23,6 +23,7 @@ from homeassistant.helpers.issue_registry import ( from homeassistant.helpers.start import async_at_start from homeassistant.helpers.typing import ConfigType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator +from homeassistant.setup import EventComponentLoaded COMPONENT_LOADED_COOLDOWN = 30 DOMAIN = "homeassistant_alerts" @@ -99,7 +100,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: ) @callback - def _component_loaded(_: Event) -> None: + def _component_loaded(_: Event[EventComponentLoaded]) -> None: refresh_debouncer.async_schedule_call() await coordinator.async_refresh() diff --git a/homeassistant/setup.py b/homeassistant/setup.py index b1fc080a429..0516f78b198 100644 --- a/homeassistant/setup.py +++ b/homeassistant/setup.py @@ -455,7 +455,7 @@ async def _async_setup_component( # noqa: C901 if domain in hass.data[DATA_SETUP]: hass.data[DATA_SETUP].pop(domain) - hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: domain}) + hass.bus.async_fire(EVENT_COMPONENT_LOADED, EventComponentLoaded(component=domain)) return True