mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Refresh homeassistant_alerts when hass has started (#76083)
This commit is contained in:
parent
f043203b56
commit
17fbee7dd3
@ -14,6 +14,7 @@ from homeassistant.components.repairs.models import IssueSeverity
|
|||||||
from homeassistant.const import __version__
|
from homeassistant.const import __version__
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||||
|
from homeassistant.helpers.start import async_at_start
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
from homeassistant.util.yaml import parse_yaml
|
from homeassistant.util.yaml import parse_yaml
|
||||||
@ -100,8 +101,12 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
|||||||
|
|
||||||
coordinator = AlertUpdateCoordinator(hass)
|
coordinator = AlertUpdateCoordinator(hass)
|
||||||
coordinator.async_add_listener(async_schedule_update_alerts)
|
coordinator.async_add_listener(async_schedule_update_alerts)
|
||||||
|
|
||||||
|
async def initial_refresh(hass: HomeAssistant) -> None:
|
||||||
await coordinator.async_refresh()
|
await coordinator.async_refresh()
|
||||||
|
|
||||||
|
async_at_start(hass, initial_refresh)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user