Remove unignore flow from homekit controller (#126637)

This commit is contained in:
Erik Montnemery 2024-09-24 16:43:12 +02:00 committed by GitHub
parent 2ded9d551a
commit 264927926e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 70 deletions

View File

@ -168,28 +168,6 @@ class HomekitControllerFlowHandler(ConfigFlow, domain=DOMAIN):
),
)
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."""

View File

@ -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: