diff --git a/homeassistant/helpers/check_config.py b/homeassistant/helpers/check_config.py index b362d68ad55..0de11303cf9 100644 --- a/homeassistant/helpers/check_config.py +++ b/homeassistant/helpers/check_config.py @@ -199,7 +199,7 @@ async def async_check_ha_config_file( # noqa: C901 # Check if the integration has a custom config validator config_validator = None try: - config_validator = integration.get_platform("config") + config_validator = await integration.async_get_platform("config") except ImportError as err: # Filter out import error of the config platform. # If the config platform contains bad imports, make sure @@ -270,7 +270,7 @@ async def async_check_ha_config_file( # noqa: C901 p_integration = await async_get_integration_with_requirements( hass, p_name ) - platform = p_integration.get_platform(domain) + platform = await p_integration.async_get_platform(domain) except loader.IntegrationNotFound as ex: # We get this error if an integration is not found. In recovery mode and # safe mode, this currently happens for all custom integrations. Don't diff --git a/tests/helpers/test_check_config.py b/tests/helpers/test_check_config.py index edf1066f744..a7c5fe36cff 100644 --- a/tests/helpers/test_check_config.py +++ b/tests/helpers/test_check_config.py @@ -338,7 +338,7 @@ async def test_config_platform_import_error(hass: HomeAssistant) -> None: # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: beer"} with patch( - "homeassistant.loader.Integration.get_platform", + "homeassistant.loader.Integration.async_get_platform", side_effect=ImportError("blablabla"), ), patch("os.path.isfile", return_value=True), patch_yaml_files(files): res = await async_check_ha_config_file(hass) @@ -358,7 +358,7 @@ async def test_platform_import_error(hass: HomeAssistant) -> None: # Make sure they don't exist files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: demo"} with patch( - "homeassistant.loader.Integration.get_platform", + "homeassistant.loader.Integration.async_get_platform", side_effect=[None, ImportError("blablabla")], ), patch("os.path.isfile", return_value=True), patch_yaml_files(files): res = await async_check_ha_config_file(hass)