mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 04:07:08 +00:00
update remove service (#31164)
This commit is contained in:
parent
50b0e938e1
commit
7d9c8fdfa0
@ -908,10 +908,10 @@ 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.get(ATTR_IEEE_ADDRESS)
|
ieee = service.data[ATTR_IEEE_ADDRESS]
|
||||||
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
|
zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]
|
||||||
zha_device = zha_gateway.get_device(ieee)
|
zha_device = zha_gateway.get_device(ieee)
|
||||||
if zha_device.is_coordinator:
|
if zha_device is not None and zha_device.is_coordinator:
|
||||||
_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