Small cleanup of MQTT mixins (#66812)

pull/66820/head
Erik Montnemery 2022-02-18 16:51:14 +01:00 committed by GitHub
parent faf854190d
commit fcf774ecfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -839,12 +839,11 @@ def async_removed_from_device(
if "config_entries" not in event.data["changes"]:
return False
device_registry = dr.async_get(hass)
device_entry = device_registry.async_get(mqtt_device_id)
device_entry = device_registry.async_get(device_id)
if not device_entry:
# The device is already removed, do cleanup when we get "remove" event
return False
entry_id = config_entry_id
if entry_id in device_entry.config_entries:
if config_entry_id in device_entry.config_entries:
# Not removed from device
return False