diff --git a/esphome/core/automation.h b/esphome/core/automation.h index 3cb8caa026..72bcc3d707 100644 --- a/esphome/core/automation.h +++ b/esphome/core/automation.h @@ -430,8 +430,13 @@ template class ActionList { } } void add_actions(const std::initializer_list *> &actions) { + // Find tail once, then append all actions in a single pass + Action **tail = &this->actions_begin_; + while (*tail != nullptr) + tail = &(*tail)->next_; for (auto *action : actions) { - this->add_action(action); + *tail = action; + tail = &action->next_; } } // Force-inline: part of the Trigger→Automation→ActionList forwarding