diff --git a/homeassistant/helpers/condition.py b/homeassistant/helpers/condition.py index adbaa7e3efa..18894893b88 100644 --- a/homeassistant/helpers/condition.py +++ b/homeassistant/helpers/condition.py @@ -197,7 +197,7 @@ async def _async_get_condition_platform( f'Invalid condition "{platform}" specified {config}' ) from None try: - return integration.get_platform("condition") + return await integration.async_get_platform("condition") except ImportError: raise HomeAssistantError( f"Integration '{platform}' does not provide condition support" diff --git a/homeassistant/helpers/state.py b/homeassistant/helpers/state.py index dae63b4ead1..673cdf48bc5 100644 --- a/homeassistant/helpers/state.py +++ b/homeassistant/helpers/state.py @@ -53,7 +53,9 @@ async def async_reproduce_state( return try: - platform: ModuleType = integration.get_platform("reproduce_state") + platform: ModuleType = await integration.async_get_platform( + "reproduce_state" + ) except ImportError: _LOGGER.warning("Integration %s does not support reproduce state", domain) return diff --git a/homeassistant/helpers/trigger.py b/homeassistant/helpers/trigger.py index c9ca76cdf72..2483806abc1 100644 --- a/homeassistant/helpers/trigger.py +++ b/homeassistant/helpers/trigger.py @@ -222,7 +222,7 @@ async def _async_get_trigger_platform( except IntegrationNotFound: raise vol.Invalid(f"Invalid platform '{platform}' specified") from None try: - return integration.get_platform("trigger") + return await integration.async_get_platform("trigger") except ImportError: raise vol.Invalid( f"Integration '{platform}' does not provide trigger support" diff --git a/tests/helpers/test_trigger.py b/tests/helpers/test_trigger.py index 0a102c4ce42..75394cf0e7a 100644 --- a/tests/helpers/test_trigger.py +++ b/tests/helpers/test_trigger.py @@ -33,7 +33,8 @@ async def test_bad_trigger_platform(hass: HomeAssistant) -> None: async def test_trigger_subtype(hass: HomeAssistant) -> None: """Test trigger subtypes.""" with patch( - "homeassistant.helpers.trigger.async_get_integration", return_value=MagicMock() + "homeassistant.helpers.trigger.async_get_integration", + return_value=MagicMock(async_get_platform=AsyncMock()), ) as integration_mock: await _async_get_trigger_platform(hass, {"platform": "test.subtype"}) assert integration_mock.call_args == call(hass, "test")