Better handle invalid trigger config (#55637)

This commit is contained in:
Paulus Schoutsen
2021-09-03 10:15:57 -07:00
committed by GitHub
parent e0f640c0f8
commit 7111fc47c4
4 changed files with 37 additions and 19 deletions

View File

@ -14,6 +14,7 @@ from unittest.mock import patch
from homeassistant import core
from homeassistant.config import get_default_config_dir
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers import area_registry, device_registry, entity_registry
from homeassistant.helpers.check_config import async_check_ha_config_file
from homeassistant.util.yaml import Secrets
import homeassistant.util.yaml.loader as yaml_loader
@ -229,6 +230,9 @@ async def async_check_config(config_dir):
"""Check the HA config."""
hass = core.HomeAssistant()
hass.config.config_dir = config_dir
await area_registry.async_load(hass)
await device_registry.async_load(hass)
await entity_registry.async_load(hass)
components = await async_check_ha_config_file(hass)
await hass.async_stop(force=True)
return components