Skip to content

Commit 9ee4551

Browse files
authored
Remove the Delete button on the ZwaveJS device page (home-assistant#146544)
1 parent 09a5ac5 commit 9ee4551

File tree

2 files changed

+0
-53
lines changed

2 files changed

+0
-53
lines changed

homeassistant/components/zwave_js/__init__.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,38 +1116,6 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
11161116
LOGGER.error(err)
11171117

11181118

1119-
async def async_remove_config_entry_device(
1120-
hass: HomeAssistant, config_entry: ConfigEntry, device_entry: dr.DeviceEntry
1121-
) -> bool:
1122-
"""Remove a config entry from a device."""
1123-
client: ZwaveClient = config_entry.runtime_data[DATA_CLIENT]
1124-
1125-
# Driver may not be ready yet so we can't allow users to remove a device since
1126-
# we need to check if the device is still known to the controller
1127-
if (driver := client.driver) is None:
1128-
LOGGER.error("Driver for %s is not ready", config_entry.title)
1129-
return False
1130-
1131-
# If a node is found on the controller that matches the hardware based identifier
1132-
# on the device, prevent the device from being removed.
1133-
if next(
1134-
(
1135-
node
1136-
for node in driver.controller.nodes.values()
1137-
if get_device_id_ext(driver, node) in device_entry.identifiers
1138-
),
1139-
None,
1140-
):
1141-
return False
1142-
1143-
controller_events: ControllerEvents = config_entry.runtime_data[
1144-
DATA_DRIVER_EVENTS
1145-
].controller_events
1146-
controller_events.registered_unique_ids.pop(device_entry.id, None)
1147-
controller_events.discovered_value_ids.pop(device_entry.id, None)
1148-
return True
1149-
1150-
11511119
async def async_ensure_addon_running(hass: HomeAssistant, entry: ConfigEntry) -> None:
11521120
"""Ensure that Z-Wave JS add-on is installed and running."""
11531121
addon_manager = _get_addon_manager(hass)

tests/components/zwave_js/test_init.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,27 +1692,6 @@ async def test_replace_different_node(
16921692
(DOMAIN, multisensor_6_device_id_ext),
16931693
}
16941694

1695-
ws_client = await hass_ws_client(hass)
1696-
1697-
# Simulate the driver not being ready to ensure that the device removal handler
1698-
# does not crash
1699-
driver = client.driver
1700-
client.driver = None
1701-
1702-
response = await ws_client.remove_device(hank_device.id, integration.entry_id)
1703-
assert not response["success"]
1704-
1705-
client.driver = driver
1706-
1707-
# Attempting to remove the hank device should pass, but removing the multisensor should not
1708-
response = await ws_client.remove_device(hank_device.id, integration.entry_id)
1709-
assert response["success"]
1710-
1711-
response = await ws_client.remove_device(
1712-
multisensor_6_device.id, integration.entry_id
1713-
)
1714-
assert not response["success"]
1715-
17161695

17171696
async def test_node_model_change(
17181697
hass: HomeAssistant,

0 commit comments

Comments
 (0)