mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
parent
8d4569ff55
commit
afa4e76248
@ -1347,15 +1347,12 @@ def async_removed_from_device(
|
|||||||
config_entry_id: str,
|
config_entry_id: str,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Check if the passed event indicates MQTT was removed from a device."""
|
"""Check if the passed event indicates MQTT was removed from a device."""
|
||||||
if event.data["action"] not in ("remove", "update"):
|
|
||||||
return False
|
|
||||||
|
|
||||||
if event.data["action"] == "update":
|
if event.data["action"] == "update":
|
||||||
if "config_entries" not in event.data["changes"]:
|
if "config_entries" not in event.data["changes"]:
|
||||||
return False
|
return False
|
||||||
device_registry = dr.async_get(hass)
|
device_registry = dr.async_get(hass)
|
||||||
if (
|
if (
|
||||||
device_entry := device_registry.async_get(event.data["device_id"])
|
device_entry := device_registry.async_get(mqtt_device_id)
|
||||||
) and config_entry_id in device_entry.config_entries:
|
) and config_entry_id in device_entry.config_entries:
|
||||||
# Not removed from device
|
# Not removed from device
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user