-
Notifications
You must be signed in to change notification settings - Fork 0
/
garage.yaml
1252 lines (1142 loc) · 32 KB
/
garage.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
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
esp32:
board: nodemcu-32s
framework:
type: esp-idf
sdkconfig_options:
CONFIG_ESP32_DEFAULT_CPU_FREQ_240: "y"
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "240"
# Enable logging
logger:
baud_rate: 0
level: INFO
# logs:
# api.service: WARN
# sensor: WARN
# homeassistant.sensor: WARN
# text_sensor: WARN
# jk_bms_ble: WARN
# soyosource_display: WARN
# soyosource_virtual_meter: WARN
# ads1115: WARN
# Enable Home Assistant API
api:
password: ""
reboot_timeout: 2h
ota:
password: ""
on_begin:
then:
- logger.log: "OTA start, disabling BMS bluetooth."
- switch.turn_off: ble_jk
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pw
manual_ip:
static_ip: 192.168.1.20
gateway: 192.168.1.1
subnet: 255.255.255.0
dns1: 192.168.1.25
time:
- platform: sntp
#move time zone by 6 hours, so daily_energy monitors are reset at 07:00 (used in fallback_powermeter to decide if the battery should be emptied over night)
#timezone: CET+6CEST,M3.5.0,M10.5.0/3
esphome:
name: garage-controller
comment: "ESP32 in der Garage"
includes: clk.h
# platformio_options:
# board_build.f_cpu: 240000000L
project:
name: "garage.controller"
version: 1.0.0
on_boot:
priority: 400
then:
- switch.turn_off: ble_jk
preferences:
flash_write_interval: 10min
globals:
- id: api_connection
type: bool
restore_value: no
initial_value: 'false'
- id: max_demand
type: int
restore_value: no
initial_value: '920'
- id: operationMode
type: short
restore_value: no
initial_value: '0'
- id: maxChargeW
type: short
restore_value: no
initial_value: '0'
- id: useBattery
type: bool
restore_value: yes
initial_value: 'false'
- id: garageDoorState
type: short
initial_value: '-1'
restore_value: no
interval:
- interval: 5s
startup_delay: 5s
then:
- if:
condition:
# check last connection state
- lambda: 'return { (id(api_connection) != true) };'
then:
- if:
condition:
api.connected:
then:
# just connected now
- logger.log: API is connected!
- lambda: "id(api_connection) = true;"
- switch.turn_on: ble_jk
- esp32_ble_tracker.start_scan:
continuous: true
else:
- if:
condition:
not:
api.connected:
then:
# just disconnected now
- logger.log: API is disconnected!
- lambda: "id(api_connection) = false;"
- switch.turn_off: ble_jk
- esp32_ble_tracker.stop_scan:
- lambda: |-
if (id(min_batt_temp).state < 6 || id(max_batt_temp).state > 45) {
id(operationMode) = 0; //PV in -> Soyo out
return;
}
if (!id(api_connection) || isnan(id(powermeter0).state)) {
//goal: Only use solar power, 0W to or from battery. Disable below 50W because of bad efficency.
id(operationMode) = 1;
return;
}
if (id(useBattery) || id(batt_soc).state > 57) {
//use powermeter for demand
id(operationMode) = 3;
} else {
//PV -> demand, but charge when PV > power consumption
id(operationMode) = 2;
}
- lambda: |-
if (id(operationMode) == 0 || id(operationMode) == 1) {
auto prevLatency = id(soyo_latency).state;
if (prevLatency > 3000) {
auto l = id(soyo_latency).make_call();
l.set_value(2050);
l.perform();
}
if (id(operationMode) == 0) {
auto b = id(soyo_buffer).make_call();
b.set_value(2);
b.perform();
}
}
else {
auto prevLatency = id(soyo_latency).state;
if (prevLatency < 3000) {
auto l = id(soyo_latency).make_call();
l.set_value(4550);
l.perform();
}
auto prevBuffer = id(soyo_buffer).state;
if (prevBuffer == 2) {
auto b = id(soyo_buffer).make_call();
b.set_value(0);
b.perform();
}
}
if (id(min_batt_temp).state > 14.5 && id(max_batt_temp).state < 39) {
id(maxChargeW) = 2300;
}
else if (id(min_batt_temp).state < 7) {
id(maxChargeW) = 100;
}
else if (id(min_batt_temp).state < 8 || id(max_batt_temp).state > 43) {
id(maxChargeW) = 200;
}
else if (id(min_batt_temp).state < 9) {
id(maxChargeW) = 300;
}
else if (id(min_batt_temp).state < 10) {
id(maxChargeW) = 400;
}
else if (id(min_batt_temp).state < 11 || id(max_batt_temp).state > 40) {
id(maxChargeW) = 550;
}
else if (id(min_batt_temp).state < 12) {
id(maxChargeW) = 750;
}
else {
id(maxChargeW) = 900;
}
- lambda: |-
if (id(soyo_operation_mode).state == "PV") {
id(max_demand) = 1120;
} else {
id(max_demand) = 920;
}
int md = id(soyo_max_demand).state;
if ((md == 920.0 || md == 1120.0) && md != id(max_demand)) {
auto numberF = id(soyo_max_demand).make_call();
numberF.set_value(id(max_demand));
numberF.perform();
}
- lambda: |-
ESP_LOGW("CPU", "CPU freq: %d", esp_clk_cpu_freq());
#display settings of the soyo to set automatically:
- interval: 101s
startup_delay: 19s
then:
- if:
condition:
- lambda: "return { id(soyo_output_limit).state != 900.0 };"
then:
- number.set:
id: soyo_output_limit
value: 900
- if:
condition:
- lambda: "return { id(soyo_start_delay).state != 3.0 };"
then:
- number.set:
id: soyo_start_delay
value: 3
- if:
condition:
- lambda: "return { id(soyo_operation_mode).state == \"Battery Constant Power\" };"
then:
- select.set:
id: soyo_operation_select
option: "Battery Limit"
- interval: 43s
startup_delay: 3s
then:
- switch.turn_on: ntc_vcc
- component.update: adc1
- component.update: adc2
- switch.turn_off: ntc_vcc
- interval: 50ms
startup_delay: 1s
then:
- component.update: mpptSensor
- component.update: soyoSensor
substitutions:
name: jk-bms
device_description: "Monitor and control a JK-BMS via bluetooth"
external_components_source_jk: github://syssi/esphome-jk-bms@main
mac_address: C8:47:8C:E9:44:3F
protocol_version: JK02_32S
name_soyo: soyo
device_description_soyo: "Soyosource GTN control the power output on demand both via RS485"
external_components_source_soyo: github://syssi/esphome-soyosource-gtn-virtual-meter@main
external_components:
- source: ${external_components_source_jk}
refresh: 0s
- source: github://kev300/esphome-soyosource-gtn-virtual-meter@overshoot_compensation
refresh: 0s
#- source: ${external_components_source_soyo}
#refresh: 7d
esp32_ble_tracker:
scan_parameters:
interval: 640ms
continuous: false
on_ble_advertise:
then:
- lambda: |-
if (x.get_name().rfind("JK-", 0) == 0) {
ESP_LOGI("ble_adv", "New JK-BMS found");
ESP_LOGI("ble_adv", " Name: %s", x.get_name().c_str());
ESP_LOGI("ble_adv", " MAC address: %s", x.address_str().c_str());
ESP_LOGD("ble_adv", " Advertised service UUIDs:");
for (auto uuid : x.get_service_uuids()) {
ESP_LOGD("ble_adv", " - %s", uuid.to_string().c_str());
}
}
ble_client:
- mac_address: ${mac_address}
id: client0
jk_bms_ble:
- ble_client_id: client0
protocol_version: ${protocol_version}
throttle: 0s
id: bms0
i2c:
sda: GPIO14
scl: GPIO27
scan: true
ads1115:
- address: 0x4A
uart:
- id: uart_powerd
baud_rate: 4800
tx_pin: GPIO18
rx_pin: GPIO19
- id: uart_display
baud_rate: 9600
tx_pin: GPIO16
rx_pin: GPIO17
soyosource_modbus:
- id: modbus1
uart_id: uart_powerd
# Optional settings
#
# The name is used as prefix for some log messages and should
# help to distinguish between different instances/devices
name: garage_inverter
soyosource_virtual_meter:
- id: virtualmeter0
soyosource_modbus_id: modbus1
# The state of this sensor (instantaneous power in watt) is used as source
power_id: powermeter_with_fallback
# Optional settings
power_sensor_inactivity_timeout: 20s
power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED
min_power_demand: 0
max_power_demand: 1120
# Split/distribute the power demand if you have multiple inverters attached to the same RS485 bus
power_demand_divider: 1
# A positive buffer value (10) tries to avoid exporting power to the grid (demand - 10 watts)
# A negative buffer value (-10) exports power to the grid (demand + 10 watts)
buffer: 0
zero_output_on_min_power_demand: true
max_power_sensor_latency_ms: 4550
# The operation_status_id sensor is expected here. Passing the operation_status won't work
# The state is used to suspend the limiter if the operation status of the inverter isn't 0x0 (normal)
# operation_status_id: operation_status_id0
update_interval: never
soyosource_display:
- id: soyo_display
uart_id: uart_display
protocol_version: SOYOSOURCE_DISPLAY_VERSION
update_interval: 5s
binary_sensor:
- platform: jk_bms_ble
balancing:
name: "${name} balancing"
online_status:
name: "${name} online status"
- platform: soyosource_display
limiter_connected:
name: "${name_soyo} limiter connected"
- platform: gpio
pin:
number: GPIO34
inverted: true
mode:
input: true
id: garage_is_closed
on_press:
then:
- cover.template.publish:
id: garage_cover
position: !lambda 'return 0.0;'
# current_operation: IDLE
- lambda: id(garageDoorState) = 0;
on_release:
then:
- cover.template.publish:
id: garage_cover
position: 0.5
# current_operation: OPENING
- platform: gpio
pin:
number: GPIO35
inverted: false
mode:
input: true
id: garage_is_open
on_press:
then:
- cover.template.publish:
id: garage_cover
position: !lambda 'return 1.0;'
# current_operation: IDLE
- lambda: id(garageDoorState) = 1;
on_release:
then:
- cover.template.publish:
id: garage_cover
position: 0.5
# current_operation: CLOSING
cover:
- platform: template
id: garage_cover
name: "Garagentor"
has_position: true
lambda: |-
if (id(garage_is_closed).state) {
return 0.0;
}
else if (id(garage_is_open).state) {
return 1.0;
}
else {
return 0.5;
}
open_action:
- if:
condition:
- lambda: 'return (!id(garage_is_closed).state && !id(garage_is_open).state && id(garageDoorState) == 0);'
then:
# closing
- switch.turn_on: garage_toggle_switch
- delay: 500ms
# stopping:
- switch.turn_on: garage_toggle_switch
- delay: 500ms
# opening:
- switch.turn_on: garage_toggle_switch
else:
- switch.turn_on: garage_toggle_switch
close_action:
- if:
condition:
- lambda: 'return (!id(garage_is_closed).state && !id(garage_is_open).state && id(garageDoorState) == 1);'
then:
# opening:
- switch.turn_on: garage_toggle_switch
- delay: 500ms
# stopping:
- switch.turn_on: garage_toggle_switch
- delay: 500ms
# closing:
- switch.turn_on: garage_toggle_switch
else:
- switch.turn_on: garage_toggle_switch
stop_action:
- switch.turn_on: garage_toggle_switch
position_action:
- lambda: |-
if (pos < 0.2) {
auto call = id(garage_cover).make_call();
call.set_command_close();
call.perform();
}
else if (pos > 0.8) {
auto call = id(garage_cover).make_call();
call.set_command_open();
call.perform();
}
else {
id(garage_tilt_switch).turn_on();
}
button:
- platform: soyosource_display
restart:
name: "${name_soyo} restart"
- platform: jk_bms_ble
retrieve_settings:
name: "${name} retrieve settings"
retrieve_device_info:
name: "${name} retrieve device info"
number:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
manual_power_demand:
name: "${name_soyo} manual power demand"
max_value: 1300
max_power_demand:
name: "${name_soyo} max power demand"
id: soyo_max_demand
initial_value: 920
max_value: 1120
restore_value: false
buffer:
name: "${name_soyo} buffer"
id: soyo_buffer
initial_value: 0
restore_value: true
max_power_sensor_latency_ms:
name: "${name_soyo} sensor_latency"
id: soyo_latency
initial_value: 4550
restore_value: false
- platform: soyosource_display
start_voltage:
name: "${name_soyo} start voltage"
shutdown_voltage:
name: "${name_soyo} shutdown voltage"
# Maximum output power in limiter mode / Output power in constant power mode
output_power_limit:
name: "${name_soyo} output power limit"
id: soyo_output_limit
start_delay:
name: "${name_soyo} start delay"
id: soyo_start_delay
- platform: jk_bms_ble
jk_bms_ble_id: bms0
balance_trigger_voltage:
name: "${name} balance trigger voltage"
total_battery_capacity:
name: "${name} total battery capacity"
cell_voltage_overvoltage_protection:
name: "${name} cell voltage overvoltage protection"
cell_voltage_overvoltage_recovery:
name: "${name} cell voltage overvoltage recovery"
cell_voltage_undervoltage_protection:
name: "${name} cell voltage undervoltage protection"
cell_voltage_undervoltage_recovery:
name: "${name} cell voltage undervoltage recovery"
balance_starting_voltage:
name: "${name} balance starting voltage"
power_off_voltage:
name: "${name} power off voltage"
max_balance_current:
name: "${name} max balance current"
max_charge_current:
name: "${name} max charge current"
max_discharge_current:
name: "${name} max discharge current"
select:
- platform: soyosource_display
operation_mode:
name: "${name_soyo} operation mode"
id: soyo_operation_select
optionsmap:
1: "PV"
2: "Battery Constant Power"
16: "Battery Limit"
#debug:
# update_interval: 5s
sensor:
# - platform: debug
# free:
# name: "Heap Free"
# block:
# name: "Heap Max Block"
# loop_time:
# name: "Loop Time"
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "WiFi Signal %"
update_interval: 120s
filters:
- lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
unit_of_measurement: "%"
entity_category: "diagnostic"
- platform: dht
pin: GPIO26
temperature:
name: "Garage Temperatur"
id: garage_temp
humidity:
name: "Garage Feuchtigkeit"
id: garage_humid
update_interval: 120s
- platform: ina226
address: 0x40
update_interval: never
id: soyoSensor
shunt_resistance: 0.0015 ohm
max_current: 50A
adc_time:
voltage: 140us
current: 332us
adc_averaging: 128
current:
#name: "Inverter amps"
id: inverter_amps
filters:
- exponential_moving_average:
send_every: 5
alpha: 0.079
- offset: 0.001526
on_value:
then:
- component.update: soyo_power
- component.update: powermeter_with_fallback
- component.update: charging_power
- component.update: discharging_power
- component.update: combinedAmps
bus_voltage:
id: pv_voltage
filters:
- exponential_moving_average:
send_every: 10
- calibrate_linear:
- 0.0 -> 0.0
- 16.98 -> 53.47
- platform: ina226
address: 0x41
shunt_resistance: 0.0015 ohm
max_current: 50A
adc_time:
voltage: 140us
current: 332us
adc_averaging: 128
update_interval: never
id: mpptSensor
current:
id: charging_amps
#name: cargingAmps
filters:
- exponential_moving_average:
send_every: 5
- multiply: -1
on_value:
then:
- component.update: solar_power_only
bus_voltage:
id: batt_voltage
#name: bvv
filters:
- exponential_moving_average:
send_every: 5
- calibrate_linear:
- 0.0 -> 0.0
- 23.46 -> 47.04
# import smartmeter reading from homeassistant
# # requires the "api" component see above
- platform: homeassistant
id: powermeter0
entity_id: sensor.power_consumption
filters:
- lambda: if (x < -700) return -700; return x; #sometimes the meter reports very low values!? + slow down ramp down
- platform: template
id: powermeter_with_fallback
update_interval: never
internal: true
unit_of_measurement: W
lambda: |-
auto demand = id(solar_power_only).raw_state - id(soyo_power).raw_state;
auto chargingW = demand;
switch (id(operationMode)) {
case 1:
//no api connection, only solar above 60W, else charging
if (id(solar_power_only).raw_state < 70) {
demand = id(soyo_buffer).state -20; //get's to 0W demand slowly
}
break;
case 2:
if (id(solar_power_only).raw_state > 70) {
if (demand > id(powermeter0).state) {
demand = id(powermeter0).state;
}
}
else {
demand = id(soyo_buffer).state -20; //get's to 0W demand slowly
}
break;
case 3:
demand = id(powermeter0).state;
break;
case 4:
demand = -100; //off / only charging
break;
case 0:
default:
//protect battery, no charging
if (id(solar_power_only).raw_state > 7) {
return demand;
}
else {
return -1;
}
}
if (chargingW - demand > id(maxChargeW)) {
return chargingW - id(maxChargeW);
}
return demand;
- platform: template
id: soyo_power
name: "soyo power"
unit_of_measurement: W
device_class: power
state_class: measurement
lambda: |-
return id(batt_voltage).state * id(inverter_amps).state;
update_interval: never
filters:
- throttle_average: 5s
- platform: template
id: solar_power_only
unit_of_measurement: W
device_class: power
state_class: measurement
lambda: |-
return (isnan(id(batt_voltage).state) ? 0 : id(batt_voltage).state) * id(charging_amps).state;
update_interval: never #updated by batt_voltage
on_value:
then:
- component.update: solar_power_positive
- platform: template
id: solar_power_positive
lambda: return id(solar_power_only).state;
filters:
- clamp:
min_value: 0
update_interval: never
- platform: template
id: charging_power
unit_of_measurement: W
lambda: |-
auto w = id(solar_power_only).raw_state - id(soyo_power).raw_state;
return w < 0 ? 0 : w;
update_interval: never
- platform: template
id: discharging_power
unit_of_measurement: W
lambda: |-
auto w = id(soyo_power).raw_state - id(solar_power_only).raw_state;
return w < 0 ? 0 : w;
update_interval: never
- platform: template
id: batt_voltage_avg
update_interval: 60s
lambda: return id(batt_voltage).state;
filters:
- sliding_window_moving_average:
window_size: 6
send_every: 1
on_value_range:
- above: 53.1
then:
- number.set:
id: soyo_buffer
value: -10
- below: 53
then:
- number.set:
id: soyo_buffer
value: 0
- above: 44.7
then:
- number.set:
id: soyo_max_demand
value: !lambda |-
return id(max_demand);
- below: 44.2
then:
- number.set:
id: soyo_max_demand
value: 200
- platform: template
id: combinedAmps
lambda: |-
auto a = id(charging_amps).state - id(inverter_amps).state;
if (a > 0) {
return a * 0.98; // reduce SOC drift by efficency loss of battery
}
return a;
update_interval: never
- platform: integration
id: coulomb_counter
#name: cc
sensor: combinedAmps
accuracy_decimals: 0
time_unit: s
restore: true
filters:
- throttle: 10s
on_value:
then:
- lambda: if (x > 1) { id(coulomb_counter).reset(); }
- platform: template
name: PV Batt SOC
id: batt_soc
lambda: return(id(coulomb_counter).state);
update_interval: 180s
unit_of_measurement: '%'
accuracy_decimals: 0
device_class: battery
state_class: measurement
filters:
- calibrate_linear:
- -306000 -> 0 #85Ah *60 *60 -> As
- 0 -> 100
- clamp:
min_value: 0
max_value: 100
# throttled for HA:
- platform: template
name: "Garage System Power"
unit_of_measurement: W
device_class: power
state_class: measurement
accuracy_decimals: 2
update_interval: 5s
lambda: return id(solar_power_only).raw_state - id(soyo_power).raw_state;
- platform: template
name: "solarstrom power"
unit_of_measurement: W
device_class: power
state_class: measurement
entity_category: diagnostic
accuracy_decimals: 2
icon: mdi:solar-power-variant
lambda: return id(solar_power_only).state;
update_interval: 5s
- platform: template
name: "Batt Volt"
unit_of_measurement: V
device_class: voltage
state_class: measurement
accuracy_decimals: 2
lambda: return id(batt_voltage).state;
update_interval: 5s
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
power_demand:
name: "${name_soyo} power demand"
unit_of_measurement: W
device_class: power
state_class: measurement
entity_category: diagnostic
- platform: total_daily_energy
name: "${name} charging energy today"
icon: mdi:counter
power_id: charging_power
accuracy_decimals: 3
unit_of_measurement: kWh
restore: true
filters:
- throttle: 120s
- multiply: 0.925 #dc -> ac conversion 92,5%
- multiply: 0.001 #Wh -> kWh
- platform: total_daily_energy
name: "${name} discharging energy today"
icon: mdi:counter
power_id: discharging_power
accuracy_decimals: 3
unit_of_measurement: kWh
restore: true
filters:
- throttle: 120s
- multiply: 0.925 #dc -> ac conversion 92,5%
- multiply: 0.001 #Wh -> kWh
- platform: total_daily_energy
name: "solarstrom energy"
id: solar_energy_today
icon: mdi:counter
power_id: solar_power_positive
accuracy_decimals: 3
unit_of_measurement: kWh
restore: true
filters:
- throttle: 120s
- multiply: 0.925 #dc -> ac conversion 92,5%
- multiply: 0.001 #Wh -> kWh
- platform: ads1115
multiplexer: 'A0_GND'
gain: 4.096
id: adc1
update_interval: never
- platform: ads1115
multiplexer: 'A1_GND'
gain: 4.096
id: adc2
update_interval: never
- platform: resistance
id: resistance_sensor_1
sensor: adc1
configuration: DOWNSTREAM
resistor: 5.75kOhm
reference_voltage: 3.2V
- platform: resistance
id: resistance_sensor_2
sensor: adc2
configuration: DOWNSTREAM
resistor: 5.75kOhm
reference_voltage: 3.2V
- platform: ntc
sensor: resistance_sensor_1
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: "Batt Temp 3"
id: batt_temp3
filters:
- sliding_window_moving_average:
window_size: 7
send_every: 3
- platform: ntc
sensor: resistance_sensor_2
calibration:
b_constant: 3950
reference_temperature: 25°C
reference_resistance: 10kOhm
name: "Batt Temp 4"
id: batt_temp4
filters:
- sliding_window_moving_average:
window_size: 7
send_every: 3
- platform: combination
type: min
id: min_batt_temp
sources:
- source: batt_temp1
- source: batt_temp2
- source: batt_temp3
- source: batt_temp4
- platform: combination
type: max
id: max_batt_temp
sources:
- source: batt_temp1
- source: batt_temp2
- source: batt_temp3
- source: batt_temp4
- platform: soyosource_display
error_bitmask:
name: "${name_soyo} error bitmask"
# operation_status_id:
# name: "${name_soyo} operation status id"
# id: operation_status_id0
battery_voltage:
name: "${name_soyo} battery voltage"
id: soyo_batt_voltage
filters:
- throttle: 10s
battery_current:
name: "${name_soyo} battery current"
id: soyo_batt_current