mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Enhance ZHA device removal (#122815)
This commit is contained in:
parent
bd3f0da385
commit
36c01042c1
@ -1311,12 +1311,8 @@ def async_load_api(hass: HomeAssistant) -> None:
|
|||||||
"""Remove a node from the network."""
|
"""Remove a node from the network."""
|
||||||
zha_gateway = get_zha_gateway(hass)
|
zha_gateway = get_zha_gateway(hass)
|
||||||
ieee: EUI64 = service.data[ATTR_IEEE]
|
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)
|
_LOGGER.info("Removing node %s", ieee)
|
||||||
await application_controller.remove(ieee)
|
await zha_gateway.async_remove_device(ieee)
|
||||||
|
|
||||||
async_register_admin_service(
|
async_register_admin_service(
|
||||||
hass, DOMAIN, SERVICE_REMOVE, remove, schema=SERVICE_SCHEMAS[IEEE_SERVICE]
|
hass, DOMAIN, SERVICE_REMOVE, remove, schema=SERVICE_SCHEMAS[IEEE_SERVICE]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user