From 0134ee9305f975dcf2961b2137ea634548e07928 Mon Sep 17 00:00:00 2001 From: Jan Bouwhuis Date: Tue, 18 Jul 2023 10:50:34 +0200 Subject: [PATCH] Fix incorrect leagacy code tweak for MQTT (#96812) Cleanup mqtt_data_updated_config --- homeassistant/components/mqtt/__init__.py | 2 +- homeassistant/components/mqtt/mixins.py | 7 +------ homeassistant/components/mqtt/models.py | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/mqtt/__init__.py b/homeassistant/components/mqtt/__init__.py index 3fb6c8d2c48..de5093d1817 100644 --- a/homeassistant/components/mqtt/__init__.py +++ b/homeassistant/components/mqtt/__init__.py @@ -336,7 +336,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: """Reload the platforms.""" # Fetch updated manual configured items and validate config_yaml = await async_integration_yaml_config(hass, DOMAIN) or {} - mqtt_data.updated_config = config_yaml.get(DOMAIN, {}) + mqtt_data.config = config_yaml.get(DOMAIN, {}) # Reload the modern yaml platforms mqtt_platforms = async_get_platforms(hass, DOMAIN) diff --git a/homeassistant/components/mqtt/mixins.py b/homeassistant/components/mqtt/mixins.py index 34b61d89c48..e1e5f3d61bb 100644 --- a/homeassistant/components/mqtt/mixins.py +++ b/homeassistant/components/mqtt/mixins.py @@ -307,12 +307,7 @@ async def async_setup_entry_helper( async def _async_setup_entities() -> None: """Set up MQTT items from configuration.yaml.""" mqtt_data = get_mqtt_data(hass) - if mqtt_data.updated_config: - # The platform has been reloaded - config_yaml = mqtt_data.updated_config - else: - config_yaml = mqtt_data.config or {} - if not config_yaml: + if not (config_yaml := mqtt_data.config): return if domain not in config_yaml: return diff --git a/homeassistant/components/mqtt/models.py b/homeassistant/components/mqtt/models.py index aeae184dc89..9f0a178ce87 100644 --- a/homeassistant/components/mqtt/models.py +++ b/homeassistant/components/mqtt/models.py @@ -313,4 +313,3 @@ class MqttData: state_write_requests: EntityTopicState = field(default_factory=EntityTopicState) subscriptions_to_restore: list[Subscription] = field(default_factory=list) tags: dict[str, dict[str, MQTTTagScanner]] = field(default_factory=dict) - updated_config: ConfigType = field(default_factory=dict)