Closed mcristina422 closed 3 weeks ago
I like this!
You can find the script definition here if you want to try it!
I'll note that actions don't have their own classes (yet); I planned on doing this but didn't get around to it.
You can see a good example of how actions are called here https://github.com/LocalBytes/localdeck-config/blob/9fa3704d7e8937e87561d747afbc43a770fdb94b/packages/localdeck-codegen/src/virtuals/configured-button.ts#L132-L145
After working with this device for a couple hours, I wanted to optimize some of the larger parts of the config.
I first attempted to implement blip_light as a pure lambda, but I cant quite figure out what's wrong with it yet, I'm new to esphome component dev.
Not working code
Any pointers on how to properly target the ledstrip as a range? [This seems useful](https://esphome.io/api/classesphome_1_1light_1_1_addressable_light) for selecting a range? Not sure how to use it ```yaml - lambda: |- for (float i = 1.0; i > 0; i-=0.05) { ESP_LOGI("set_led_rgb", "Blip light %f", i); auto call = id(ledstrip).make_call(); call.set_transition_length(0); call.set_rgb(i, i, i); call.perform(); delay(25); } ``` I'm intentionally avoiding using the light partitions, due to the [note found here](https://esphome.io/components/light/partition.html)But tangentially, a simple optimization, instead of generating a 20 element array in the codegen, simply use the esphome repeat component. My simplified script, tested by manually updating the generated YAML:
I attempted to add this to the codegen, but failed to find repeat in the typescript. So the change is a bit more invoved in a codebase I'm not familiar with.
The original codegen output: https://github.com/LocalBytes/localdeck-config/blob/9fa3704d7e8937e87561d747afbc43a770fdb94b/packages/localdeck-codegen/esphome-localdeck.yaml#L1165-L1350