Skip to content

Commit

Permalink
Remove unignore flow from homekit controller (#126637)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored Sep 24, 2024
1 parent 2ded9d5 commit 2649279
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 70 deletions.
22 changes: 0 additions & 22 deletions homeassistant/components/homekit_controller/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,28 +168,6 @@ async def async_step_user(
),
)

async def async_step_unignore(self, user_input: dict[str, Any]) -> ConfigFlowResult:
"""Rediscover a previously ignored discover."""
unique_id = user_input["unique_id"]
await self.async_set_unique_id(unique_id)

if self.controller is None:
await self._async_setup_controller()

assert self.controller

try:
discovery = await self.controller.async_find(unique_id)
except aiohomekit.AccessoryNotFoundError:
return self.async_abort(reason="accessory_not_found_error")

self.name = discovery.description.name
self.model = getattr(discovery.description, "model", BLE_DEFAULT_NAME)
self.category = discovery.description.category
self.hkid = discovery.description.id

return self._async_step_pair_show_form()

@callback
def _hkid_is_homekit(self, hkid: str) -> bool:
"""Determine if the device is a homekit bridge or accessory."""
Expand Down
48 changes: 0 additions & 48 deletions tests/components/homekit_controller/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,54 +959,6 @@ async def test_user_no_unpaired_devices(hass: HomeAssistant, controller) -> None
assert result["reason"] == "no_devices"


async def test_unignore_works(hass: HomeAssistant, controller) -> None:
"""Test rediscovery triggered disovers work."""
device = setup_mock_accessory(controller)

# Device is unignored
result = await hass.config_entries.flow.async_init(
"homekit_controller",
context={"source": config_entries.SOURCE_UNIGNORE},
data={"unique_id": device.description.id},
)
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "pair"
assert get_flow_context(hass, result) == {
"title_placeholders": {"name": "TestDevice", "category": "Other"},
"unique_id": "00:00:00:00:00:00",
"source": config_entries.SOURCE_UNIGNORE,
}

# User initiates pairing by clicking on 'configure' - device enters pairing mode and displays code
result = await hass.config_entries.flow.async_configure(result["flow_id"])
assert result["type"] is FlowResultType.FORM
assert result["step_id"] == "pair"

# Pairing finalized
result = await hass.config_entries.flow.async_configure(
result["flow_id"], user_input={"pairing_code": "111-22-333"}
)
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["title"] == "Koogeek-LS1-20833F"


async def test_unignore_ignores_missing_devices(
hass: HomeAssistant, controller
) -> None:
"""Test rediscovery triggered disovers handle devices that have gone away."""
setup_mock_accessory(controller)

# Device is unignored
result = await hass.config_entries.flow.async_init(
"homekit_controller",
context={"source": config_entries.SOURCE_UNIGNORE},
data={"unique_id": "00:00:00:00:00:01"},
)

assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "accessory_not_found_error"


async def test_discovery_dismiss_existing_flow_on_paired(
hass: HomeAssistant, controller
) -> None:
Expand Down

0 comments on commit 2649279

Please sign in to comment.