1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-31 07:03:55 +00:00
This commit is contained in:
J. Nick Koston
2025-10-29 16:08:27 -05:00
parent 3636ab68f3
commit f4d32c7def
16 changed files with 65 additions and 148 deletions

View File

@@ -10,26 +10,12 @@ esphome:
state: !lambda "return 42.0;"
# Test C++ API: set_template() with stateless lambda (no captures)
# IMPORTANT: set_template() is an internal API. Only stateless lambdas are supported.
- lambda: |-
id(template_sens).set_template([]() -> esphome::optional<float> {
return 123.0f;
});
# Test C++ API: set_template() with stateful lambda (with captures)
# This is the regression test for issue #11555
- lambda: |-
float captured_value = 456.0f;
id(template_sens).set_template([captured_value]() -> esphome::optional<float> {
return captured_value;
});
# Test C++ API: set_template() with more complex capture
- lambda: |-
auto sensor_id = id(template_sens);
id(template_number).set_template([sensor_id]() -> esphome::optional<float> {
return sensor_id->state * 2.0f;
});
- datetime.date.set:
id: test_date
date: