How would I do this in ESP-Home lambda?
{% set values = {"a": "foo", "b": "bar", "c": "foobar"} %}
{{ values["a"] }}
How would I do this in ESP-Home lambda?
{% set values = {"a": "foo", "b": "bar", "c": "foobar"} %}
{{ values["a"] }}
Found one example in my collection:
script:
- id: toggle_light
parameters:
light_id: int
then:
- lambda: |-
static std::map<int, light::LightState*> light_map {
{ 1, id(led1) },
{ 2, id(led2) }
};
auto it = light_map.find(light_id);
if (it != light_map.end())
it->second->toggle()
.set_brightness(0.5)
.perform();
I’ll give that a try!
Thank you!