diff --git a/homeassistant/components/cloud/account_link.py b/homeassistant/components/cloud/account_link.py index 19819307cf0..3cf021c24fe 100644 --- a/homeassistant/components/cloud/account_link.py +++ b/homeassistant/components/cloud/account_link.py @@ -18,6 +18,9 @@ CACHE_TIMEOUT = 3600 _LOGGER = logging.getLogger(__name__) CURRENT_VERSION = AwesomeVersion(HA_VERSION) +CURRENT_PLAIN_VERSION = AwesomeVersion( + CURRENT_VERSION.string.removesuffix(f"{CURRENT_VERSION.modifier}") +) @callback @@ -35,7 +38,7 @@ async def async_provide_implementation(hass: HomeAssistant, domain: str): for service in services: if ( service["service"] == domain - and CURRENT_VERSION >= service["min_version"] + and CURRENT_PLAIN_VERSION >= service["min_version"] and ( service.get("accepts_new_authorizations", True) or ( diff --git a/tests/components/cloud/test_account_link.py b/tests/components/cloud/test_account_link.py index ad914436c07..6928e2b7a11 100644 --- a/tests/components/cloud/test_account_link.py +++ b/tests/components/cloud/test_account_link.py @@ -57,6 +57,7 @@ async def test_setup_provide_implementation(hass): return_value=[ {"service": "test", "min_version": "0.1.0"}, {"service": "too_new", "min_version": "1000000.0.0"}, + {"service": "dev", "min_version": "2022.9.0"}, { "service": "deprecated", "min_version": "0.1.0", @@ -73,6 +74,8 @@ async def test_setup_provide_implementation(hass): "accepts_new_authorizations": False, }, ], + ), patch( + "homeassistant.components.cloud.account_link.HA_VERSION", "2022.9.0.dev20220817" ): assert ( await config_entry_oauth2_flow.async_get_implementations( @@ -101,6 +104,10 @@ async def test_setup_provide_implementation(hass): await config_entry_oauth2_flow.async_get_implementations(hass, "legacy") ) + dev_implementations = await config_entry_oauth2_flow.async_get_implementations( + hass, "dev" + ) + assert "cloud" in implementations assert implementations["cloud"].domain == "cloud" assert implementations["cloud"].service == "test" @@ -111,6 +118,11 @@ async def test_setup_provide_implementation(hass): assert legacy_implementations["cloud"].service == "legacy" assert legacy_implementations["cloud"].hass is hass + assert "cloud" in dev_implementations + assert dev_implementations["cloud"].domain == "cloud" + assert dev_implementations["cloud"].service == "dev" + assert dev_implementations["cloud"].hass is hass + async def test_get_services_cached(hass): """Test that we cache services."""