mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Fix incorrect leagacy code tweak for MQTT (#96812)
Cleanup mqtt_data_updated_config
This commit is contained in:
parent
aa13082ce0
commit
0134ee9305
@ -336,7 +336,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
"""Reload the platforms."""
|
"""Reload the platforms."""
|
||||||
# Fetch updated manual configured items and validate
|
# Fetch updated manual configured items and validate
|
||||||
config_yaml = await async_integration_yaml_config(hass, DOMAIN) or {}
|
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
|
# Reload the modern yaml platforms
|
||||||
mqtt_platforms = async_get_platforms(hass, DOMAIN)
|
mqtt_platforms = async_get_platforms(hass, DOMAIN)
|
||||||
|
@ -307,12 +307,7 @@ async def async_setup_entry_helper(
|
|||||||
async def _async_setup_entities() -> None:
|
async def _async_setup_entities() -> None:
|
||||||
"""Set up MQTT items from configuration.yaml."""
|
"""Set up MQTT items from configuration.yaml."""
|
||||||
mqtt_data = get_mqtt_data(hass)
|
mqtt_data = get_mqtt_data(hass)
|
||||||
if mqtt_data.updated_config:
|
if not (config_yaml := mqtt_data.config):
|
||||||
# The platform has been reloaded
|
|
||||||
config_yaml = mqtt_data.updated_config
|
|
||||||
else:
|
|
||||||
config_yaml = mqtt_data.config or {}
|
|
||||||
if not config_yaml:
|
|
||||||
return
|
return
|
||||||
if domain not in config_yaml:
|
if domain not in config_yaml:
|
||||||
return
|
return
|
||||||
|
@ -313,4 +313,3 @@ class MqttData:
|
|||||||
state_write_requests: EntityTopicState = field(default_factory=EntityTopicState)
|
state_write_requests: EntityTopicState = field(default_factory=EntityTopicState)
|
||||||
subscriptions_to_restore: list[Subscription] = field(default_factory=list)
|
subscriptions_to_restore: list[Subscription] = field(default_factory=list)
|
||||||
tags: dict[str, dict[str, MQTTTagScanner]] = field(default_factory=dict)
|
tags: dict[str, dict[str, MQTTTagScanner]] = field(default_factory=dict)
|
||||||
updated_config: ConfigType = field(default_factory=dict)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user