diff --git a/homeassistant/components/zha/api.py b/homeassistant/components/zha/api.py index 7c732b6906e..5fb7f6d8fdb 100644 --- a/homeassistant/components/zha/api.py +++ b/homeassistant/components/zha/api.py @@ -906,6 +906,11 @@ def async_load_api(hass): async def remove(service): """Remove a node from the network.""" ieee = service.data.get(ATTR_IEEE_ADDRESS) + zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY] + zha_device = zha_gateway.get_device(ieee) + if zha_device.is_coordinator: + _LOGGER.info("Removing the coordinator (%s) is not allowed", ieee) + return _LOGGER.info("Removing node %s", ieee) await application_controller.remove(ieee) diff --git a/homeassistant/components/zha/core/device.py b/homeassistant/components/zha/core/device.py index 5c3b3578c12..3ed44a8f2aa 100644 --- a/homeassistant/components/zha/core/device.py +++ b/homeassistant/components/zha/core/device.py @@ -165,8 +165,10 @@ class ZHADevice(LogMixin): @property def device_type(self): """Return the logical device type for the device.""" - device_type = self._zigpy_device.node_desc.logical_type - return device_type.name if device_type else UNKNOWN + node_descriptor = self._zigpy_device.node_desc + return ( + node_descriptor.logical_type.name if node_descriptor.is_valid else UNKNOWN + ) @property def power_source(self): diff --git a/homeassistant/components/zha/core/gateway.py b/homeassistant/components/zha/core/gateway.py index 72931c665ee..72b5aa87329 100644 --- a/homeassistant/components/zha/core/gateway.py +++ b/homeassistant/components/zha/core/gateway.py @@ -135,8 +135,6 @@ class ZHAGateway: await coro for device in self.application_controller.devices.values(): - if device.nwk == 0x0000: - continue init_tasks.append( init_with_semaphore(self.async_device_restored(device), semaphore) ) @@ -160,9 +158,6 @@ class ZHAGateway: def raw_device_initialized(self, device): """Handle a device initialization without quirks loaded.""" - if device.nwk == 0x0000: - return - manuf = device.manufacturer async_dispatcher_send( self._hass, @@ -336,9 +331,6 @@ class ZHAGateway: async def async_device_initialized(self, device): """Handle device joined and basic information discovered (async).""" - if device.nwk == 0x0000: - return - zha_device = self._async_get_or_create_device(device) _LOGGER.debug(