From 427940f626cb67579af53e25639f40197e72c359 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 24 Feb 2026 22:33:20 -0600 Subject: [PATCH] Add comment explaining empty capture in effect lambda wrapper --- esphome/components/light/automation.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/esphome/components/light/automation.py b/esphome/components/light/automation.py index bd4300d149..3bf38360d2 100644 --- a/esphome/components/light/automation.py +++ b/esphome/components/light/automation.py @@ -194,6 +194,9 @@ async def light_control_to_code(config, action_id, template_arg, args): config[CONF_EFFECT], args, return_type=cg.std_string ) fwd_args = ", ".join(n for _, n in args) + # capture="" is correct: paren is a global variable name + # string-interpolated into the body at codegen time, not a + # C++ runtime capture. wrapper = LambdaExpression( f"auto __effect_s = ({inner_lambda})({fwd_args});\n" f"return {paren}->get_effect_index("