From 479511ee425de3d32940a58a39417646b4b839ac Mon Sep 17 00:00:00 2001 From: Alexei Chetroi Date: Sat, 13 Apr 2019 12:57:22 -0400 Subject: [PATCH] Bugfix ZHA device_removed() handler. (#23074) --- homeassistant/components/zha/core/gateway.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/homeassistant/components/zha/core/gateway.py b/homeassistant/components/zha/core/gateway.py index 83013b7bdf7..17c7c6f878f 100644 --- a/homeassistant/components/zha/core/gateway.py +++ b/homeassistant/components/zha/core/gateway.py @@ -145,14 +145,14 @@ class ZHAGateway: def device_removed(self, device): """Handle device being removed from the network.""" - device = self._devices.pop(device.ieee, None) + zha_device = self._devices.pop(device.ieee, None) self._device_registry.pop(device.ieee, None) - if device is not None: - device_info = async_get_device_info(self._hass, device) - self._hass.async_create_task(device.async_unsub_dispatcher()) + if zha_device is not None: + device_info = async_get_device_info(self._hass, zha_device) + self._hass.async_create_task(zha_device.async_unsub_dispatcher()) async_dispatcher_send( self._hass, - "{}_{}".format(SIGNAL_REMOVE, str(device.ieee)) + "{}_{}".format(SIGNAL_REMOVE, str(zha_device.ieee)) ) if device_info is not None: async_dispatcher_send(