mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Remove unignore flow from homekit controller (#126637)
This commit is contained in:
parent
2ded9d551a
commit
264927926e
@ -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."""
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user