From 30e6d7a3c80e4b96709db9cffb298708eb8897d9 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 29 Oct 2025 16:53:13 -0500 Subject: [PATCH] remove enable_loops, not needed since setup runs after setters, since setters are called in main setup() before component setup() --- .../template/binary_sensor/template_binary_sensor.h | 5 +---- esphome/components/template/cover/template_cover.h | 10 ++-------- esphome/components/template/lock/template_lock.h | 5 +---- esphome/components/template/switch/template_switch.h | 5 +---- esphome/components/template/valve/template_valve.h | 5 +---- 5 files changed, 6 insertions(+), 24 deletions(-) diff --git a/esphome/components/template/binary_sensor/template_binary_sensor.h b/esphome/components/template/binary_sensor/template_binary_sensor.h index 0373f898a8..bc591391b9 100644 --- a/esphome/components/template/binary_sensor/template_binary_sensor.h +++ b/esphome/components/template/binary_sensor/template_binary_sensor.h @@ -9,10 +9,7 @@ namespace template_ { class TemplateBinarySensor : public Component, public binary_sensor::BinarySensor { public: - template void set_template(F &&f) { - this->f_.set(std::forward(f)); - this->enable_loop(); - } + template void set_template(F &&f) { this->f_.set(std::forward(f)); } void setup() override; void loop() override; diff --git a/esphome/components/template/cover/template_cover.h b/esphome/components/template/cover/template_cover.h index 56ab61c3fb..faff69f867 100644 --- a/esphome/components/template/cover/template_cover.h +++ b/esphome/components/template/cover/template_cover.h @@ -18,14 +18,8 @@ class TemplateCover : public cover::Cover, public Component { public: TemplateCover(); - template void set_state_lambda(F &&f) { - this->state_f_.set(std::forward(f)); - this->enable_loop(); - } - template void set_tilt_lambda(F &&f) { - this->tilt_f_.set(std::forward(f)); - this->enable_loop(); - } + template void set_state_lambda(F &&f) { this->state_f_.set(std::forward(f)); } + template void set_tilt_lambda(F &&f) { this->tilt_f_.set(std::forward(f)); } Trigger<> *get_open_trigger() const; Trigger<> *get_close_trigger() const; Trigger<> *get_stop_trigger() const; diff --git a/esphome/components/template/lock/template_lock.h b/esphome/components/template/lock/template_lock.h index 347c4effb3..de5189875f 100644 --- a/esphome/components/template/lock/template_lock.h +++ b/esphome/components/template/lock/template_lock.h @@ -14,10 +14,7 @@ class TemplateLock : public lock::Lock, public Component { void dump_config() override; - template void set_state_lambda(F &&f) { - this->f_.set(std::forward(f)); - this->enable_loop(); - } + template void set_state_lambda(F &&f) { this->f_.set(std::forward(f)); } Trigger<> *get_lock_trigger() const; Trigger<> *get_unlock_trigger() const; Trigger<> *get_open_trigger() const; diff --git a/esphome/components/template/switch/template_switch.h b/esphome/components/template/switch/template_switch.h index 47154fd047..18a374df35 100644 --- a/esphome/components/template/switch/template_switch.h +++ b/esphome/components/template/switch/template_switch.h @@ -15,10 +15,7 @@ class TemplateSwitch : public switch_::Switch, public Component { void setup() override; void dump_config() override; - template void set_state_lambda(F &&f) { - this->f_.set(std::forward(f)); - this->enable_loop(); - } + template void set_state_lambda(F &&f) { this->f_.set(std::forward(f)); } Trigger<> *get_turn_on_trigger() const; Trigger<> *get_turn_off_trigger() const; void set_optimistic(bool optimistic); diff --git a/esphome/components/template/valve/template_valve.h b/esphome/components/template/valve/template_valve.h index 23a77ff918..d6235f8e5c 100644 --- a/esphome/components/template/valve/template_valve.h +++ b/esphome/components/template/valve/template_valve.h @@ -18,10 +18,7 @@ class TemplateValve : public valve::Valve, public Component { public: TemplateValve(); - template void set_state_lambda(F &&f) { - this->state_f_.set(std::forward(f)); - this->enable_loop(); - } + template void set_state_lambda(F &&f) { this->state_f_.set(std::forward(f)); } Trigger<> *get_open_trigger() const; Trigger<> *get_close_trigger() const; Trigger<> *get_stop_trigger() const;