|
1 | 1 | --- |
2 | 2 | substitutions: |
3 | | - led_count: '9' |
| 3 | + led_count: "17" # Match the max_value from filament_slots |
4 | 4 | light: |
5 | | -- platform: esp32_rmt_led_strip |
6 | | - name: LEDs |
7 | | - id: neopixel_light |
8 | | - state_topic: |
9 | | - pin: ${led_pin} |
10 | | - num_leds: ${led_count} |
11 | | - rgb_order: GRB |
12 | | - chipset: WS2812 |
13 | | - default_transition_length: 0.4s |
14 | | - restore_mode: RESTORE_DEFAULT_ON |
15 | | - entity_category: diagnostic |
16 | | - icon: mdi:led-strip |
17 | | - effects: |
18 | | - - addressable_rainbow: |
19 | | - name: Rainbow |
20 | | - speed: 25 |
21 | | - width: 15 |
22 | | - - addressable_lambda: |
23 | | - name: Breathing Blue |
24 | | - update_interval: 10ms |
25 | | - lambda: |- |
26 | | - static float b = 0; |
27 | | - b = (sin(millis() / 500.0) + 1.0) / 2.0 * 0.6 + 0.4; |
28 | | - auto color = esphome::light::ESPColor(0, 0, uint8_t(255 * b)); |
29 | | - it.all() = color; |
30 | | - - addressable_lambda: |
31 | | - name: Apple Breathing |
32 | | - update_interval: 10ms |
33 | | - lambda: |- |
34 | | - const float PI = 3.14159265359; |
35 | | - //TODO: 42.546 should be replaced by 83.333 |
36 | | - float t = millis() / 2000.0; |
37 | | - float brightness_float = (exp(sin(t * PI)) - 0.368) * 42.546; |
38 | | - uint8_t brightness = uint8_t(brightness_float); |
39 | | - auto color = esphome::light::ESPColor(brightness, 0, 0); |
40 | | - for (int i = 0; i < it.size(); ++i) { |
41 | | - it[i] = color; |
42 | | - } |
43 | | - # - strobe: |
44 | | - # name: "Data Upload" |
45 | | - # colors: |
46 | | - # - state: TRUE |
47 | | - # brightness: 100% |
48 | | - # duration: 50ms |
49 | | - # red: 0% |
50 | | - # green: 100% |
51 | | - # blue: 0% |
52 | | - # - state: FALSE |
53 | | - # duration: 50ms |
| 5 | + - platform: esp32_rmt_led_strip |
| 6 | + name: LEDs |
| 7 | + id: neopixel_light |
| 8 | + state_topic: |
| 9 | + pin: ${led_pin} |
| 10 | + num_leds: ${led_count} |
| 11 | + rgb_order: GRB |
| 12 | + chipset: WS2812 |
| 13 | + default_transition_length: 0.4s |
| 14 | + restore_mode: RESTORE_DEFAULT_ON |
| 15 | + entity_category: diagnostic |
| 16 | + icon: mdi:led-strip |
| 17 | + effects: |
| 18 | + - addressable_rainbow: |
| 19 | + name: Rainbow |
| 20 | + speed: 25 |
| 21 | + width: 15 |
| 22 | + - addressable_lambda: |
| 23 | + name: Breathing Blue |
| 24 | + update_interval: 10ms |
| 25 | + lambda: |- |
| 26 | + static float b = 0; |
| 27 | + b = (sin(millis() / 500.0) + 1.0) / 2.0 * 0.6 + 0.4; |
| 28 | + auto color = esphome::light::ESPColor(0, 0, uint8_t(255 * b)); |
| 29 | + it.all() = color; |
| 30 | + - addressable_lambda: |
| 31 | + name: Apple Breathing |
| 32 | + update_interval: 10ms |
| 33 | + lambda: |- |
| 34 | + const float PI = 3.14159265359; |
| 35 | + //TODO: 42.546 should be replaced by 83.333 |
| 36 | + float t = millis() / 2000.0; |
| 37 | + float brightness_float = (exp(sin(t * PI)) - 0.368) * 42.546; |
| 38 | + uint8_t brightness = uint8_t(brightness_float); |
| 39 | + auto color = esphome::light::ESPColor(brightness, 0, 0); |
| 40 | + for (int i = 0; i < it.size(); ++i) { |
| 41 | + it[i] = color; |
| 42 | + } |
| 43 | + # - strobe: |
| 44 | + # name: "Data Upload" |
| 45 | + # colors: |
| 46 | + # - state: TRUE |
| 47 | + # brightness: 100% |
| 48 | + # duration: 50ms |
| 49 | + # red: 0% |
| 50 | + # green: 100% |
| 51 | + # blue: 0% |
| 52 | + # - state: FALSE |
| 53 | + # duration: 50ms |
54 | 54 | script: |
55 | | -- id: set_led_red |
56 | | - parameters: |
57 | | - led_number: int8_t |
58 | | - then: |
59 | | - - light.addressable_set: |
60 | | - id: neopixel_light |
61 | | - color_brightness: 100% |
62 | | - range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
63 | | - range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
64 | | - red: 100% |
65 | | - green: 0% |
66 | | - blue: 0% |
67 | | -- id: set_led_green |
68 | | - parameters: |
69 | | - led_number: int8_t |
70 | | - then: |
71 | | - - light.addressable_set: |
72 | | - id: neopixel_light |
73 | | - color_brightness: 100% |
74 | | - range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
75 | | - range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
76 | | - red: 0% |
77 | | - green: 100% |
78 | | - blue: 0% |
79 | | -- id: set_led_blue |
80 | | - parameters: |
81 | | - led_number: int8_t |
82 | | - then: |
83 | | - - light.addressable_set: |
84 | | - id: neopixel_light |
85 | | - color_brightness: 100% |
86 | | - range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
87 | | - range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
88 | | - red: 0% |
89 | | - green: 0% |
90 | | - blue: 100% |
91 | | -- id: set_led_yellow |
92 | | - parameters: |
93 | | - led_number: int8_t |
94 | | - then: |
95 | | - - light.addressable_set: |
96 | | - id: neopixel_light |
97 | | - color_brightness: 100% |
98 | | - range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
99 | | - range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
100 | | - red: 100% |
101 | | - green: 100% |
102 | | - blue: 0% |
103 | | -- id: set_led_white |
104 | | - parameters: |
105 | | - led_number: int8_t |
106 | | - then: |
107 | | - - light.addressable_set: |
108 | | - id: neopixel_light |
109 | | - color_brightness: 50% |
110 | | - range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
111 | | - range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
112 | | - red: 100% |
113 | | - green: 100% |
114 | | - blue: 100% |
115 | | -- id: set_all_leds_white |
116 | | - then: |
117 | | - - light.turn_on: |
118 | | - id: neopixel_light |
119 | | - effect: none |
120 | | - brightness: 50% |
121 | | - red: 100% |
122 | | - green: 100% |
123 | | - blue: 100% |
124 | | -- id: set_led_off |
125 | | - then: |
126 | | - - light.turn_on: |
127 | | - id: neopixel_light |
128 | | - brightness: 0% |
129 | | - red: 0% |
130 | | - green: 0% |
131 | | - blue: 0% |
132 | | - effect: none |
133 | | - - delay: 50ms |
134 | | - - light.turn_off: |
135 | | - id: neopixel_light |
136 | | - transition_length: 0s |
137 | | -- id: set_led_rainbow |
138 | | - then: |
139 | | - - light.turn_on: |
140 | | - id: neopixel_light |
141 | | - effect: Rainbow |
142 | | -- id: set_led_breathing_blue |
143 | | - then: |
144 | | - - light.turn_on: |
145 | | - id: neopixel_light |
146 | | - effect: none |
147 | | - - light.turn_on: |
148 | | - id: neopixel_light |
149 | | - effect: Breathing Blue |
150 | | - brightness: 100% |
151 | | -- id: set_led_breathing_green |
152 | | - then: |
153 | | - - light.turn_on: |
154 | | - id: neopixel_light |
155 | | - effect: Breathing Green |
156 | | - brightness: 100% |
157 | | -- id: set_led_apple_breathing |
158 | | - then: |
159 | | - - light.turn_on: |
160 | | - id: neopixel_light |
161 | | - effect: Apple Breathing |
162 | | - brightness: 100% |
| 55 | + - id: set_led_red |
| 56 | + parameters: |
| 57 | + led_number: int8_t |
| 58 | + then: |
| 59 | + - light.addressable_set: |
| 60 | + id: neopixel_light |
| 61 | + color_brightness: 50% |
| 62 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 63 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 64 | + red: 100% |
| 65 | + green: 0% |
| 66 | + blue: 0% |
| 67 | + - id: set_led_green |
| 68 | + parameters: |
| 69 | + led_number: int8_t |
| 70 | + then: |
| 71 | + - light.addressable_set: |
| 72 | + id: neopixel_light |
| 73 | + color_brightness: 50% |
| 74 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 75 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 76 | + red: 0% |
| 77 | + green: 100% |
| 78 | + blue: 0% |
| 79 | + - id: set_led_blue |
| 80 | + parameters: |
| 81 | + led_number: int8_t |
| 82 | + then: |
| 83 | + - light.addressable_set: |
| 84 | + id: neopixel_light |
| 85 | + color_brightness: 50% |
| 86 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 87 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 88 | + red: 0% |
| 89 | + green: 0% |
| 90 | + blue: 100% |
| 91 | + - id: set_led_cyan |
| 92 | + parameters: |
| 93 | + led_number: int8_t |
| 94 | + then: |
| 95 | + - light.addressable_set: |
| 96 | + id: neopixel_light |
| 97 | + color_brightness: 50% |
| 98 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 99 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 100 | + red: 0% |
| 101 | + green: 100% |
| 102 | + blue: 100% |
| 103 | + - id: set_led_magenta |
| 104 | + parameters: |
| 105 | + led_number: int8_t |
| 106 | + then: |
| 107 | + - light.addressable_set: |
| 108 | + id: neopixel_light |
| 109 | + color_brightness: 50% |
| 110 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 111 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 112 | + red: 100% |
| 113 | + green: 0% |
| 114 | + blue: 100% |
| 115 | + - id: set_led_yellow |
| 116 | + parameters: |
| 117 | + led_number: int8_t |
| 118 | + then: |
| 119 | + - light.addressable_set: |
| 120 | + id: neopixel_light |
| 121 | + color_brightness: 50% |
| 122 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 123 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 124 | + red: 100% |
| 125 | + green: 100% |
| 126 | + blue: 0% |
| 127 | + - id: set_led_white |
| 128 | + parameters: |
| 129 | + led_number: int8_t |
| 130 | + then: |
| 131 | + - light.addressable_set: |
| 132 | + id: neopixel_light |
| 133 | + color_brightness: 50% |
| 134 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 135 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 136 | + red: 100% |
| 137 | + green: 100% |
| 138 | + blue: 100% |
| 139 | + - id: set_led_off |
| 140 | + parameters: |
| 141 | + led_number: int8_t |
| 142 | + then: |
| 143 | + - light.addressable_set: |
| 144 | + id: neopixel_light |
| 145 | + range_from: !lambda "return led_number < 0 ? 0 : led_number;" |
| 146 | + range_to: !lambda "return led_number < 0 ? ${led_count} : led_number;" |
| 147 | + red: 0% |
| 148 | + green: 0% |
| 149 | + blue: 0% |
| 150 | + - id: set_leds_white |
| 151 | + then: |
| 152 | + - light.turn_on: |
| 153 | + id: neopixel_light |
| 154 | + effect: none |
| 155 | + brightness: 50% |
| 156 | + red: 100% |
| 157 | + green: 100% |
| 158 | + blue: 100% |
| 159 | + - id: set_leds_off |
| 160 | + then: |
| 161 | + - light.turn_off: |
| 162 | + id: neopixel_light |
| 163 | + transition_length: 0s |
| 164 | + - id: set_led_rainbow |
| 165 | + then: |
| 166 | + - light.turn_on: |
| 167 | + id: neopixel_light |
| 168 | + effect: Rainbow |
| 169 | + - id: set_led_breathing_blue |
| 170 | + then: |
| 171 | + - light.turn_on: |
| 172 | + id: neopixel_light |
| 173 | + effect: none |
| 174 | + - light.turn_on: |
| 175 | + id: neopixel_light |
| 176 | + effect: Breathing Blue |
| 177 | + brightness: 100% |
| 178 | + - id: set_led_breathing_green |
| 179 | + then: |
| 180 | + - light.turn_on: |
| 181 | + id: neopixel_light |
| 182 | + effect: Breathing Green |
| 183 | + brightness: 100% |
| 184 | + - id: set_led_apple_breathing |
| 185 | + then: |
| 186 | + - light.turn_on: |
| 187 | + id: neopixel_light |
| 188 | + effect: Apple Breathing |
| 189 | + brightness: 100% |
0 commit comments