mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Refactor mqtt entity cleanup on reload (#102375)
This commit is contained in:
parent
5ff6779f5c
commit
1bd0b2d05f
@ -426,9 +426,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
entity.async_remove()
|
entity.async_remove()
|
||||||
for mqtt_platform in mqtt_platforms
|
for mqtt_platform in mqtt_platforms
|
||||||
for entity in mqtt_platform.entities.values()
|
for entity in mqtt_platform.entities.values()
|
||||||
# pylint: disable-next=protected-access
|
if getattr(entity, "_discovery_data", None) is None
|
||||||
if not entity._discovery_data # type: ignore[attr-defined]
|
and mqtt_platform.config_entry
|
||||||
if mqtt_platform.config_entry
|
|
||||||
and mqtt_platform.domain in RELOADABLE_PLATFORMS
|
and mqtt_platform.domain in RELOADABLE_PLATFORMS
|
||||||
]
|
]
|
||||||
await asyncio.gather(*tasks)
|
await asyncio.gather(*tasks)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user