[core] Store the validated-config cache as JSON to drop YAML off the upload fast path (#18106)

This commit is contained in:
J. Nick Koston
2026-08-10 17:26:41 +12:00
committed by GitHub
parent 3de8c7f95c
commit 0f59ef36a9
8 changed files with 459 additions and 105 deletions
+8 -4
View File
@@ -321,14 +321,18 @@ LAMBDA_PROG = re.compile(r"\bid\(\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\)(\.?)")
class Lambda:
def __init__(self, value):
from esphome.cpp_generator import Expression, statement
# pylint: disable=protected-access
if isinstance(value, Lambda):
self._value = value._value
elif isinstance(value, Expression):
self._value = str(statement(value))
elif isinstance(value, str):
# The validated-config cache revives Lambdas from strings on the
# upload/logs fast path; keep codegen off that path.
self._value = value
else:
from esphome.cpp_generator import Expression, statement
if isinstance(value, Expression):
value = str(statement(value))
self._value = value
self._parts = None
self._requires_ids = None