Enhance ZHA device removal (#122815)

pull/122832/head
David F. Mulcahey 2024-07-29 20:08:21 -04:00 committed by GitHub
parent bd3f0da385
commit 36c01042c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 5 deletions

View File

@ -1311,12 +1311,8 @@ def async_load_api(hass: HomeAssistant) -> None:
"""Remove a node from the network."""
zha_gateway = get_zha_gateway(hass)
ieee: EUI64 = service.data[ATTR_IEEE]
zha_device: Device | None = zha_gateway.get_device(ieee)
if zha_device is not None and zha_device.is_active_coordinator:
_LOGGER.info("Removing the coordinator (%s) is not allowed", ieee)
return
_LOGGER.info("Removing node %s", ieee)
await application_controller.remove(ieee)
await zha_gateway.async_remove_device(ieee)
async_register_admin_service(
hass, DOMAIN, SERVICE_REMOVE, remove, schema=SERVICE_SCHEMAS[IEEE_SERVICE]