From adc88deaa85710d7dfb9730be1b428cf6eb7f3b8 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Wed, 8 Jul 2020 09:52:03 +0200 Subject: [PATCH] Fix ozw entities cleanup on node removal (#37630) * fix hass cleanup on node removal also detect removefailednode command to issue a full cleanup * satisfy pylint --- homeassistant/components/ozw/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/ozw/__init__.py b/homeassistant/components/ozw/__init__.py index 3a7d35ddd1d..e7f6e0d3587 100644 --- a/homeassistant/components/ozw/__init__.py +++ b/homeassistant/components/ozw/__init__.py @@ -101,7 +101,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): _LOGGER.debug("[INSTANCE EVENT]: %s - data: %s", event, event_data) # The actual removal action of a Z-Wave node is reported as instance event # Only when this event is detected we cleanup the device and entities from hass - if event == "removenode" and "Node" in event_data: + # Note: Find a more elegant way of doing this, e.g. a notification of this event from OZW + if event in ["removenode", "removefailednode"] and "Node" in event_data: removed_nodes.append(event_data["Node"]) @callback