11substitutions :
22 name : apollo-btn-1
3- version : " 25.6.1.3 "
3+ version : " 25.8.21.1 "
44 device_description : ${name} made by Apollo Automation - version ${version}.
55
66esp32 :
77 board : esp32-c6-devkitm-1
88 variant : esp32c6
9- flash_size : 4MB
9+ flash_size : 8MB
1010 framework :
1111 type : esp-idf
1212
1313api :
14+ id : api_server
1415 services :
1516 - service : play_buzzer
1617 variables :
1718 song_str : string
1819 then :
1920 - rtttl.play :
2021 rtttl : !lambda 'return song_str;'
21- reboot_timeout : 0s
22- on_client_connected :
23- then :
24- - delay : 5s
25- - if :
26- condition :
27- or :
28- - binary_sensor.is_on : ota_mode
29- - switch.is_on : prevent_sleep
30- then :
31- - lambda : |-
32- ESP_LOGW("Apollo", "Preventing Deep Sleep Due To OTA Or Switch");
33- id(deep_sleep_1).prevent_deep_sleep();
34- else :
35- - lambda : |-
36- id(reportAllValues).execute();
37- - delay : 2s
38- - deep_sleep.enter :
39- id : deep_sleep_1
4022
4123globals :
4224 - id : cycleCounter
@@ -49,11 +31,14 @@ globals:
4931 initial_value : ' 0'
5032
5133captive_portal :
34+ id : captive_portal_instance
5235
5336web_server :
37+ id : web_server_instance
5438 port : 80
5539
5640i2c :
41+ id : i2c_bus
5742 sda : GPIO1
5843 scl : GPIO0
5944
@@ -199,27 +184,27 @@ binary_sensor:
199184 - ON for at most 300ms
200185 - OFF for at least 0.5s
201186 then :
202- - event.trigger :
203- id : button_1_event
204- event_type : Single Click
187+ - event.trigger :
188+ id : button_1_event
189+ event_type : Single Click
205190
206191 - timing :
207192 - ON for at most 300ms
208193 - OFF for at most 0.5s
209194 - ON for at most 300ms
210195 - OFF for at least 0.2s
211196 then :
212- - event.trigger :
213- id : button_1_event
214- event_type : Double Click
197+ - event.trigger :
198+ id : button_1_event
199+ event_type : Double Click
215200
216201 - timing :
217202 - ON for 1s to 5s
218203 - OFF for at least 0.5s
219204 then :
220- - event.trigger :
221- id : button_1_event
222- event_type : Long Press
205+ - event.trigger :
206+ id : button_1_event
207+ event_type : Long Press
223208
224209 - platform : gpio
225210 id : button_2
@@ -236,27 +221,27 @@ binary_sensor:
236221 - ON for at most 300ms
237222 - OFF for at least 0.5s
238223 then :
239- - event.trigger :
240- id : button_2_event
241- event_type : Single Click
224+ - event.trigger :
225+ id : button_2_event
226+ event_type : Single Click
242227
243228 - timing :
244229 - ON for at most 300ms
245230 - OFF for at most 0.5s
246231 - ON for at most 300ms
247232 - OFF for at least 0.2s
248233 then :
249- - event.trigger :
250- id : button_2_event
251- event_type : Double Click
234+ - event.trigger :
235+ id : button_2_event
236+ event_type : Double Click
252237
253238 - timing :
254239 - ON for 1s to 5s
255240 - OFF for at least 0.5s
256241 then :
257- - event.trigger :
258- id : button_2_event
259- event_type : Long Press
242+ - event.trigger :
243+ id : button_2_event
244+ event_type : Long Press
260245
261246 - platform : gpio
262247 id : button_3
@@ -275,27 +260,27 @@ binary_sensor:
275260 - ON for at most 300ms
276261 - OFF for at least 0.5s
277262 then :
278- - event.trigger :
279- id : button_3_event
280- event_type : Single Click
263+ - event.trigger :
264+ id : button_3_event
265+ event_type : Single Click
281266
282267 - timing :
283268 - ON for at most 300ms
284269 - OFF for at most 0.5s
285270 - ON for at most 300ms
286271 - OFF for at least 0.2s
287272 then :
288- - event.trigger :
289- id : button_3_event
290- event_type : Double Click
273+ - event.trigger :
274+ id : button_3_event
275+ event_type : Double Click
291276
292277 - timing :
293278 - ON for 1s to 5s
294279 - OFF for at least 0.5s
295280 then :
296- - event.trigger :
297- id : button_3_event
298- event_type : Long Press
281+ - event.trigger :
282+ id : button_3_event
283+ event_type : Long Press
299284
300285 - platform : gpio
301286 id : button_4
@@ -369,6 +354,19 @@ sensor:
369354 update_interval : 60s
370355 entity_category : " diagnostic"
371356
357+ - platform : max17048
358+ id : max_17048
359+ battery_voltage :
360+ name : Battery voltage
361+ id : batt_v
362+ battery_level :
363+ name : Battery level
364+ id : batt_pct
365+ filters :
366+ - lambda : |
367+ if (x > 100) return 100;
368+ else return (x);
369+
372370switch :
373371 - platform : template
374372 name : " Prevent Sleep"
@@ -407,12 +405,11 @@ switch:
407405 setup_priority : 2000
408406 internal : true
409407
410- # LED Configuration - Using monochromatic light since we have single GPIO
411408light :
412409 - platform : partition
413410 name : " BTN 1 Light"
411+ default_transition_length : 0s
414412 segments :
415- # Use first 10 LEDs from the light with ID light1
416413 - id : rgb_light
417414 from : 0
418415 to : 0
@@ -431,8 +428,8 @@ light:
431428 max_brightness : 100%
432429 - platform : partition
433430 name : " BTN 2 Light"
431+ default_transition_length : 0s
434432 segments :
435- # Use first 10 LEDs from the light with ID light1
436433 - id : rgb_light
437434 from : 1
438435 to : 1
@@ -451,8 +448,8 @@ light:
451448 max_brightness : 100%
452449 - platform : partition
453450 name : " BTN 3 Light"
451+ default_transition_length : 0s
454452 segments :
455- # Use first 10 LEDs from the light with ID light1
456453 - id : rgb_light
457454 from : 2
458455 to : 2
@@ -471,8 +468,8 @@ light:
471468 max_brightness : 100%
472469 - platform : partition
473470 name : " BTN 4 Light"
471+ default_transition_length : 0s
474472 segments :
475- # Use first 10 LEDs from the light with ID light1
476473 - id : rgb_light
477474 from : 3
478475 to : 3
0 commit comments