Skip to content

Commit 1f22171

Browse files
MindFreezefrenck
authored andcommitted
Remove the Delete button on the ZwaveJS device page (home-assistant#146544)
1 parent 43797c0 commit 1f22171

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
@@ -1119,38 +1119,6 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
11191119
LOGGER.error(err)
11201120

11211121

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