Fire event_mqtt_reloaded only after reload is completed (#74226)

This commit is contained in:
Erik Montnemery 2022-06-30 19:15:25 +02:00 committed by GitHub
parent 1bdd93cc77
commit f05b4a0ca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 96 additions and 123 deletions

View file

@ -41,8 +41,8 @@ from .mixins import (
MQTT_ENTITY_COMMON_SCHEMA,
MqttAvailability,
MqttEntity,
async_discover_yaml_entities,
async_setup_entry_helper,
async_setup_platform_discovery,
async_setup_platform_helper,
warn_for_legacy_schema,
)
@ -102,9 +102,7 @@ async def async_setup_entry(
) -> None:
"""Set up MQTT binary sensor through configuration.yaml and dynamically through MQTT discovery."""
# load and initialize platform config from configuration.yaml
config_entry.async_on_unload(
await async_setup_platform_discovery(hass, binary_sensor.DOMAIN)
)
await async_discover_yaml_entities(hass, binary_sensor.DOMAIN)
# setup for discovery
setup = functools.partial(
_async_setup_entity, hass, async_add_entities, config_entry=config_entry