-
Notifications
You must be signed in to change notification settings - Fork 0
/
ESP32 Pellet Stove wit mods.yaml
732 lines (731 loc) · 25.6 KB
/
ESP32 Pellet Stove wit mods.yaml
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
#pellet
#----------------------------------------------------------
# TUYA WOOD PELLET STOVE Converted to ESP32
# Version 4.0: BPoHVoodoo
# changed to use with Nemaxx Px,
# changed to use °C instead of Fahrenheit
# simplified Code
# P5 only kicks in, if SET_TEMP < CURRENT_TEMP and if we are 100% sure to be in ECO2
# version; 3.1.0
# changed to use with Nemaxx Px, added WebServer
# date: 04-10-23 bug fixes
# 3.0 converted to ESP32, added realtime exhaust sensor
# 2.0 added fire stoking function
# 1.0.0 added a Power Level P5 (ultra low power) that is fully configurable while in ECO2 mode.
# 1.1.0 added echo of actual display messages and status via Display's MCU UART monitoring
#
# All of these mods give a new "Ultra Low" power level which turns down the heat during IDLE mode so the stove goes thru fewer (no)
# on/off/igniter cycles and just maintains a lower heat output (for smaller rooms)
# when the room cools enuf, ECO2 mode will kick back to "Heating" which
# turns off this new Ultra Low power level, then once the room temp is +2F above set temp, stove
# goes into "Idle" mode again and new Ultra Low is active again. The cycle repeats and the stove stays lit.
# and room doesn't drastically heat up driving your wife nuts.
# These mods ***require*** replacing the Tuya chip with an ESP32 D1 Mini & some MCU control board and Display board mods.
# See Github Discussions for complete details
#
# NOTE: I am NOT a career/pro programmer. There is probably tons of opportunity to
# consolidate many of the if/then statements that check things into convoluted programmer-porn style
# Lambda evaluations, but I hate writing and debugging Lambdas,
# so my code makes way more sense for the average person and is very easy to debug.
# Your mileage may vary.
# And, more inportant, it gets the job done!
#----------------------------------------
#
substitutions:
device_name: "pellet-ofen"
device_description: Pellet Ofen mit ESPHome auf Wemos D1 mini32
friendly_name: Pellet-Ofen
location: Irgendwo
lighting_count: "45" #sets max number of dumps of pellets during lighting
switch_lighting2heating: "60.0" # 60°C or 140.0 F # exactly the point it switches from "lighting to heating"
#----------------------------------------------------------
#
esp32:
board: wemos_d1_mini32
# Enable logging
logger:
level: debug
baud_rate: 0 #required for UART sniffer to work
debug:
update_interval: 60s
# Enable Home Assistant API
api:
reboot_timeout: 60min # if we lose home assistant keep running for 60 mins
encryption:
key: !secret enc_key
#
ota:
password: !secret ota_password
#
wifi:
#use_address: 192.168.123.52 # use when renaming this node
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: none
reboot_timeout: 30min
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${location}-${friendly_name}"
password: !secret wifi_password
#
captive_portal:
# Example configuration entry
web_server:
port: 80
include_internal: true
local: true
auth:
username: !secret web_server_username
password: !secret web_server_password
#
globals:
- id: auger_count_global
type: int
restore_value: no
initial_value: '0'
- id: stoking_flag_global
type: bool
initial_value: "false"
restore_value: yes
- id: power_select_lastvalue
type: int
restore_value: yes
- id: set_temp_lastvalue
type: int
restore_value: no
#
uart: # define 3 hardware UARTS, 1 for TuyaMCU, others for MCU Display & temps monitoring
- id: tywe1s_uart # communication from TuyaMCU to tywe1s chip UART1
rx_pin: RX # Receives data from MCU, RX label on ESP32
tx_pin: TX # Transmits data to MCU, TX label on ESP32
baud_rate: 9600
- id: mcu_uart_TXpin # Display message decoding UART2
rx_pin: GPIO16 # attach new wire to TX labled pin on DISPLAY board
baud_rate: 2400
rx_buffer_size: 80
debug:
direction: RX
dummy_receiver: true
after:
delimiter: [0xCC, 0x33]
sequence:
- logger.log: "DIS"
- lambda: |-
UARTDebug::log_hex(direction, bytes, ' ');
if (bytes.size()==5) { //Some packets have 5 bytes
//if(bytes[0]==0xAA && bytes[1]==0x00) {
if(bytes[0]==0xAA && bytes[1]==0x00 && bytes[2]!=0x4B) {
id(DISrawHEX).publish_state(str_sprintf("0x%02X",bytes[2]));
switch (bytes[2]) {
case 0x20:
id(DISrawString).publish_state("Willkommen!");
break;
case 0x62:
id(DISrawString).publish_state("Ausschaltvorgang");
break;
case 0x63:
id(DISrawString).publish_state("Reinigung");
break;
case 0x65:
id(DISrawString).publish_state("Zuendung");
break;
case 0x66:
id(DISrawString).publish_state("Stabilisierung");
break;
case 0x69:
id(DISrawString).publish_state("Reinigung");
break;
case 0x6A:
id(DISrawString).publish_state("Auf Wiedersehen!");
break;
default:
break;
}
}
} else if (bytes.size()==6 && bytes[1]==0x01) { //Some packets have 6 bytes
if(bytes[2]==0x46 && bytes[3]==0x02) {
id(DISrawString).publish_state("Willkommen!");
}else if(bytes[2]==0x46 && bytes[3]==0x02) {
id(DISrawString).publish_state("Ausschaltvorgang");
}else if(bytes[2]==0x49 && bytes[3]==0x80) {
id(DISrawString).publish_state("Stabilisierung");
}else if(bytes[2]==0x49 && bytes[3]==0x00) {
id(DISrawString).publish_state("Stabilisierung");
}else if(bytes[2]==0x49 && bytes[3]==0x81) {
id(DISrawString).publish_state("ECO2");
}else if(bytes[2]==0x48 && bytes[3]==0x80) {
id(DISrawString).publish_state("ECO1");
}else if(bytes[2]==0x48 && bytes[3]==0xC0) {
id(DISrawString).publish_state("ECO2");
}else if(bytes[2]==0x49 && bytes[3]==0x01) {
id(DISrawString).publish_state("ECO2");
}else if(bytes[2]==0x48 && bytes[3]==0x83) {
id(DISrawString).publish_state("ECO1");
}else if(bytes[2]==0x48 && bytes[3]==0xC3) {
id(DISrawString).publish_state("ECO2");
}else if(bytes[2]==0x49 && bytes[3]==0x81) {
id(DISrawString).publish_state("ECO2");
}
}
#
- id: mcu_uart_RXpin # from Display control board RX pin to MCU board RX pin UART3 gives us real time temps in middle byte
rx_pin: GPIO21 #attach new wire to RX labled pin on DISPLAY board
baud_rate: 2400
rx_buffer_size: 80
debug:
direction: RX
dummy_receiver: true
after:
delimiter: [0xCC, 0x33]
sequence:
- logger.log: "MCU"
- lambda: |-
UARTDebug::log_hex(direction, bytes, ' ');
if (bytes.size()==10) {
//id(current_temp_uart).publish_state((bytes[5])-20); //Celsius
id(pipe_temp_uart).publish_state((bytes[6])-20); //Celsius
//id(protect_temp_uart).publish_state((bytes[7])-20); //Celsius
}
#
script:
- id: auger_p5 # SCRIPT New P5 Power level Auger motor control, Started by the following events p5z, on_boot, DISrawString
mode: single
then:
- logger.log: "1script.auger_p5.STARTING"
- while: #Main loop
condition:
and:
- binary_sensor.is_on: p5z #Power Level 5 is activated
- text_sensor.state: #Stove is idling in ECO2 mode
id: hvac_action_tuya
state: 'IDLE'
- lambda: return id(DISrawString).state == "ECO2";
- sensor.in_range: #**** Stove is burning, exhaust is hot
id: pipe_temp_uart
above: ${switch_lighting2heating}
- lambda: |- # equal or above setpoint
if (id(current_temp).state >= id(set_temp).state) {
return true;
} else {
return false;
}
then:
- if:
condition:
- binary_sensor.is_off: stoking_flag #we aren't stoking the fire
then:
- switch.turn_on: auger_output
- delay: !lambda "return id(auger_on_time).state * 1000;"
- switch.turn_off: auger_output
- delay: !lambda "return id(auger_off_time).state * 1000;"
else:
- logger.log:
format: "SCRIPT.Stoking FIRE NOW | stoking_temp= %f"
args: ['id(stoking_temp).state']
- switch.turn_on: auger_output
- delay: !lambda "return id(stoking_on_time).state * 1000;" # SECONDS ON
- switch.turn_off: auger_output
- delay: !lambda "return id(stoking_off_time).state * 1000;" # SECONDS OFF
#
binary_sensor:
- platform: "tuya"
id: stove_on
name: "${location} Stove-Power On"
sensor_datapoint: 1
#
- platform: template # template sensors expose sensors to HA
name: ${location} Stove Stoke Fire Flag
id: stoking_flag
# set it to the value of the global
lambda: |-
if (id(stoking_flag_global) == 1) {
return true;
} else {
return false;
}
#
- platform: homeassistant
id: p5z #read new P5 power mode from home assistant, toggle repurposed Timer LED on display module
entity_id: input_boolean.${location}_stove_p5
on_state:
then:
# - logger.log: "logger: P5 button changed"
- if:
condition:
- binary_sensor.is_on: p5z #p5 is active
then:
#- logger.log: "script.P5 sw = TRUE turning ON P5 indicator"
- switch.turn_on: p5_indicator
else:
# - logger.log: "script.p5z = FALSE, turning OFF P5 indicator"
- switch.turn_off: p5_indicator
#
- platform: gpio # MCU CONTROL BOARD AUGER SENSOR
pin: GPIO27 # input only pin
internal: false # this is just a flag you expose and watch in Lovelace
id: ${location}_stove_auger_input
name: "${location} Stove Auger Input" #Auger signal from MCU, goes low when Auger motor is running
filters:
- invert #flip it
on_state:
then:
- if: # LIGHTING, ECHO Auger
condition:
and:
- text_sensor.state:
id: DISrawString
state: 'Zuendung'
then:
- if:
condition:
and:
- binary_sensor.is_on: ${location}_stove_auger_input
- lambda: |- #limit pellets in hopper on lighting. it only needs 35 turns to actually light. Adjust this value if stove repeatedly fails to light every other time.
if (id(auger_count_global) <= ${lighting_count}) {
return true;
} else {
return false;
}
then:
- switch.turn_on: auger_output
# - logger.log: "2GPIO.AUGER TURNING"
- lambda: id(auger_count_global) += 1; #keep track of how many auger turns happen and reset if stove lights
- lambda: id(auger_counter).publish_state(id(auger_count_global)); #publish it to the sensor
else: #TURN OFF - LIGHTING, echo Auger
switch.turn_off: auger_output
- if: # REGULAR ECHO OF AUGER
condition:
or:
- binary_sensor.is_off: p5z # NOT In power level 5
- lambda: return id(DISrawString).state != "ECO2"; # NOT in ECO2
- lambda: return !(id(auger_p5).is_running());
then:
- if:
condition:
- binary_sensor.is_on: ${location}_stove_auger_input
then:
- switch.turn_on: auger_output
#- logger.log: "3GPIO.AUGER TURNING"
else:
- switch.turn_off: auger_output
# else: #Stove in power level 5
# - if: #check for heartbeat and restart scripts if it fails
# condition:
# and:
# - lambda: return id(DISrawString).state == "ECO2";
# - lambda: |- #if after 6 state changes (3 auger pulses), this means no auger of our own detected, then restart scripts
# if (id(heartbeat_global) >= id(heartbeat_max_global)) {
# return true;
# } else {
# return false;
# }
# then:
# - script.execute: auger_p5
#
button:
- platform: restart #allows remote reset of tywe1s chip from home assistant or internally
id: restart_esp
name: "${location} Stove Restart"
#
- platform: safe_mode # required to upload firmware if were low on memory. put chip in safe mode, reboot, then OTA upload new firmware.
name: "${location} Stove SAFE Mode BUTTON"
#
# DEFINE ALL SENSORS AND SWITCHES
#
text_sensor:
- platform: debug
device:
name: "${location} Stove Device Info"
reset_reason:
name: "${location} Stove Reset Reason"
#
- platform: template #from DISPLAY MCU in the display board, gives us what specific text is shown on the display
id: DISrawHEX
name: ${location} Stove Display HEX Sensor
#
- platform: template #from MCU in the display board, gives us what specific text is shown on the display
id: DISrawString
name: ${location} Stove Display Text Sensor
#
- platform: template
name: "${location} Stove Uptime"
lambda: |-
uint32_t dur = id(uptime_s).state;
int dys = dur / 86400;
dur %= 86400;
int hrs = dur / 3600;
dur %= 3600;
int mnts = dur / 60;
dur %= 60;
return str_sprintf("%ud %02uh %02um %02us", dys, hrs, mnts, dur);
icon: mdi:clock-start
update_interval: 30s
#
- platform: template #This sensor is changing all the time and the ONLY indicator of what state the stove is in
id: hvac_action_tuya
name: "${location} Stove HVAC action Tuya"
lambda: |-
switch (id(tuya_climate).action) {
case CLIMATE_ACTION_OFF:
return (std::string) "OFF";
break;
case CLIMATE_ACTION_HEATING:
return (std::string) "HEATING";
break;
case CLIMATE_ACTION_IDLE:
return (std::string) "IDLE";
break;
default:
return (std::string) "UNKNOWN";
break;
}
on_value: #this sensor changes from HEATING to IDLE in ECO2 mode or when we reach set temp in ECO1.
- if:
condition:
- binary_sensor.is_off: stove_on
then:
#- lambda: id(DISrawString).publish_state("Auf Wiedersehen!");
#
i2c: # For time of flight sensor
sda: 5
scl: 33
#
sensor:
- platform: wifi_signal
name: "${location} Stove WiFi Signal db"
update_interval: 30s
id: wifi_signal_db
#
- platform: copy # Reports the WiFi signal strength in %
source_id: wifi_signal_db
name: "${location} Stove WiFi Signal %"
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "Signal %"
entity_category: "diagnostic"
#
- platform: debug
free:
name: "${location} Stove Heap Free"
#
# - platform: template
# id: current_temp_uart
# unit_of_measurement: "°C"
# name: "${location} Stove UART Current Temp"
#
- platform: template #THIS SHOULD ONLY CONTROL STOKING OR NOT
id: pipe_temp_uart
unit_of_measurement: "°C"
name: "${location} Stove UART Pipe Temp"
#
#- platform: template
# id: protect_temp_uart
# unit_of_measurement: "°C"
# name: "${location} Stove UART Protect Temp"
#
- platform: template
name: ${location} Stove-Auger Counter (Lighting)
id: auger_counter
#get these object values from home assistant
- platform: homeassistant
id: auger_off_time
entity_id: input_number.${location}_stove_auger_off_time #helper in home assistant
#
- platform: homeassistant
id: auger_on_time
entity_id: input_number.${location}_stove_auger_on_time #helper in home assistant
#
- platform: homeassistant
id: stoking_temp
entity_id: input_number.${location}_stove_stoking_temp #helper in home assistant
force_update: true
#
- platform: homeassistant
id: stoking_on_time
entity_id: input_number.${location}_stove_stoking_on_time #helper in home assistant
force_update: true
#
- platform: homeassistant
id: stoking_off_time
entity_id: input_number.${location}_stove_stoking_off_time #helper in home assistant
force_update: true
#
- platform: vl53l0x
name: "${location} Stove-RAW Pellet Level"
address: 0x29
long_range: true
timeout: 200us
update_interval: 10s
unit_of_measurement: "m"
accuracy_decimals: 2
on_value:
then:
- sensor.template.publish:
id: ultrasonic_smoothed
state: !lambda 'return ((0.47-(x-0.03))*(100/0.47));' # Replace 0.4 by the height of hopper. From the sensor to the bottom.
# Website to know how to multiply values :https://www.skillsyouneed.com/num/percent-change.html
#
- platform: template
id: ultrasonic_smoothed
update_interval: 30s
accuracy_decimals: 0
unit_of_measurement: "%"
icon: "mdi:sack-percent"
name: "${location} Stove-Pellet Level"
filters:
- sliding_window_moving_average:
window_size: 60
send_every: 15
#
- platform: "tuya"
id: error_code
name: "${location} Stove-Error Code"
sensor_datapoint: 104
#
- platform: "tuya"
id: power_mode
name: "${location} Stove-Power Mode"
sensor_datapoint: 4
#
- platform: "tuya"
id: set_temp
name: "${location} Stove-Set Temp"
unit_of_measurement: "°C"
sensor_datapoint: 2
#
- platform: "tuya"
id: current_temp
name: "${location} Stove-Current Temp"
unit_of_measurement: "°C"
sensor_datapoint: 3
filters:
- exponential_moving_average: #this sensor is NOISY!
alpha: 0.7
#
- platform: "tuya"
id: pipe_temp
name: "${location} Stove-Pipe Temp"
unit_of_measurement: "°C"
sensor_datapoint: 102
#
- platform: "tuya"
id: protect_temp
name: "${location} Stove-Protect Temp"
unit_of_measurement: "°C"
sensor_datapoint: 103
#
- platform: uptime
internal: true
id: uptime_s
update_interval: 10s
#
#DEFINE SELECTS
#
select:
- platform: "tuya"
tuya_id: "${location}"
name: "${location} Stove Power Select"
id: power_select
enum_datapoint: 4
options:
0: P1-Hoch
1: P2-Mittelhoch
2: P3-Mittel
3: P4-Niedrig
on_value: #store last value so it can be restored on power/boot up
then:
- lambda: id(power_select_lastvalue) = i;
#
- platform: "tuya"
tuya_id: "${location}"
name: "${location} Stove ECO Select"
id: eco_mode
enum_datapoint: 101
options:
0: ECO1 - Heizen dann AUS
1: ECO2 - Heizen dann P4
on_value:
then:
- lambda: id(set_temp_lastvalue) = id(set_temp).state;
- logger.log:
format: "set_temp_lastvalue= %i"
args: ['id(set_temp_lastvalue)']
#- climate.control:
# id: tuya_climate
# target_temperature: 25
#- climate.control:
# id: tuya_climate
# target_temperature: 20
#
# Data points observed in Tuya iOT platform during debug mode
#1 - Power on (Heat)
#2 - Set Temp
#3 - Current Temp
#4 - Mode P1/P2/P3P4
#101 - ECO1/ECO2
#102 - Pipe Temp
#103 - Protect Temp
#104 - Error Code
#-----------------
#Datapoint 1: switch (value: ON)
#Datapoint 2: int value (value: 20) in °C
#Datapoint 3: int value (value: 19) in °C
#Datapoint 4: enum (value: 2)
#Datapoint 101: enum (value: 0)
#Datapoint 102: int value (value: 123) in °C
#Datapoint 103: int value (value: 25) in °C
#Datapoint 104: bitmask (value: 0)
#GPIO Configuration: status: pin 5, reset: pin 0
#Product: 'k5dWTKaI3Z9llDEA1.0.0'
#
# Register the Tuya MCU connection
tuya:
id: "${location}"
uart_id: tywe1s_uart
#
switch:
- platform: gpio #This sends the Auger signal to the optoisolator to turn on the Auger motor
name: "${location} Stove Auger Output"
pin: GPIO25 #this pin remains high at bootup and reset, no extra pellets disbursed
inverted: yes
id: auger_output
on_turn_on: #FAILSAFE. IF AUGER EVER GETS STUCK on for over 5s, TURN IT OFF
- delay: 5s
- switch.turn_off: auger_output
#
- platform: gpio #wire the time LED on front panel to GPIO1 to indicate when new P5 level is on
pin: GPIO19
inverted: yes
id: p5_indicator
internal: true
#
- platform: gpio # automate resetting stove errors using this button
name: "${location} Stove Thumbsup RESET"
pin: GPIO26
inverted: yes
id: thumbsup
on_turn_on:
- delay: 3.5s #hold time needed to reset error on display
- switch.turn_off: thumbsup
#
climate:
- platform: tuya
reports_fahrenheit: false # bug in stove requires this new flag.
name: "${location} Stove"
id: tuya_climate
switch_datapoint: 1
target_temperature_datapoint: 2
current_temperature_datapoint: 3
visual:
min_temperature: 10.0 #celcius
max_temperature: 25.0
temperature_step: 1
#
esphome:
name: ${device_name}
platformio_options:
upload_speed: 115200
board_build.extra_flags: # REQUIRED FOR UART TO WORK
- "-DARDUINO_USB_CDC_ON_BOOT=0" # Override, defaults to '-DARDUINO_USB_CDC_ON_BOOT=1'
comment: ${device_description}
on_boot:
priority: -100
then:
#- switch.turn_off: auger_output
#- delay: 5s
- switch.turn_off: auger_output
- lambda: id(DISrawString).publish_state("Booting ESP... warte 20s");
- delay: 20s
- logger.log: "Now executing on_boot. 20s delay over, STARTING UP"
#- switch.turn_off: auger_output
- select.set_index:
id: power_select
index: !lambda return id(power_select_lastvalue); # set to saved flash value
- lambda: |- # initially publish some values to the sensor
id(auger_counter).publish_state(id(auger_count_global)); // initially publish it to the sensor
id(DISrawHEX).publish_state(str_sprintf("0x%02X",0));
id(DISrawString).publish_state("Status unbekannt");
- if:
condition:
- binary_sensor.is_off: stove_on
then:
- lambda: |-
id(DISrawHEX).publish_state("0x6A");
id(DISrawString).publish_state("Auf Wiedersehen!");
else:
- if:
condition:
and:
- text_sensor.state: #Stove HEATING not IDLING
id: hvac_action_tuya
state: 'HEATING'
then:
- if:
condition:
- sensor.in_range: #stove is lit
id: pipe_temp_uart
above: ${switch_lighting2heating}
then:
- lambda: id(DISrawString).publish_state("Stabilisierung");
else:
- lambda: id(DISrawString).publish_state("Zuendung");
#- lambda: id(DISrawString).publish_state("Reinigung");
- if:
condition:
and:
- binary_sensor.is_on: p5z
then:
- switch.turn_on: p5_indicator
else:
- switch.turn_off: p5_indicator
on_shutdown:
priority: 1000
then:
- switch.turn_off: auger_output
on_loop:
- if:
condition:
and:
- binary_sensor.is_on: stove_on
- binary_sensor.is_on: p5z
- lambda: return id(DISrawString).state == "ECO2";
- text_sensor.state: #Stove is idling in ECO2 mode
id: hvac_action_tuya
state: 'IDLE'
- sensor.in_range: #stove is lit
id: pipe_temp_uart
above: ${switch_lighting2heating}
- lambda: |- # equal or above setpoint
if (id(current_temp).state >= id(set_temp).state) {
return true;
} else {
return false;
}
then:
- if:
condition:
- lambda: |-
if (id(pipe_temp_uart).state <= id(stoking_temp).state) {
return true;
} else {
return false;
}
then:
- globals.set: #expose to ha
id: stoking_flag_global
value: 'true'
else:
- globals.set: #expose to ha
id: stoking_flag_global
value: 'false'
- if:
condition:
- lambda: return !(id(auger_p5).is_running());
then:
- logger.log: "Starting auger_p5"
- script.execute: auger_p5
else:
- globals.set:
id: stoking_flag_global
value: 'false'
- script.stop: auger_p5