mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	[template] Eliminate optional wrapper to save 4 bytes RAM per instance (#11610)
This commit is contained in:
		| @@ -9,6 +9,13 @@ esphome: | ||||
|         id: template_sens | ||||
|         state: !lambda "return 42.0;" | ||||
|  | ||||
|     # Test C++ API: set_template() with stateless lambda (no captures) | ||||
|     # NOTE: set_template() is not intended to be a public API, but we test it to ensure it doesn't break. | ||||
|     - lambda: |- | ||||
|         id(template_sens).set_template([]() -> esphome::optional<float> { | ||||
|           return 123.0f; | ||||
|         }); | ||||
|  | ||||
|     - datetime.date.set: | ||||
|         id: test_date | ||||
|         date: | ||||
| @@ -215,6 +222,7 @@ cover: | ||||
|  | ||||
| number: | ||||
|   - platform: template | ||||
|     id: template_number | ||||
|     name: "Template number" | ||||
|     optimistic: true | ||||
|     min_value: 0 | ||||
|   | ||||
| @@ -32,6 +32,7 @@ switch: | ||||
|     name: "Test Switch" | ||||
|     id: test_switch | ||||
|     optimistic: true | ||||
|     lambda: return false; | ||||
|  | ||||
| interval: | ||||
|   - interval: 0.5s | ||||
|   | ||||
		Reference in New Issue
	
	Block a user