Fix incorrect leagacy code tweak for MQTT (#96812)

Cleanup mqtt_data_updated_config
This commit is contained in:
Jan Bouwhuis 2023-07-18 10:50:34 +02:00 committed by GitHub
parent aa13082ce0
commit 0134ee9305
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 8 deletions

View File

@ -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)

View File

@ -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

View File

@ -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)