From 74021d62da6e71058da11262a80b866b937813fe Mon Sep 17 00:00:00 2001 From: Patrik Lindgren <21142447+ggravlingen@users.noreply.github.com> Date: Thu, 7 Apr 2022 22:19:12 +0200 Subject: [PATCH] Finalize deprecation of groups in Tradfri integration (#69460) * Finalise cleanup of groups * Fix tests * Remove * Revert change --- homeassistant/components/tradfri/config_flow.py | 10 ---------- tests/components/tradfri/test_config_flow.py | 2 -- tests/components/tradfri/test_sensor.py | 1 - 3 files changed, 13 deletions(-) diff --git a/homeassistant/components/tradfri/config_flow.py b/homeassistant/components/tradfri/config_flow.py index 940c53c2df2..20dc2ed9510 100644 --- a/homeassistant/components/tradfri/config_flow.py +++ b/homeassistant/components/tradfri/config_flow.py @@ -18,7 +18,6 @@ from homeassistant.data_entry_flow import FlowResult from .const import CONF_GATEWAY_ID, CONF_IDENTITY, CONF_KEY, DOMAIN -CONF_IMPORT_GROUPS = "import_groups" KEY_SECURITY_CODE = "security_code" @@ -39,7 +38,6 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN): def __init__(self) -> None: """Initialize flow.""" self._host: str | None = None - self._import_groups = False async def async_step_user( self, user_input: dict[str, Any] | None = None @@ -60,11 +58,6 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN): self.hass, host, user_input[KEY_SECURITY_CODE] ) - # We don't ask for import group anymore as group state - # is not reliable, don't want to show that to the user. - # But we still allow specifying import group via config yaml. - auth[CONF_IMPORT_GROUPS] = self._import_groups - return await self._entry_from_data(auth) except AuthError as err: @@ -122,7 +115,6 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN): # Happens if user has host directly in configuration.yaml if "key" not in user_input: self._host = user_input["host"] - self._import_groups = user_input[CONF_IMPORT_GROUPS] return await self.async_step_auth() try: @@ -134,8 +126,6 @@ class FlowHandler(config_entries.ConfigFlow, domain=DOMAIN): user_input["key"], ) - data[CONF_IMPORT_GROUPS] = user_input[CONF_IMPORT_GROUPS] - return await self._entry_from_data(data) except AuthError: # If we fail to connect, just pass it on to discovery diff --git a/tests/components/tradfri/test_config_flow.py b/tests/components/tradfri/test_config_flow.py index 17b5530fe81..0ac431a7f35 100644 --- a/tests/components/tradfri/test_config_flow.py +++ b/tests/components/tradfri/test_config_flow.py @@ -57,7 +57,6 @@ async def test_user_connection_successful(hass, mock_auth, mock_entry_setup): assert result["result"].data == { "host": "123.123.123.123", "gateway_id": "bla", - "import_groups": False, } @@ -126,7 +125,6 @@ async def test_discovery_connection(hass, mock_auth, mock_entry_setup): assert result["result"].data == { "host": "123.123.123.123", "gateway_id": "bla", - "import_groups": False, } diff --git a/tests/components/tradfri/test_sensor.py b/tests/components/tradfri/test_sensor.py index a36ff93a607..1cd7a3672bc 100644 --- a/tests/components/tradfri/test_sensor.py +++ b/tests/components/tradfri/test_sensor.py @@ -150,7 +150,6 @@ async def test_unique_id_migration(hass, mock_gateway, mock_api_factory): "host": "mock-host", "identity": "mock-identity", "key": "mock-key", - "import_groups": False, "gateway_id": GATEWAY_ID, }, )