-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path1Traeger-S3.yaml
More file actions
1201 lines (1102 loc) · 34.7 KB
/
Copy path1Traeger-S3.yaml
File metadata and controls
1201 lines (1102 loc) · 34.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Traeger S3 smoker controller
# PID defaults (2026-07-09 cook): Pb=60 Ti=150 Td=40 tau=115 theta=25 center=0.001 stable_window=10
esphome:
name: 1-traeger-smoker
friendly_name: 1 Traeger Smoker
platformio_options:
board_build.flash_mode: dio
on_boot:
priority: -100
then:
- lambda: id(status_msg).publish_state("Ready");
- if:
condition:
lambda: |-
float temp = id(rtd_temperature_f).state;
return !isnan(temp) && temp > 175.0;
then:
- switch.turn_on: fans_on_off_sw
- lambda: id(status_msg).publish_state("Hot startup - Fans ON");
else:
- switch.turn_off: fans_on_off_sw
- lambda: id(status_msg).publish_state("Ready!");
# ILI9341 often wakes blank until rails settle; re-init a few seconds later
- delay: 3s
- script.execute: sc_tft_reinit
packages:
touchscreen: !include common/IPS4.0_touchscreen_(esp32S3_Trager_1pot).yaml
display_ui: !include common/1Traeger-S3_display.yaml
psram:
mode: octal
speed: 80MHz
esp32:
board: esp32-s3-devkitc-1
variant: esp32s3
flash_size: 16MB
framework:
type: arduino
api:
reboot_timeout: 24h
logger:
level: INFO
logs:
component: none
api.connection: ERROR
max31865: WARN
max6675: WARN
ads1115.sensor: ERROR
sensor: ERROR
number: ERROR
ili9xxx: ERROR
FT63X6: ERROR
ft63x6: WARN
spi: ERROR
touchscreen: ERROR
I2C: ERROR
esp-idf: WARN
ota:
- platform: esphome
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: true
spi:
- id: spi_bus
clk_pin: GPIO1 #display SCK/touch T_CLK
mosi_pin: GPIO2 #SDI-max / display /touch T_DIN
miso_pin: GPIO4 #SDO-max / touch T_DO, display doesnt need MISO
display:
- id: !extend mydisplay
platform: ili9xxx
spi_id: spi_bus
data_rate: 20MHz
model: ILI9341 #TFT 2.4
dc_pin: GPIO5
cs_pin: GPIO7
reset_pin: GPIO6
color_palette: 8BIT
#LED - jumper to VCC so it is always on
rotation: 0
invert_colors: true
show_test_card: false
globals:
- id: p_select_index_global
type: int
restore_value: yes
- id: lighting_flag_global
type: bool
restore_value: no
initial_value: 'true'
- id: lighting_failed_dialog
type: bool
restore_value: no
initial_value: 'false'
- id: lighting_start_ms
type: unsigned long
restore_value: no
initial_value: '0'
- id: lighting_retry_count
type: int
restore_value: no
initial_value: '0'
- id: page_1_selected_option
type: std::string
restore_value: no
initial_value: '"temp_setting"'
select:
- platform: template
name: "P Select"
id: p_select
options:
- "P0"
- "P1"
- "P2"
- "P3"
- "P4"
- "P5"
initial_option: "P0"
restore_value: true
optimistic: true
set_action:
- logger.log:
format: "Chosen option: %s"
args: ["x.c_str()"]
on_value: #set smoke times
- lambda: |-
id(p_select_index_global) = i;
switch(i) {
case 0: id(smoke_off_time).publish_state(40); id(smoke_on_time).publish_state(10); break;
case 1: id(smoke_off_time).publish_state(50); id(smoke_on_time).publish_state(10); break;
case 2: id(smoke_off_time).publish_state(60); id(smoke_on_time).publish_state(10); break;
case 3: id(smoke_off_time).publish_state(70); id(smoke_on_time).publish_state(10); break;
case 4: id(smoke_off_time).publish_state(80); id(smoke_on_time).publish_state(10); break;
case 5: id(smoke_off_time).publish_state(90); id(smoke_on_time).publish_state(10); break;
}
i2c:
- id: i2c_bus
sda: GPIO9
scl: GPIO40
scan: true
timeout: 100ms
frequency: 50kHz
ads1115:
address: 0x48
id: ads1115_48
sensor:
- platform: template
name: "Firepot Monitor"
id: firepot_monitor
update_interval: 10s
lambda: |-
// Ignition owns the hot rod while lighting_flag_global is true
if (!id(go).state || id(lighting_flag_global)) {
return 0.0;
}
if (!id(smoke_mode).state) {
// Heating mode: 300F = 148.9C, 325F = 162.8C
if (id(firepot_temperature_c).state < 148.9) {
if (!id(hotrod_1_sw).state) {
id(hotrod_1_sw).turn_on();
}
ESP_LOGD("Firepot", "Heating mode: hotrod ON - firepot below 300F");
return 1.0;
} else if (id(firepot_temperature_c).state > 162.8) {
if (id(hotrod_1_sw).state) {
id(hotrod_1_sw).turn_off();
ESP_LOGD("Firepot", "Heating mode: hotrod OFF - firepot above 325F");
}
return 0.0;
}
} else {
// Smoke mode: 160F = 71.1C, 200F = 93.3C
if (id(firepot_temperature_c).state < 71.1) {
if (!id(hotrod_1_sw).state) {
id(hotrod_1_sw).turn_on();
}
ESP_LOGD("Firepot", "Smoke mode: hotrod ON - firepot below 160F");
return 1.0;
} else if (id(firepot_temperature_c).state > 93.3) {
if (id(hotrod_1_sw).state) {
id(hotrod_1_sw).turn_off();
ESP_LOGD("Firepot", "Smoke mode: hotrod OFF - firepot above 200F");
}
return 0.0;
}
}
return 0.0;
- platform: max6675
id: firepot_temperature_c
cs_pin: GPIO15
update_interval: 5s
- platform: template
name: "FirePot Temperature"
id: firepot_temperature_f
unit_of_measurement: "°F"
accuracy_decimals: 1
update_interval: 5s
lambda: |-
if (id(firepot_temperature_c).has_state() && !isnan(id(firepot_temperature_c).state)) {
return id(firepot_temperature_c).state * 1.8 + 32.0;
}
return NAN;
filters:
- filter_out: NaN
- platform: max31865
#name: "RTD Temperature raw"
id: rtd_temperature_c
cs_pin: GPIO17
spi_id: spi_bus
reference_resistance: "4280 Ω"
rtd_nominal_resistance: "1000 Ω"
data_rate: 4MHz
update_interval: 1s
rtd_wires: 2
filters:
- filter_out: NaN
- platform: template
name: "RTD Temperature"
id: rtd_temperature_f
unit_of_measurement: "°F"
accuracy_decimals: 1
update_interval: 1s
lambda: |-
if (id(rtd_temperature_c).has_state() && !isnan(id(rtd_temperature_c).state)) {
return id(rtd_temperature_c).state * 1.8 + 32.0;
}
return NAN;
filters:
- filter_out: NaN
- calibrate_linear:
method: exact
datapoints:
- 148.5 -> 153.2
- 157.8 -> 161.2
- 168.1 -> 175.6
- 182.5 -> 195.9
- 203.2 -> 220.8
- 218.2 -> 244.8
- 231.4 -> 269.9
- 244.3 -> 285.5
- 254.0 -> 297.9
- 262.4 -> 305.4
# - platform: vl53l0x
# name: "Pellet Level"
# long_range: true
# timeout: 200us
# update_interval: 5s
# unit_of_measurement: "m"
# accuracy_decimals: 2
############## ADC1_A1 ##############
- platform: template
name: "A1 Thermistor Resistance"
unit_of_measurement: "Ω"
update_interval: never
id: a1_thermistor_resistance
- platform: template
name: "A1 Temperature"
id: a1_temperature
unit_of_measurement: "°F"
accuracy_decimals: 2
update_interval: never
- platform: ads1115
multiplexer: 'A1_GND'
name: "A1 ADS1115 to GND"
ads1115_id: ads1115_48
id: a1_voltage
unit_of_measurement: "V"
accuracy_decimals: 4
update_interval: 2s
gain: 6.144 # measures up to 6.144v
filters:
median:
window_size: 7
send_every: 1
on_value:
then:
- lambda: |-
// Calculate thermistor resistance
const float Vcc = 5.1; // Supply voltage (adjust if 5V)
const float R_1 = 148600; // Fixed resistor (1kΩ, adjust if different)
float Vout = id(a1_voltage).state;
float R_thermistor = 0;
if (Vout > 0) { // Avoid division by zero
R_thermistor = (Vout * R_1 ) / (Vcc - Vout);
//(148600 * (4.971-2.595)) / 2.595
}
// Calculate temperature using Steinhart-Hart equation
//THERMOWORKS PRO TEMP PROBE
float temperature = 0;
if (R_thermistor > 0) {
const float A = .00086732282163;
const float B = .00019645922453;
const float C = .0000001484424132;
float lnR = log(R_thermistor);
float T_kelvin = 1.0 / (A + B * lnR + C * lnR * lnR * lnR);
float T_celsius = T_kelvin - 273.15;
temperature = (T_celsius * 9.0 / 5.0) + 32.0; // Convert to Fahrenheit
}
// Publish values to the sensors
id(a1_thermistor_resistance).publish_state(R_thermistor);
id(a1_temperature).publish_state(temperature);
- platform: rotary_encoder
name: "Rotary Encoder"
pin_a:
number: GPIO18
inverted: true
pin_b:
number: GPIO8
inverted: false
id: rotary
on_clockwise:
- script.execute:
id: sc_adjust_set_temp
direction: 1
on_anticlockwise:
- script.execute:
id: sc_adjust_set_temp
direction: -1
button:
- platform: restart #allows remote reset of tywe1s chip from home assistant or internally
id: restart_esp
name: "Controller Restart"
- platform: factory_reset
name: Restart with Factory Default Settings
- platform: template
name: "Emergency Stop"
id: sc_stop_all_smoking_button
on_press:
- script.execute: sc_stop_all_smoking
text_sensor:
- platform: template
id: status_msg
name: "Status Message"
switch:
- platform: template
optimistic: true
name: "System ON/OFF"
id: go
on_turn_on:
- logger.log: "System turned ON"
- globals.set:
id: lighting_failed_dialog
value: 'false'
- logger.log: "turning ON fan"
- switch.turn_on: fans_on_off_sw
- if:
condition:
lambda: |-
float fp = id(firepot_temperature_c).state;
return !isnan(fp) && fp >= 148.9f;
then:
- logger.log: "Firepot already lit - skipping lighting cycle"
- globals.set:
id: lighting_flag_global
value: 'false'
- lambda: |-
id(lighting_flag).publish_state(false);
id(status_msg).publish_state("Firepot already lit");
- delay: 2s
- if:
condition:
switch.is_on: smoke_mode
then:
- lambda: id(status_msg).publish_state("Smoking Mode");
- script.execute: sc_pot_smoking
else:
- lambda: id(status_msg).publish_state("Heating Mode");
- script.execute: sc_pot_heating
else:
- globals.set:
id: lighting_flag_global
value: 'true'
- script.execute: sc_light_pot
on_turn_off:
- logger.log: "System turned OFF"
- switch.turn_off: smoke_mode
- script.execute: sc_stop_all_smoking
- lambda: id(status_msg).publish_state("Turned OFF");
- if:
condition:
lambda: |-
float temp = id(rtd_temperature_f).state;
return !isnan(temp) && temp > 175.0;
then:
- script.execute: sc_shutdown
- lambda: id(status_msg).publish_state("Cooldown - Fans ON");
else:
- script.stop: sc_shutdown
- switch.turn_off: fans_on_off_sw
#
- platform: template
optimistic: true
name: "Smoking Mode ON/OFF"
id: smoke_mode
on_turn_on:
- if:
condition:
- switch.is_on: go
then:
- switch.turn_off: hotrod_1_sw
- script.stop: sc_light_pot
- logger.log: "Smoke Mode turned ON"
- lambda: id(status_msg).publish_state("Smoking Mode");
- script.stop: sc_pot_heating
- script.execute: sc_pot_smoking
- switch.turn_on: fans_on_off_sw
on_turn_off:
- if:
condition:
- switch.is_on: go
then:
- logger.log: "sw.Heating Mode"
- lambda: id(status_msg).publish_state("Heating Mode");
- script.stop: sc_pot_smoking
- script.execute: sc_pot_heating
#
- platform: gpio
pin: GPIO11
name: "-Fans On/Off"
inverted: no
id: fans_on_off_sw
on_turn_on:
- lambda: |-
ESP_LOGD("Fans ON: RTD Probe", "RTD Temp: %.3f", id(rtd_temperature_f).state);
on_turn_off:
# Only auto-cooldown when system is still ON (manual fan off while cooking).
# System OFF uses explicit sc_shutdown from go on_turn_off.
- if:
condition:
and:
- switch.is_on: go
- lambda: |-
float temp = id(rtd_temperature_f).state;
return !isnan(temp) && temp > 175.0;
then:
- script.execute: sc_shutdown
- switch.turn_on: fans_on_off_sw
- lambda: id(status_msg).publish_state("Grill is Hot-Fan ON");
- delay: 1s
- lambda: |-
id(fans_on_off_sw)->publish_state(true);
else:
- if:
condition:
switch.is_on: go
then:
- script.stop: sc_shutdown
- lambda: id(status_msg).publish_state("Fan OFF @ < 175F");
- delay: 1s
- lambda: |-
id(fans_on_off_sw)->publish_state(false);
- platform: gpio
pin: GPIO12
name: "-Auger 1 SW"
inverted: no
id: auger_1_sw
restore_mode: ALWAYS_OFF
- platform: gpio
pin: GPIO13
name: "-HotRod 1 SW"
inverted: no
id: hotrod_1_sw
restore_mode: ALWAYS_OFF
binary_sensor:
- platform: gpio
pin:
number: GPIO10
mode:
input: true
name: "Power Button"
filters:
- invert:
- delayed_on_off: 50ms
on_press:
- switch.toggle: go
- logger.log: "Power button pressed - toggling system"
- platform: gpio
pin:
number: GPIO14
mode:
input: true
name: "Smoke Mode Button"
filters:
- invert:
- delayed_on_off: 50ms
on_press:
- switch.toggle: smoke_mode
- logger.log: "Smoke mode button pressed - toggling smoke mode"
- platform: gpio
pin:
number: GPIO38
mode:
input: true
name: "Temperature Down"
filters:
- invert:
- delayed_on_off: 50ms
on_press:
- script.execute:
id: sc_adjust_set_temp
direction: -1
- platform: gpio
pin:
number: GPIO45
mode:
input: true
name: "Temperature Up"
filters:
- invert:
- delayed_on_off: 50ms
on_press:
- script.execute:
id: sc_adjust_set_temp
direction: 1
- platform: touchscreen
id: touch_key_POWER
x_min: 1
x_max: 95
y_min: 1
y_max: 80
on_press:
- logger.log: "POWER was touched"
- switch.toggle: go
- platform: touchscreen
id: touch_key_SMOKE
x_min: 96
x_max: 230
y_min: 1
y_max: 80
on_press:
- logger.log: "SMOKE was touched"
- switch.toggle: smoke_mode
- platform: touchscreen
id: touch_key_HOTROD_1
x_min: 192
x_max: 230
y_min: 242
y_max: 280
on_press:
- logger.log: "HotRod was touched"
- switch.toggle: hotrod_1_sw
- platform: touchscreen
id: touch_key_LIGHTING_OK
x_min: 70
x_max: 170
y_min: 210
y_max: 250
on_press:
- if:
condition:
lambda: return id(lighting_failed_dialog);
then:
- globals.set:
id: lighting_failed_dialog
value: 'false'
- lambda: id(status_msg).publish_state("Ready");
- logger.log: "Lighting failed dialog dismissed"
- platform: gpio
pin:
number: GPIO3
mode:
input: true
pullup: true
name: "Rotary Switch"
id: rotary_switch
filters:
invert:
on_multi_click:
- timing:
- ON for at most 1s
- OFF for at least 0.5s
then:
- logger.log: "Single Click - Toggling adjustment selection"
- lambda: |-
if (id(page_1_selected_option) == "temp_setting") {
id(status_msg).publish_state(" Adjusting P Level");
id(page_1_selected_option) = "p_setting";
} else {
id(status_msg).publish_state(" Adjusting Temp");
id(page_1_selected_option) = "temp_setting";
}
- timing:
- ON for at most 1s
- OFF for at most 1s
- ON for at most 1s
- OFF for at least 0.2s
then:
- logger.log: "Double Click Detected"
- platform: template
id: lighting_flag
name: "Lighting Flag"
lambda: |-
return id(lighting_flag_global);
number:
#PID values
- platform: template
name: "PID Proportional Band"
id: pid_pb
optimistic: true
min_value: 10
max_value: 200
step: 1
restore_value: true
initial_value: 60.0
mode: box
icon: mdi:tune-vertical
- platform: template
name: "PID Ti (Reset Time)"
id: pid_ti
optimistic: true
min_value: 0
max_value: 600
step: 1
restore_value: true
initial_value: 150.0
mode: box
icon: mdi:timer-sync
- platform: template
name: "PID Td (Rate Time)"
id: pid_td
optimistic: true
min_value: 0
max_value: 120
step: 1
restore_value: true
initial_value: 40.0
mode: box
icon: mdi:timer-outline
- platform: template
name: "PID Tau"
id: pid_tau
min_value: 0
max_value: 600
step: 1
initial_value: 115
optimistic: true
restore_value: true
unit_of_measurement: "s"
- platform: template
name: "PID Theta"
id: pid_theta
min_value: 0
max_value: 120
step: 1
initial_value: 25
optimistic: true
restore_value: true
unit_of_measurement: "s"
mode: box
icon: mdi:tune-vertical
- platform: template
name: "PID Center Factor"
id: pid_center_factor
min_value: 0.0
max_value: 1.0
step: 0.0001
initial_value: 0.001
optimistic: true
restore_value: true
mode: box
icon: mdi:tune-vertical
- platform: template
name: "PID Stable Window"
id: pid_stable_window
min_value: 0
max_value: 50
step: 1
initial_value: 10
optimistic: true
restore_value: true
unit_of_measurement: "°F"
mode: box
icon: mdi:tune-vertical
- platform: template
name: "Smoke Auger On Time (10s)"
id: smoke_on_time
restore_value: yes
min_value: 5
max_value: 20
step: 1
initial_value: 10
optimistic: true
unit_of_measurement: "s"
mode: box
- platform: template
name: "Smoke Auger Off Time (P val)"
id: smoke_off_time
restore_value: yes
min_value: 5
max_value: 90
step: 1
initial_value: 40
optimistic: true
unit_of_measurement: "s"
mode: box
- platform: template
name: "PID Error Temp"
id: pid_error
min_value: 0
max_value: 600
step: 1
initial_value: 100
optimistic: true
restore_value: false
unit_of_measurement: "°F"
- platform: template
name: Smoker Set Temperature
id: smoker_set_temp
min_value: 140
max_value: 550
step: 5
initial_value: 225
optimistic: true
restore_value: true
update_interval: 60s
unit_of_measurement: "°F"
mode: slider
on_value:
- if:
condition:
and:
- switch.is_on: go
- switch.is_off: smoke_mode
- lambda: return !id(lighting_flag_global);
then:
- script.execute: sc_pid_control
# Pot lighting: ON = initial pellet load; OFF = max wait for 300F before failure
- platform: template
name: Pot lighting ON Time
id: pot_lighting_on_time
min_value: 1
max_value: 120
step: 1
initial_value: 60
optimistic: true
restore_value: true
unit_of_measurement: "s"
mode: slider
icon: mdi:timer-settings
- platform: template
name: Pot lighting OFF Time
id: pot_lighting_off_time
min_value: 60
max_value: 600
step: 1
initial_value: 600
optimistic: true
restore_value: true
unit_of_measurement: "s"
mode: slider
icon: mdi:timer-settings
# Heating times
- platform: template
name: Augers Heating ON Time
id: augers_heating_on_time
min_value: 3
max_value: 20
step: 0.5
initial_value: 15
optimistic: true
restore_value: true
unit_of_measurement: "s"
mode: slider
icon: mdi:timer-settings
- platform: template
name: Augers Heating OFF Time
id: augers_heating_off_time
min_value: 0
max_value: 20
step: 0.5
initial_value: 1
optimistic: true
restore_value: true
unit_of_measurement: "s"
mode: slider
icon: mdi:timer-settings-outline
script:
# Second HW reset + full ILI9341 re-init after power rails settle
- id: sc_tft_reinit
mode: single
then:
- logger.log: "TFT delayed re-init"
- lambda: |-
id(mydisplay).setup();
- id: sc_adjust_set_temp
mode: single
parameters:
direction: int
then:
- lambda: |-
if (id(page_1_selected_option) == "temp_setting") {
float current_temp = id(smoker_set_temp).state;
float step;
if (current_temp <= 225) {
step = 5.0f;
} else {
// Fine step while rotary switch is held
step = id(rotary_switch).state ? 5.0f : 25.0f;
}
float new_temp = current_temp + (direction * step);
if (current_temp <= 225) {
new_temp = round(new_temp / 5.0f) * 5.0f;
} else {
new_temp = round(new_temp / 25.0f) * 25.0f;
}
float min_v = id(smoker_set_temp).traits.get_min_value();
float max_v = id(smoker_set_temp).traits.get_max_value();
if (new_temp >= min_v && new_temp <= max_v) {
id(smoker_set_temp).publish_state(new_temp);
}
} else if (id(page_1_selected_option) == "p_setting") {
auto current_index = id(p_select).index_of(id(p_select).state);
if (current_index.has_value()) {
int next_index = (static_cast<int>(current_index.value()) + direction) % 6;
if (next_index < 0) next_index += 6;
id(p_select).make_call().set_index(next_index).perform();
}
}
- id: sc_light_pot
mode: single
then:
- logger.log: "sc_light_pot executing"
- if:
condition:
- switch.is_on: go
then:
- delay: 0.01s
- logger.log: "Lighting Pot now"
- lambda: id(status_msg).publish_state("Lighting Fire Pot");
- globals.set:
id: lighting_retry_count
value: '0'
- switch.turn_on: hotrod_1_sw
- switch.turn_on: auger_1_sw
# Initial pellet load (pot_lighting_on_time)
- delay: !lambda "return id(pot_lighting_on_time).state * 1000;"
- switch.turn_off: auger_1_sw
- lambda: id(lighting_start_ms) = millis();
# Wait for firepot >= 300F; pulse auger up to 3 times while waiting
- while:
condition:
and:
- switch.is_on: go
- lambda: |-
float fp = id(firepot_temperature_c).state;
bool not_lit = isnan(fp) || fp < 148.9f;
unsigned long elapsed = millis() - id(lighting_start_ms);
bool within = elapsed < static_cast<unsigned long>(id(pot_lighting_off_time).state * 1000.0f);
return not_lit && within;
then:
- if:
condition:
lambda: |-
// Pulse every ~60s, max 3 retries
unsigned long elapsed = millis() - id(lighting_start_ms);
int due = static_cast<int>(elapsed / 60000UL);
return due > id(lighting_retry_count) && id(lighting_retry_count) < 3;
then:
- lambda: |-
id(lighting_retry_count) = id(lighting_retry_count) + 1;
id(status_msg).publish_state("Lighting retry...");
- logger.log:
format: "Lighting retry auger pulse %d"
args: ['id(lighting_retry_count)']
- switch.turn_on: auger_1_sw
- delay: 30s
- switch.turn_off: auger_1_sw
- delay: 2s
- if:
condition:
and:
- switch.is_on: go
- lambda: |-
float fp = id(firepot_temperature_c).state;
return !isnan(fp) && fp >= 148.9f;
then:
- globals.set:
id: lighting_flag_global
value: 'false'
- lambda: |-
id(lighting_flag).publish_state(false);
id(status_msg).publish_state("Pot Lit");
- delay: 2s
- lambda: id(status_msg).publish_state("Heating Mode");
- script.execute: sc_pot_heating
- delay: 300s
- switch.turn_off: hotrod_1_sw
else:
- if:
condition:
switch.is_on: go
then:
- switch.turn_off: hotrod_1_sw
- switch.turn_off: auger_1_sw
- globals.set:
id: lighting_flag_global
value: 'false'
- globals.set:
id: lighting_failed_dialog
value: 'true'
- lambda: id(status_msg).publish_state("Lighting failed");
- logger.log: "Lighting failed - firepot never reached 300F"
- switch.turn_off: go
- id: sc_pot_heating
mode: restart
then:
- logger.log: "sc_pot_heating.STARTING"
- while:
condition:
- switch.is_on: go
then:
- script.execute: sc_pid_control
- logger.log:
format: "Heating cycle: ON time=%.1fs, OFF time=%.1fs"
args: ["id(augers_heating_on_time).state", "id(augers_heating_off_time).state"]
- switch.turn_on: auger_1_sw
- delay: !lambda "return id(augers_heating_on_time).state * 1000;"
- script.execute: sc_pid_control
- switch.turn_off: auger_1_sw
- delay: !lambda "return id(augers_heating_off_time).state * 1000;"
- id: sc_pot_smoking
mode: restart
then:
- while:
condition:
- switch.is_on: go
then:
- logger.log: "BEGIN sc_pot_smoking"