diff --git a/homeassistant/helpers/check_config.py b/homeassistant/helpers/check_config.py index 836536da9ee4..1982cc4f0c8c 100644 --- a/homeassistant/helpers/check_config.py +++ b/homeassistant/helpers/check_config.py @@ -31,7 +31,7 @@ from homeassistant.requirements import ( async_get_integration_with_requirements, ) -from . import config_validation as cv +from . import condition, config_validation as cv, trigger from .typing import ConfigType @@ -93,6 +93,12 @@ async def async_check_ha_config_file( # noqa: C901 result = HomeAssistantConfig() async_clear_install_history(hass) + # Set up condition and trigger helpers needed for config validation. + if condition.CONDITIONS not in hass.data: + await condition.async_setup(hass) + if trigger.TRIGGERS not in hass.data: + await trigger.async_setup(hass) + def _pack_error( hass: HomeAssistant, package: str, diff --git a/tests/helpers/test_check_config.py b/tests/helpers/test_check_config.py index fc2df8552e70..075b4d3f2f95 100644 --- a/tests/helpers/test_check_config.py +++ b/tests/helpers/test_check_config.py @@ -15,6 +15,8 @@ from homeassistant.helpers.check_config import ( HomeAssistantConfig, async_check_ha_config_file, ) +from homeassistant.helpers.condition import CONDITIONS +from homeassistant.helpers.trigger import TRIGGERS from homeassistant.requirements import RequirementsNotFound from tests.common import ( @@ -493,6 +495,11 @@ async def test_missing_included_file(hass: HomeAssistant) -> None: async def test_automation_config_platform(hass: HomeAssistant) -> None: """Test automation async config.""" + # Remove keys pre-populated by the test fixture to simulate + # the check_config script which doesn't run bootstrap. + del hass.data[TRIGGERS] + del hass.data[CONDITIONS] + files = { YAML_CONFIG_FILE: BASE_CONFIG + """ @@ -514,6 +521,9 @@ blueprint: trigger: platform: event event_type: !input trigger_event +condition: + condition: template + value_template: "{{ true }}" action: service: !input service_to_call """,