Skip to content

Commit

Permalink
Finalize deprecation of groups in Tradfri integration (home-assistant…
Browse files Browse the repository at this point in the history
…#69460)

* Finalise cleanup of groups

* Fix tests

* Remove

* Revert change
  • Loading branch information
ggravlingen authored Apr 7, 2022
1 parent c583df7 commit 74021d6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 13 deletions.
10 changes: 0 additions & 10 deletions homeassistant/components/tradfri/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

from .const import CONF_GATEWAY_ID, CONF_IDENTITY, CONF_KEY, DOMAIN

CONF_IMPORT_GROUPS = "import_groups"
KEY_SECURITY_CODE = "security_code"


Expand All @@ -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
Expand All @@ -60,11 +58,6 @@ async def async_step_auth(
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:
Expand Down Expand Up @@ -122,7 +115,6 @@ async def async_step_import(self, user_input: dict[str, Any]) -> FlowResult:
# 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:
Expand All @@ -134,8 +126,6 @@ async def async_step_import(self, user_input: dict[str, Any]) -> FlowResult:
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
Expand Down
2 changes: 0 additions & 2 deletions tests/components/tradfri/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}


Expand Down Expand Up @@ -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,
}


Expand Down
1 change: 0 additions & 1 deletion tests/components/tradfri/test_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
)
Expand Down

0 comments on commit 74021d6

Please sign in to comment.