[template] Conditionally compile select set_trigger

Only allocate the set_trigger when set_action is configured.
This saves ~20-24 bytes of heap per template select that doesn't
use set_action.
This commit is contained in:
J. Nick Koston
2026-02-01 20:37:34 +01:00
parent 1ff2f3b6a3
commit e62a87afe1
4 changed files with 17 additions and 0 deletions

View File

@@ -296,6 +296,16 @@ select:
// Migration guide: Store in std::string
std::string stored_option(id(template_select).current_option());
ESP_LOGI("test", "Stored: %s", stored_option.c_str());
- platform: template
id: template_select_with_action
name: "Template select with action"
options:
- option_a
- option_b
set_action:
- logger.log:
format: "Selected: %s"
args: ["x.c_str()"]
lock:
- platform: template