1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-02 08:26:41 +01:00

Allow deleting UniFi client devices (#165505)

This commit is contained in:
Josh
2026-03-13 18:06:58 -04:00
committed by GitHub
parent 018717af4f
commit 7276403ab9
2 changed files with 4 additions and 6 deletions

View File

@@ -76,9 +76,7 @@ async def async_remove_config_entry_device(
"""Remove config entry from a device."""
hub = config_entry.runtime_data
return not any(
identifier
for _, identifier in device_entry.connections
if identifier in hub.api.clients or identifier in hub.api.devices
identifier in hub.api.devices for _, identifier in device_entry.connections
)

View File

@@ -178,13 +178,13 @@ async def test_remove_config_entry_device(
assert await async_setup_component(hass, "config", {})
ws_client = await hass_ws_client(hass)
# Try to remove an active client from UI: not allowed
# Try to remove an active client from UI: allowed
device_entry = device_registry.async_get_device(
connections={(dr.CONNECTION_NETWORK_MAC, client_payload[0]["mac"])}
)
response = await ws_client.remove_device(device_entry.id, config_entry.entry_id)
assert not response["success"]
assert device_registry.async_get_device(
assert response["success"]
assert not device_registry.async_get_device(
connections={(dr.CONNECTION_NETWORK_MAC, client_payload[0]["mac"])}
)