From ee1da106142eb973ece2376d9d2106f0ce438ade Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 25 Mar 2026 14:32:51 -1000 Subject: [PATCH] Remove unused trigger_ back-pointer from Automation The trigger_ field was only set in the constructor and never read afterward. Removing it saves 4 bytes per Automation instance. --- esphome/core/automation.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/esphome/core/automation.h b/esphome/core/automation.h index 021e9ec68e..6e1abcef55 100644 --- a/esphome/core/automation.h +++ b/esphome/core/automation.h @@ -471,7 +471,7 @@ template class ActionList { template class Automation { public: Automation() = default; - explicit Automation(Trigger *trigger) : trigger_(trigger) { this->trigger_->set_automation_parent(this); } + explicit Automation(Trigger *trigger) { trigger->set_automation_parent(this); } void add_action(Action *action) { this->actions_.add_action(action); } void add_actions(const std::initializer_list *> &actions) { this->actions_.add_actions(actions); } @@ -488,7 +488,6 @@ template class Automation { int num_running() { return this->actions_.num_running(); } protected: - Trigger *trigger_{nullptr}; ActionList actions_; };