mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
only block coord removal if it is active (#48147)
This commit is contained in:
parent
08870690a6
commit
01fcc41aa0
@ -60,6 +60,7 @@ from .core.helpers import (
|
|||||||
get_matched_clusters,
|
get_matched_clusters,
|
||||||
qr_to_install_code,
|
qr_to_install_code,
|
||||||
)
|
)
|
||||||
|
from .core.typing import ZhaDeviceType, ZhaGatewayType
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -892,9 +893,12 @@ def async_load_api(hass):
|
|||||||
async def remove(service):
|
async def remove(service):
|
||||||
"""Remove a node from the network."""
|
"""Remove a node from the network."""
|
||||||
ieee = service.data[ATTR_IEEE]
|
ieee = service.data[ATTR_IEEE]
|
||||||
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
|
zha_gateway: ZhaGatewayType = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
|
||||||
zha_device = zha_gateway.get_device(ieee)
|
zha_device: ZhaDeviceType = zha_gateway.get_device(ieee)
|
||||||
if zha_device is not None and zha_device.is_coordinator:
|
if zha_device is not None and (
|
||||||
|
zha_device.is_coordinator
|
||||||
|
and zha_device.ieee == zha_gateway.application_controller.ieee
|
||||||
|
):
|
||||||
_LOGGER.info("Removing the coordinator (%s) is not allowed", ieee)
|
_LOGGER.info("Removing the coordinator (%s) is not allowed", ieee)
|
||||||
return
|
return
|
||||||
_LOGGER.info("Removing node %s", ieee)
|
_LOGGER.info("Removing node %s", ieee)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user