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
This commit is contained in:
Marcel van der Veldt 2020-07-08 09:52:03 +02:00 committed by GitHub
parent ad025f0b3b
commit adc88deaa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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