Remove redundant lock and template checks in MQTT (#191804)

This commit is contained in:
epenet
2026-11-10 14:14:43 +01:00
committed by GitHub
parent 57b769dcf6
commit 7eacffcb83
2 changed files with 2 additions and 5 deletions
+1 -4
View File
@@ -8,7 +8,7 @@ from itertools import chain
import logging
import re
import time
from typing import TYPE_CHECKING, Any
from typing import Any
import probatio
@@ -901,9 +901,6 @@ async def async_start( # noqa: C901
msg.payload,
)
return
if TYPE_CHECKING:
assert mqtt_data.data_config_flow_lock
# Lock to prevent initiating many parallel config flows.
# Note: The lock is not intended to prevent a race, only for performance
async with mqtt_data.data_config_flow_lock:
+1 -1
View File
@@ -440,7 +440,7 @@ class MqttValueTemplate:
values[ATTR_ENTITY_ID] = self._entity.entity_id
values[ATTR_NAME] = self._entity.name
# Created again when the entity_id is changed in place
if self._value_template.hass and (
if (
not self._template_state
or self._template_state.entity_id != self._entity.entity_id
):