From 83ccdc36cda328f5b35746922416fc9e8cdb550d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 21 Feb 2026 21:26:31 -0600 Subject: [PATCH] deferred --- esphome/automation.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/esphome/automation.py b/esphome/automation.py index 99260437112..d9b8b2ec574 100644 --- a/esphome/automation.py +++ b/esphome/automation.py @@ -481,6 +481,11 @@ async def wait_until_action_to_code( return var +# Lambda executes user C++ inline and returns — synchronous by execution model. +# User code could theoretically store the StringRef for deferred use, but StringRef +# is a view type and storing views beyond their scope is always unsafe regardless +# of this optimization. Marking non-synchronous would disable StringRef for nearly +# all user services since most use lambda. @register_action("lambda", LambdaAction, cv.lambda_, synchronous=True) async def lambda_action_to_code( config: ConfigType,