mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 15:17:35 +00:00
Eagerly remove MQTT entities on reload (#118213)
This commit is contained in:
parent
e6142985a5
commit
cfc2cadb77
@ -38,6 +38,7 @@ from homeassistant.helpers.service import async_register_admin_service
|
|||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import async_get_integration, async_get_loaded_integration
|
from homeassistant.loader import async_get_integration, async_get_loaded_integration
|
||||||
from homeassistant.setup import SetupPhases, async_pause_setup
|
from homeassistant.setup import SetupPhases, async_pause_setup
|
||||||
|
from homeassistant.util.async_ import create_eager_task
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
from . import debug_info, discovery
|
from . import debug_info, discovery
|
||||||
@ -393,9 +394,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
# Reload the modern yaml platforms
|
# Reload the modern yaml platforms
|
||||||
mqtt_platforms = async_get_platforms(hass, DOMAIN)
|
mqtt_platforms = async_get_platforms(hass, DOMAIN)
|
||||||
tasks = [
|
tasks = [
|
||||||
entity.async_remove()
|
create_eager_task(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 list(mqtt_platform.entities.values())
|
||||||
if getattr(entity, "_discovery_data", None) is None
|
if getattr(entity, "_discovery_data", None) is None
|
||||||
and mqtt_platform.config_entry
|
and mqtt_platform.config_entry
|
||||||
and mqtt_platform.domain in RELOADABLE_PLATFORMS
|
and mqtt_platform.domain in RELOADABLE_PLATFORMS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user