From 810f22e8c9b908637c03bf5e0026faf04daba647 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 7 Apr 2026 15:39:31 -1000 Subject: [PATCH] [sprinkler] Use TemplatableValue for valve_to_start (set from C++ with raw value) valve_to_start is set from both codegen (lambdas) and C++ code (raw size_t in sprinkler.cpp:387). Use TemplatableValue directly instead of the TEMPLATABLE_VALUE macro since TemplatableFn doesn't accept raw runtime values. --- esphome/components/sprinkler/automation.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esphome/components/sprinkler/automation.h b/esphome/components/sprinkler/automation.h index b3f030805dd..ed091ac5d71 100644 --- a/esphome/components/sprinkler/automation.h +++ b/esphome/components/sprinkler/automation.h @@ -108,7 +108,9 @@ template class StartSingleValveAction : public Action { public: explicit StartSingleValveAction(Sprinkler *a_sprinkler) : sprinkler_(a_sprinkler) {} - TEMPLATABLE_VALUE(size_t, valve_to_start) + // valve_to_start uses TemplatableValue (not TemplatableFn) because it is set + // from both codegen (lambdas) and C++ (raw values in sprinkler.cpp). + template void set_valve_to_start(V valve_to_start) { this->valve_to_start_ = valve_to_start; } TEMPLATABLE_VALUE(uint32_t, valve_run_duration) void play(const Ts &...x) override { @@ -118,6 +120,7 @@ template class StartSingleValveAction : public Action { protected: Sprinkler *sprinkler_; + TemplatableValue valve_to_start_{}; }; template class ShutdownAction : public Action {