-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathloadvars.sh
executable file
·1598 lines (1479 loc) · 59.7 KB
/
loadvars.sh
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
#!/bin/bash
# dies ist utf8 äöüäöü
# Gloval und sofort beim sourcen
read lademodus <ramdisk/lademodus
openwbDebugLog "MAIN" 2 "Source loadvars.sh (mode:$lademodus)"
function awokedisplay()
{
openwbDebugLog "MAIN" 0 "Awoke internal Display"
export DISPLAY=:0 && xset dpms force on && xset dpms $displaysleep $displaysleep $displaysleep
sudo -u pi XAUTHORITY=~pi/.Xauthority DISPLAY=:0 xset dpms force on
}
function timerun() # time cmd paras
{
local time=$1
shift;
local cmd=$1
shift;
# openwbDebugLog "MAIN" 0 "EXEC:timout $time $cmd $*"
if timeout -k $time $time $cmd $* >/dev/null
then
rc=$? # 0
# log Ok $rc
else
rc=$? # err or 124
openwbDebugLog "ERR" 0 "TIMEOUT:$rc $time [$cmd] [$*] "
openwbDebugLog "MAIN" 0 "ERROR TIMEOUT:$rc $time [$cmd] [$*] "
fi
return $rc
}
function dotimed()
{
local mod=$1
local time=${2:-0}
if [[ -x $mod ]] ; then
if (( time > 0 )) ; then
xpt=$ptx
ptstart
timerun $time $mod
rc=$?
ptend $mod 100
ptx=$xpt
else
$mod &
rc=0
fi
else
openwbDebugLog "MAIN" 1 "NO $mod found"
rc=0
fi
return $rc
}
#########################################################
### Openwb.conf Sync module
#########################################################
source ./openwbconf.sh
loadvars(){
#reload mqtt vars
read renewmqtt <ramdisk/renewmqtt
if (( renewmqtt == 1 )); then
echo 0 > ramdisk/renewmqtt
echo 01 | tee ramdisk/mqtt*
openwbDebugLog "MAIN" 1 "RenewMQTT copy 01 to all ramdiskvalues"
openwbDebugLog "MAIN" 1 "RenewMQTT so all mqtt var are set new at end of loadvar."
fi
#get temp vars
read sofortll <ramdisk/lp1sofortll
read sofortlls1 <ramdisk/lp2sofortll
read sofortlls2 <ramdisk/lp3sofortll
#NC oaktgeladens1=$(<ramdisk/mqttaktgeladens1)
#NC oaktgeladens2=$(<ramdisk/mqttaktgeladens2)
#NC oaktgeladen=$(<ramdisk/mqttaktgeladen)
#NC olastregelungaktiv=$(<ramdisk/lastregelungaktiv)
#NC oLadereglerTxt=$(<ramdisk/LadereglerTxt)
read ohook1akt <ramdisk/hook1akt
read ohook2akt <ramdisk/hook2akt
read ohook3akt <ramdisk/hook3akt
read ladestatus <ramdisk/ladestatus
read ladestatuss1 <ramdisk/ladestatuss1
read ladestatuss2 <ramdisk/ladestatuss2
read lp1enabled <ramdisk/lp1enabled
read lp2enabled <ramdisk/lp2enabled
read lp3enabled <ramdisk/lp3enabled
read etproviderprice <ramdisk/etproviderprice
read etprovidermaxprice <ramdisk/etprovidermaxprice
read verbraucher1_watt <ramdisk/verbraucher1_watt
read verbraucher2_watt <ramdisk/verbraucher2_watt
#read ollkombiniert <ramdisk/llkombiniert
read version <web/version
# EVSE DIN Plug State
declare -r IsNumberRegex='^[0-9]+$'
if [[ $evsecon == "modbusevse" ]]; then
if ((modbusevseid == 0)); then
if [ -f ramdisk/evsemodulconfig ]; then
read modbusevsesource <ramdisk/evsemodulconfig
modbusevseid=1
else
if [[ -e "/dev/ttyUSB0" ]]; then
echo "/dev/ttyUSB0" > ramdisk/evsemodulconfig
else
echo "/dev/serial0" > ramdisk/evsemodulconfig
fi
read modbusevsesource <ramdisk/evsemodulconfig
modbusevseid=1
fi
fi
### 64 modbusevsesource=/dev/ttyUSB0 modbusevseid=1
##################### 1002 get Vehicle Status
openwbDebugLog "MAIN" 1 "EXEC: modbusevse sudo python3 runs/readmodbus.py ip:$modbusevsesource id:$modbusevseid reg:1002 cnt:1"
evseplugstate=$(sudo python3 runs/readmodbus.py $modbusevsesource $modbusevseid 1002 1)
#########################################################################
if [ -z "${evseplugstate}" ] || ! [[ "${evseplugstate}" =~ $IsNumberRegex ]]; then
# EVSE read returned empty or non-numeric value --> use last state for this loop
read evseplugstate <ramdisk/evseplugstate
openwbDebugLog "MAIN" 0 "Modbus EVSE read CP1 issue - using previous state '${evseplugstate}'"
else
echo $evseplugstate > ramdisk/evseplugstate
fi
read ladestatuslp1 <ramdisk/ladestatus
if ((evseplugstate >= 0)) && ((evseplugstate <= 10)); then
read plugstat <ramdisk/plugstat
if ((evseplugstate > 1)); then
if ((plugstat == 0)) ; then
if ((pushbplug == 1)) && ((ladestatuslp1 == 0)) && ((pushbenachrichtigung == 1)) ; then
message="Fahrzeug eingesteckt. Ladung startet bei erfüllter Ladebedingung automatisch."
#########################################################################
openwbDebugLog "MAIN" 2 "EXEC: runs/pushover.sh"
runs/pushover.sh "$message"
#########################################################################
fi
if ((displayconfigured == 1)) && ((displayEinBeimAnstecken == 1)) ; then
openwbDebugLog "MAIN" 0 "Awoke1 internal Display"
awokedisplay
fi
echo 20000 > ramdisk/soctimer
fi
echo 1 > ramdisk/plugstat
plugstat=1
else
if ((plugstat >0 )); then
openwbDebugLog "MAIN" 0 "***** evse meldet unpluged(<=1), korrigiere plugstat=0"
echo 0 > ramdisk/plugstat
fi
plugstat=0
fi
if ((evseplugstate > 2)) && ((ladestatuslp1 == 1)) && ((lp1enabled == 1)); then
echo 1 > ramdisk/chargestat
chargestat=1
else
echo 0 > ramdisk/chargestat
chargestat=0
fi
fi
else
read pluggedin <ramdisk/pluggedin
if ((pluggedin > 0)); then
if ((pushbplug == 1)) && ((ladestatuslp1 == 0)) && ((pushbenachrichtigung == 1)) ; then
message="Fahrzeug eingesteckt. Ladung startet bei erfüllter Ladebedingung automatisch."
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: runs/pushover.sh"
runs/pushover.sh "$message"
#########################################################################
fi
if ((displayconfigured == 1)) && ((displayEinBeimAnstecken == 1)) ; then
openwbDebugLog "MAIN" 0 "Awoke2 internal Display"
awokedisplay
fi
echo 20000 > ramdisk/soctimer
echo 0 > ramdisk/pluggedin
fi
read plugstat <ramdisk/plugstat
read chargestat <ramdisk/chargestat
fi
if [[ $evsecon == "ipevse" ]]; then ## Alter Satellit ohne Pi3
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: ipevse sudo python runs/readipmodbus.py $evseiplp1 $evseidlp1 1002 1"
evseplugstatelp1=$(sudo python runs/readipmodbus.py $evseiplp1 $evseidlp1 1002 1)
#########################################################################
if [ -z "${evseplugstate}" ] || ! [[ "${evseplugstate}" =~ $IsNumberRegex ]]; then
read evseplugstate <ramdisk/evseplugstate
openwbDebugLog "MAIN" 0 "IP EVSE read CP1 issue - using previous state '${evseplugstate}'"
else
echo $evseplugstate > ramdisk/evseplugstate
fi
read ladestatuslp1 <ramdisk/ladestatus
if ((evseplugstatelp1 > 1)); then
echo 1 > ramdisk/plugstat
else
echo 0 > ramdisk/plugstat
fi
if ((evseplugstatelp1 > 2)) && ((ladestatuslp1 == 1)) && ((lp1enabled == 1)); then
echo 1 > ramdisk/chargestat
else
echo 0 > ramdisk/chargestat
fi
fi
if ((lastmanagement == 1)); then
ConfiguredChargePoints=2
if [[ $evsecons1 == "modbusevse" ]]; then
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: modbusevse sudo python runs/readmodbus.py ip:$evsesources1 id:$evseids1 reg:1002 cnt:1"
evseplugstatelp2=$(sudo python runs/readmodbus.py $evsesources1 $evseids1 1002 1)
#########################################################################
if [ -z "${evseplugstatelp2}" ] || ! [[ "${evseplugstatelp2}" =~ $IsNumberRegex ]]; then
read evseplugstatelp2 <ramdisk/evseplugstatelp2
openwbDebugLog "MAIN" 0 "Modbus EVSE read CP2 issue - using previous state '${evseplugstatelp2}'"
else
echo $evseplugstatelp2 > ramdisk/evseplugstatelp2
fi
read ladestatuss1 <ramdisk/ladestatuss1
if ((evseplugstatelp2 > 0)) && ((evseplugstatelp2 < 7)); then
if ((evseplugstatelp2 > 1)); then
read plugstat2 <ramdisk/plugstats1
if ((plugstat2 == 0)) ; then
if ((displayconfigured == 1)) && ((displayEinBeimAnstecken == 1)) ; then
openwbDebugLog "MAIN" 0 "Awoke3 internal Display"
awokedisplay
fi
echo 20000 > ramdisk/soctimer1
fi
echo 1 > ramdisk/plugstats1
plugstat2=1
plugstats1=$plugstat2
else
echo 0 > ramdisk/plugstats1
plugstat2=0
plugstats1=$plugstat2
fi
if ((evseplugstatelp2 > 2)) && ((ladestatuss1 == 1)); then
echo 1 > ramdisk/chargestats1
else
echo 0 > ramdisk/chargestats1
fi
fi
fi
if [[ $evsecons1 == "slaveeth" ]]; then
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: sudo python runs/readslave.py 1002 1"
evseplugstatelp2=$(sudo python runs/readslave.py 1002 1)
#########################################################################
if [ -z "${evseplugstatelp2}" ] || ! [[ "${evseplugstatelp2}" =~ $IsNumberRegex ]]; then
read evseplugstatelp2 <ramdisk/evseplugstatelp2
openwbDebugLog "MAIN" 0 "Slaveeth EVSE read CP2 issue - using previous state '${evseplugstatelp2}'"
else
echo $evseplugstatelp2 > ramdisk/evseplugstatelp2
fi
read ladestatuss1 <ramdisk/ladestatuss1
if ((evseplugstatelp2 > 1)); then
echo 1 > ramdisk/plugstats1
else
echo 0 > ramdisk/plugstats1
fi
if ((evseplugstatelp2 > 2)) && ((ladestatuss1 == 1)); then
echo 1 > ramdisk/chargestats1
else
echo 0 > ramdisk/chargestats1
fi
fi
if [[ $evsecons1 == "ipevse" ]]; then ## Alter Satellit ohne Pi3
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: ipevse sudo python runs/readipmodbus.py ip:$evseiplp2 id:$evseidlp2 reg:1002 cnt:1"
evseplugstatelp2=$(sudo python runs/readipmodbus.py $evseiplp2 $evseidlp2 1002 1)
#########################################################################
if [ -z "${evseplugstatelp2}" ] || ! [[ "${evseplugstatelp2}" =~ $IsNumberRegex ]]; then
read evseplugstatelp2 <ramdisk/evseplugstatelp2
openwbDebugLog "MAIN" 0 "IP EVSE read CP2 issue - using previous state '${evseplugstatelp2}'"
else
echo $evseplugstatelp2 > ramdisk/evseplugstatelp2
fi
read ladestatuslp2 <ramdisk/ladestatuss1
if ((evseplugstatelp2 > 1)); then
echo 1 > ramdisk/plugstats1
else
echo 0 > ramdisk/plugstats1
fi
if ((evseplugstatelp2 > 2)) && ((ladestatuslp2 == 1)) && ((lp2enabled == 1)); then
echo 1 > ramdisk/chargestats1
else
echo 0 > ramdisk/chargestats1
fi
fi
read plugstatlp2 <ramdisk/plugstats1
read chargestatlp2 <ramdisk/chargestats1
read plugstats1 <ramdisk/plugstats1
read chargestats1 <ramdisk/chargestats1
else
read plugstatlp2 <ramdisk/plugstats1
read chargestatlp2 <ramdisk/chargestats1
read plugstats1 <ramdisk/plugstats1
read chargestats1 <ramdisk/chargestats1
ConfiguredChargePoints=1
fi
if ((lastmanagements2 == 1)); then
ConfiguredChargePoints=3
if [[ $evsecons2 == "ipevse" ]]; then ## Alter Satellit ohne Pi3
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: ipevse sudo python runs/readipmodbus.py ip:$evseiplp3 id:$evseidlp3 reg:1002 cnt:1"
evseplugstatelp3=$(sudo python runs/readipmodbus.py $evseiplp3 $evseidlp3 1002 1)
#########################################################################
if [ -z "${evseplugstatelp3}" ] || ! [[ "${evseplugstatelp3}" =~ $IsNumberRegex ]]; then
read evseplugstatelp3 <ramdisk/evseplugstatelp3
openwbDebugLog "MAIN" 0 "IP EVSE read CP3 issue - using previous state '${evseplugstatelp3}'"
else
echo $evseplugstatelp3 > ramdisk/evseplugstatelp3
fi
read ladestatuslp3 <ramdisk/ladestatuss2
if ((evseplugstatelp3 > 1)); then
echo 1 > ramdisk/plugstatlp3
else
echo 0 > ramdisk/plugstatlp3
fi
if ((evseplugstatelp3 > 2)) && ((ladestatuslp3 == 1)) && ((lp3enabled == 1)); then
echo 1 > ramdisk/chargestatlp3
else
echo 0 > ramdisk/chargestatlp3
fi
fi
if [[ $evsecons2 == "modbusevse" ]]; then
#########################################################################
openwbDebugLog "MAIN" 1 "EXEC: modbusevse sudo python runs/readmodbus.py ip:$evsesources2 id:$evseids2 reg:1002 cnt:1"
evseplugstatelp3=$(sudo python runs/readmodbus.py $evsesources2 $evseids2 1002 1)
#########################################################################
if [ -z "${evseplugstatelp3}" ] || ! [[ "${evseplugstatelp3}" =~ $IsNumberRegex ]]; then
read evseplugstatelp3 <ramdisk/evseplugstatelp3
openwbDebugLog "MAIN" 0 "Modbus EVSE read CP3 issue - using previous state '${evseplugstatelp3}'"
else
echo $evseplugstatelp3 > ramdisk/evseplugstatelp3
fi
read ladestatuss2 <ramdisk/ladestatuss2
if ((evseplugstatelp3 > 1)); then
echo 1 > ramdisk/plugstatlp3
else
echo 0 > ramdisk/plugstatlp3
fi
if ((evseplugstatelp3 > 2)) && ((ladestatuss2 == 1)) ; then
echo 1 > ramdisk/chargestatlp3
else
echo 0 > ramdisk/chargestatlp3
fi
fi
read plugstatlp3 <ramdisk/plugstatlp3
read chargestatlp3 <ramdisk/chargestatlp3
else
read plugstatlp3 <ramdisk/plugstatlp3
read chargestatlp3 <ramdisk/chargestatlp3
fi
# LP4 - LP8
echo $ConfiguredChargePoints > ramdisk/ConfiguredChargePoints
# Lastmanagement var check age Lasse Meldung 2 Minuten stehen
if test $(find "ramdisk/lastregelungaktiv" -mmin +2); then
openwbDebugLog "MAIN" 1 "Clear Lastreglegelungstext (>2Min)"
echo " " > ramdisk/lastregelungaktiv
fi
# Werte für die Berechnung ermitteln
read lademodus <ramdisk/lademodus # haben wir oben schon eingelesen, sollte noch der selbe sein
if [ -z "$lademodus" ] ; then
mosquitto_pub -r -t "openWB/set/ChargeMode" -m "$bootmodus" # > ../set/.. Write to Ramdisk und mqtt
lademodus=$bootmodus
fi
llalt=$(cat ramdisk/llsoll)
llaltlp1=$llalt
#PV Leistung ermitteln
# pv1watt Leistung WR1
# pv2watt Leistung WR2
# pvwatt gesamtleistung WR1 und WR2
# pvallwatt gleich zu pvwatt
# pv Counter
# pvkwh zaehler wr1
# pv2kwh zaehler wr2
# pvallwh summe von pvkwh und pv2kwh (wird in cron5 und cronnighly verwendet)
if [[ $pvwattmodul != "none" ]]; then
pv1vorhanden="1"
echo 1 > ramdisk/pv1vorhanden
#########################################################################
openwbDebugLog "MAIN" 2 "EXEC:timerun 5: modules/$pvwattmodul/main.sh"
dotimed "modules/$pvwattmodul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "PV" 2 "Die PV-1 Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 1
fi
read pvwatt <ramdisk/pvwatt
openwbDebugLog "MAIN" 2 "pvwatt: $pvwatt"
#########################################################################
if ! [[ $pvwatt =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für pvwatt: $pvwatt"
pvwatt="0"
fi
pv1watt=$pvwatt
echo $pv1watt > ramdisk/pv1watt
else
pvwatt="0"
pv1watt="0"
pv1vorhanden="0"
echo 0 > ramdisk/pv1vorhanden
read pvwatt <ramdisk/pvwatt
fi
if [[ $pv2wattmodul != "none" ]]; then
pv2vorhanden="1"
echo 1 > ramdisk/pv2vorhanden
#########################################################################
openwbDebugLog "MAIN" 2 "EXEC:timerun 5: modules/$pv2wattmodul/main.sh"
dotimed "modules/$pv2wattmodul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "PV" 2 "Die PV-2 Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 2
fi
read pv2watt <ramdisk/pv2watt
openwbDebugLog "MAIN" 2 "pv2watt: $pv2watt"
#########################################################################
if ! [[ $pv2watt =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für pv2watt: $pv2watt"
pv2watt="0"
fi
echo $pv2watt > ramdisk/pv2watt
pvwatt=$(( pvwatt + pv2watt ))
if ! [[ $pvwatt =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für PV Gesamtleistung: $pvwatt"
pvwatt="0"
fi
echo $pvwatt > ramdisk/pvallwatt
read pvkwh <ramdisk/pvkwh
read pv2kwh <ramdisk/pv2kwh
pvallwh=$(echo "$pvkwh + $pv2kwh" |bc)
echo $pvallwh > ramdisk/pvallwh
else
read pvkwh <ramdisk/pvkwh
pv2vorhanden="0"
pv2watt=0
echo 0 > ramdisk/pv2vorhanden
echo $pvkwh > ramdisk/pvallwh
echo $pvwatt > ramdisk/pvallwatt
fi
speicherleistung=0
#Speicher werte
if [[ $speichermodul != "none" ]] ; then
#########################################################################
openwbDebugLog "MAIN" 2 "EXEC:timerun 5: modules/$speichermodul/main.sh"
dotimed "modules/$speichermodul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "BAT" 2 "Die Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen."
fi
#########################################################################
read speicherleistung <ramdisk/speicherleistung
speicherleistung=${speicherleistung%%[.,]*}
read speichersoc <ramdisk/speichersoc
speichersoc=${speichersoc%%[.,]*}
speichervorhanden=1
echo 1 > ramdisk/speichervorhanden
# if [[ $speichermodul == "speicher_alphaess" ]] ; then
# pvwatt=$(<ramdisk/pvwatt)
# echo 1 > ramdisk/pv1vorhanden
# pv1vorhanden="1"
# fi
# if [[ $speichermodul == "speicher_e3dc" ]] ; then
# pvwatt=$(<ramdisk/pvwatt)
# echo 1 > ramdisk/pv1vorhanden
# pv1vorhanden="1"
# fi
# if [[ $speichermodul == "speicher_sonneneco" ]] ; then
# pvwatt=$(<ramdisk/pvwatt)
# echo 1 > ramdisk/pv1vorhanden
# pv1vorhanden="1"
# fi
else
speichersoc=0
speichervorhanden=0
echo 0 > ramdisk/speichervorhanden
fi
#addition pv nach Speicherauslesung
if [[ $pv2vorhanden == "1" ]]; then
read pv1watt <ramdisk/pv1watt
read pv2watt <ramdisk/pv2watt
pvwatt=$(( pv1watt + pv2watt ))
echo $pvwatt > ramdisk/pvallwatt
echo $pvwatt > ramdisk/pvwatt
else
if [[ $pv1vorhanden == "1" ]]; then
read pv1watt <ramdisk/pv1watt
pvwatt=$pv1watt
echo $pvwatt > ramdisk/pvallwatt
echo $pvwatt > ramdisk/pvwatt
fi
fi
llphaset=3
#Ladeleistung ermitteln
if [[ $ladeleistungmodul != "none" ]]; then
#########################################################################
dotimed "modules/$ladeleistungmodul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "LP" 2 "Die LL-Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 1
fi
#########################################################################
read llkwh <ramdisk/llkwh
llkwhges=$llkwh
lla1=$(cat ramdisk/lla1)
lla2=$(cat ramdisk/lla2)
lla3=$(cat ramdisk/lla3)
lla1=${lla1%%[.,]*}
lla2=${lla2%%[.,]*}
lla3=${lla3%%[.,]*}
llv1=$(cat ramdisk/llv1)
llv2=$(cat ramdisk/llv2)
llv3=$(cat ramdisk/llv3)
ladeleistung=$(cat ramdisk/llaktuell)
ladeleistunglp1=$ladeleistung
if ! [[ $lla1 =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für lla1: $lla1"
lla1="0"
fi
if ! [[ $lla2 =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für lla2: $lla2"
lla2="0"
fi
if ! [[ $lla3 =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für lla3: $lla3"
lla3="0"
fi
lp1phasen=0
if ((lla1 >= llphaset)); then
((lp1phasen++))
fi
if ((lla2 >= llphaset)); then
((lp1phasen++))
fi
if ((lla3 >= llphaset)); then
((lp1phasen++))
fi
echo "$lp1phasen" > ramdisk/lp1phasen
if ! [[ $ladeleistung =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für ladeleistung: $ladeleistung"
ladeleistung="0"
fi
read ladestatus <ramdisk/ladestatus
else
lla1=0
lla2=0
lla3=0
llv1=0
llv2=0
llv3=0
ladeleistung=0
ladeleistunglp1=0
llkwh=0
llkwhges=$llkwh
fi
#zweiter ladepunkt
if ((lastmanagement == 1)); then
if [[ $socmodul1 != "none" ]]; then
#########################################################################
#openwbDebugLog "MAIN" 1 "EXEC&: modules/$socmodul1/main.sh &"
dotimed "modules/$socmodul1/main.sh"
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "EVSOC" 2 "Die SOC-2 Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 2
fi
#########################################################################
read soc1 <ramdisk/soc1
read tmpsoc1 <ramdisk/tmpsoc1
if ! [[ $soc1 =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für soc1: $soc1"
soc1=$tmpsoc1
else
echo $soc1 > ramdisk/tmpsoc1
fi
soc1vorhanden=1
echo 1 > ramdisk/soc1vorhanden
else
echo 0 > ramdisk/soc1vorhanden
soc1=0
soc1vorhanden=0
fi
#########################################################################
openwbDebugLog "MAIN" 2 "EXEC:timerun 5: modules/$ladeleistungs1modul/main.sh"
dotimed "modules/$ladeleistungs1modul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "LP" 2 "Die LL-Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 2
fi
#########################################################################
read llkwhs1 <ramdisk/llkwhs1
llkwhges=$(echo "$llkwhges + $llkwhs1" |bc)
llalts1=$(cat ramdisk/llsolls1)
ladeleistungs1=$(cat ramdisk/llaktuells1)
ladeleistunglp2=$ladeleistungs1
llas11=$(cat ramdisk/llas11)
llas12=$(cat ramdisk/llas12)
llas13=$(cat ramdisk/llas13)
llas11=${llas11%%[.,]*}
llas12=${llas12%%[.,]*}
llas13=${llas13%%[.,]*}
read ladestatuss1 <ramdisk/ladestatuss1
if ! [[ $ladeleistungs1 =~ $re ]] ; then
ladeleistungs1="0"
fi
ladeleistung=$(( ladeleistung + ladeleistungs1 ))
echo "$ladeleistung" > ramdisk/llkombiniert
lp2phasen=0
if ((llas11 >= llphaset)); then
((lp2phasen++))
fi
if ((llas12 >= llphaset)); then
((lp2phasen++))
fi
if ((llas13 >= llphaset)); then
((lp2phasen++))
fi
echo "$lp2phasen" > ramdisk/lp2phasen
else
echo "$ladeleistung" > ramdisk/llkombiniert
ladeleistunglp2=0
soc1vorhanden=0
ladestatuss1=0
llas1=0
llas11=0
llas12=0
llas13=0
soc1=0
ladeleistungs1=0
llalts1=0
fi
#dritter ladepunkt
if ((lastmanagements2 == 1)); then
#########################################################################
openwbDebugLog "MAIN" 2 "EXEC:timerun 5: modules/$ladeleistungs2modul/main.sh"
dotimed "modules/$ladeleistungs2modul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "LP" 2 "Die LL-Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 3
fi
#########################################################################
read llkwhs2 <ramdisk/llkwhs2
llkwhges=$(echo "$llkwhges + $llkwhs2" |bc)
llalts2=$(cat ramdisk/llsolls2)
ladeleistungs2=$(cat ramdisk/llaktuells2)
ladeleistunglp3=$ladeleistungs2
llas21=$(cat ramdisk/llas21)
llas22=$(cat ramdisk/llas22)
llas23=$(cat ramdisk/llas23)
llas21=${llas21%%[.,]*}
llas22=${llas22%%[.,]*}
llas23=${llas23%%[.,]*}
lp3phasen=0
if ((llas21 >= llphaset)); then
((lp3phasen++))
fi
if ((llas22 >= llphaset)); then
((lp3phasen++))
fi
if ((llas23 >= llphaset)); then
((lp3phasen++))
fi
echo $lp3phasen > ramdisk/lp3phasen
read ladestatuss2 <ramdisk/ladestatuss2
if ! [[ $ladeleistungs2 =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für ladeleistungs2: $ladeleistungs2"
ladeleistungs2="0"
fi
ladeleistung=$(( ladeleistung + ladeleistungs2 ))
echo "$ladeleistung" > ramdisk/llkombiniert
else
echo "$ladeleistung" > ramdisk/llkombiniert
ladeleistungs2="0"
ladeleistunglp3=0
llas21=0
llas22=0
llas23=0
llalts2=0
fi
# lp3-lp8
echo "$ladeleistung" > ramdisk/llkombiniert
echo $llkwhges > ramdisk/llkwhges
#Schuko-Steckdose an openWB als CP2 (Duo)
# if [[ $standardSocketInstalled == "1" ]]; then
#########################################################################
# #openwbDebugLog "MAIN" 1 "EXEC: timeout 8 modules/sdm120modbusSocket/main.sh"
# #timeout 8 modules/sdm120modbusSocket/main.sh || true
# timerun 8 modules/sdm120modbusSocket/main.sh
#########################################################################
# socketkwh=$(<ramdisk/socketkwh)
# socketp=$(cat ramdisk/socketp)
# socketa=$(cat ramdisk/socketa)
# socketa=${socketa%%[.,]*}
# socketv=$(cat ramdisk/socketv)
# if ! [[ $socketa =~ $re ]] ; then
# openwbDebugLog "MAIN" 0 "ungültiger Wert für socketa: $socketa"
# socketa="0"
# fi
# fi
#Wattbezug
if [[ $wattbezugmodul != "none" ]]; then
#########################################################################
#openwbDebugLog "MAIN" 1 "EXEC: timeout 5 modules/$wattbezugmodul/main.sh"
#if
# timeout 5 modules/$wattbezugmodul/main.sh >/dev/null
#then
# wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
#else
# openwbDebugLog "DEB" 0 " EVU > 5 !!! "
# wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
#fi
openwbDebugLog "MAIN" 2 "EXEC:timerun 5: modules/$wattbezugmodul/main.sh"
dotimed "modules/$wattbezugmodul/main.sh" 5
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "EVU" 2 "Die EVU Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen."
fi
read wattbezug <ramdisk/wattbezug
openwbDebugLog "MAIN" 2 "Wattbezug: $wattbezug"
#########################################################################
if ! [[ $wattbezug =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für wattbezug: $wattbezug"
wattbezug="0"
fi
wattbezugint=$(printf "%.0f\n" $wattbezug)
#evu glaettung
local glaettungw=0
if (( evuglaettungakt == 1 )); then
if (( evuglaettung > 20 )); then
ganzahl=$(( evuglaettung / 10 ))
for ((i=ganzahl;i>=1;i--)); do
i2=$(( i + 1 ))
cp ramdisk/glaettung$i ramdisk/glaettung$i2
done
echo $wattbezug > ramdisk/glaettung1
for ((i=1;i<=ganzahl;i++)); do
read glaettung <ramdisk/glaettung$i
glaettungw=$(( glaettung + glaettungw))
done
glaettungfinal=$((glaettungw / ganzahl))
echo $glaettungfinal > ramdisk/glattwattbezug
wattbezug=$glaettungfinal
openwbDebugLog "MAIN" 2 "Nach Glättung Wattbezug: $wattbezug"
fi
fi
# speicherpveinbeziehen=0 = Speicherladen hat vorrang
# - speicherwattnurpv = 1500
# - speichersocnurpv = 30%
# speicherpveinbeziehen=1 = EV Laden hat vorang
# - speichermaxwatt 200 (soviel soll troztzden nindestns in den speiher geaden werden
#uberschuss zur berechnung
openwbDebugLog "PV" 0 "----------------------"
uberschuss=$(printf "%.0f\n" $((-wattbezug)))
if (( uberschuss > 0 )) ; then
openwbDebugLog "PV" 0 "1: UEBERSCHUSS $uberschuss Watt EXPORT aus wattbezug "
else
openwbDebugLog "PV" 0 "1: UEBERSCHUSS $uberschuss Watt IMPORT aus wattbezug "
fi
if ((speichervorhanden == 1)); then
openwbDebugLog "PV" 0 "2: SP/EV:$speicherpveinbeziehen SPL:${speicherleistung}W [${speichersoc}% > ${speichersocnurpv}%] "
bmeld "U:${uberschuss}W"
if ((speicherpveinbeziehen == 1)); then
# EV Vorrang
openwbDebugLog "PV" 1 "3: Speicher vorhanden und EV Vorrang"
if (( speicherleistung > 0 )); then # es wird gerade der hausakku geladen
if (( speichersoc > speichersocnurpv )); then # der hausakku ist voll genug
speicherww=$((speicherleistung + speicherwattnurpv)) # Akt HauskakkuLadeleistung + Erlaubt Endladeleistung
uberschuss=$((uberschuss + speicherww)) # draufpacken
openwbDebugLog "PV" 0 "4a: UEBERSCHUSS $uberschuss + ($speicherleistung + $speicherwattnurpv) Hausspeicher voll Genug, stelle ladeleistung und erlaubte Entladeleistung zur verfügung "
bmeld "BEV+ Lade erhohe um +${speicherleistung}W+${speicherwattnurpv}W EndLade => U:${uberschuss}W"
else
# Lade, aber Akku nicht voll genug
# 100%=AUs
# verwende nur die aktelle Ladeleistung als reduziere Akku Ladung auf 0 oder minimum
speicherww=$((speicherleistung - speichermaxwatt))
uberschuss=$((uberschuss + speicherww))
openwbDebugLog "PV" 0 "4b: UEBERSCHUSS $uberschuss ($speicherleistung - $speichermaxwatt) "
bmeld "BEV++ Lade +${speicherleistung}W-${speichermaxwatt}ReserveW => U:${uberschuss}W"
fi
fi
else
# Speicher Vorrang
openwbDebugLog "PV" 0 "4c: UEBERSCHUSS $uberschuss , nix da Speichervorrang"
bmeld "BBAT++ nix U:${uberschuss}W"
fi
else
bmeld "Bat:None"
fi
openwbDebugLog "PV" 0 "5: UEBERSCHUSS $uberschuss nach now"
evuv1=$(cat ramdisk/evuv1)
evuv2=$(cat ramdisk/evuv2)
evuv3=$(cat ramdisk/evuv3)
evua1=$(cat ramdisk/bezuga1)
evua2=$(cat ramdisk/bezuga2)
evua3=$(cat ramdisk/bezuga3)
evua1=${evua1%%[.,]*}
evua2=${evua2%%[.,]*}
evua3=${evua3%%[.,]*}
[[ $evua1 =~ $re ]] || evua1="0"
[[ $evua2 =~ $re ]] || evua2="0"
[[ $evua3 =~ $re ]] || evua3="0"
evuas=($evua1 $evua2 $evua3)
maxevu=${evuas[0]}
lowevu=${evuas[0]}
for v in "${evuas[@]}"; do
if (( v < lowevu )); then lowevu=$v; fi;
if (( v > maxevu )); then maxevu=$v; fi;
done
schieflast=$(( maxevu - lowevu ))
echo $schieflast > ramdisk/schieflast
else
# Kein Wattbezug module da., simuliere wattbezug aus anderen daten
uberschuss=$((-pvwatt - hausbezugnone - ladeleistung))
echo $((-uberschuss)) > ramdisk/wattbezug
openwbDebugLog "PV" 0 "5: UEBERSCHUSS $uberschuss aus simulation (kein EVU Module)"
wattbezugint=$((-uberschuss))
wattbezug=$wattbezugint
evuv1=0
evuv2=0
evuv3=0
evua1=0
evua2=0
evua3=0
fi
# Abschaltbare Smartdevices zum Ueberschuss rechnen
## NC echo $uberschuss > ramdisk/ueberschuss_org
wattabs=$(cat ramdisk/devicetotal_watt)
if (( wattabs>0 )) ; then
uberschuss=$((uberschuss + wattabs))
## NC echo $uberschuss > ramdisk/ueberschuss_mitsmart
openwbDebugLog "PV" 0 "6: UEBERSCHUSS $uberschuss nach addierung der abschaltbaren smartdev"
bmeld "Bat +${wattabs}W abschaltbare => U:${uberschuss}W"
fi
#Soc ermitteln
if [[ "$socmodul" != "none" ]]; then
socvorhanden=1
echo 1 > ramdisk/socvorhanden
if (( stopsocnotpluggedlp1 == 1 )); then
read soctimer <ramdisk/soctimer
# if (( plugstat == 1 )); then
if ((plugstat == 1)) || ((soctimer == 20005)); then # force soc update button sends 20005
#########################################################################
#openwbD ebugLog "MAIN" 1 "EXEC&: modules/$socmodul/main.sh &"
dotimed "modules/$socmodul/main.sh"
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "EVSOC" 2 "Die SOC Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 1
fi
#########################################################################
read soc <ramdisk/soc
read tmpsoc <ramdisk/tmpsoc
if ! [[ $soc =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für soc: $soc"
soc=$tmpsoc
else
echo "$soc" > ramdisk/tmpsoc
fi
else
echo 600 > ramdisk/soctimer
read soc <ramdisk/soc
fi
else
#########################################################################
# openwbDebugLog "MAIN" 1 "EXEC&: modules/$socmodul/main.sh &"
dotimed "modules/$socmodul/main.sh"
if [[ $? -eq 124 ]] ; then
openwbModulePublishState "EVSOC" 2 "Die SOC Werte konnten nicht innerhalb des Timeouts abgefragt werden. Bitte Konfiguration und Gerätestatus prüfen." 1
fi
#########################################################################
read soc <ramdisk/soc
read tmpsoc <ramdisk/tmpsoc
if ! [[ $soc =~ $re ]] ; then
openwbDebugLog "MAIN" 0 "ungültiger Wert für soc: $soc"
soc=$tmpsoc
else
echo "$soc" > ramdisk/tmpsoc
fi
fi
else
socvorhanden=0
echo 0 > ramdisk/socvorhanden
soc=0
fi
# for graphing.sh
if [ -s "ramdisk/device1_watt" ]; then read shd1_w<ramdisk/device1_watt; else shd1_w=0; fi
if [ -s "ramdisk/device2_watt" ]; then read shd2_w<ramdisk/device2_watt; else shd2_w=0; fi
if [ -s "ramdisk/device3_watt" ]; then read shd3_w<ramdisk/device3_watt; else shd3_w=0; fi
if [ -s "ramdisk/device4_watt" ]; then read shd4_w<ramdisk/device4_watt; else shd4_w=0; fi
if [ -s "ramdisk/device5_watt" ]; then read shd5_w<ramdisk/device5_watt; else shd5_w=0; fi
if [ -s "ramdisk/device6_watt" ]; then read shd6_w<ramdisk/device6_watt; else shd6_w=0; fi
if [ -s "ramdisk/device7_watt" ]; then read shd7_w<ramdisk/device7_watt; else shd7_w=0; fi
if [ -s "ramdisk/device8_watt" ]; then read shd8_w<ramdisk/device8_watt; else shd8_w=0; fi
if [ -s "ramdisk/device9_watt" ]; then read shd9_w<ramdisk/device9_watt; else shd9_w=0; fi
if [ -s "ramdisk/devicetotal_watt_hausmin" ]; then read shdall_w<ramdisk/devicetotal_watt_hausmin; else shdall_w=0; fi
if [ -s "ramdisk/device1_temp0" ]; then read shd1_t0<ramdisk/device1_temp0; else shd1_t0=0; fi
if [ -s "ramdisk/device1_temp1" ]; then read shd1_t1<ramdisk/device1_temp1; else shd1_t1=0; fi
if [ -s "ramdisk/device1_temp2" ]; then read shd1_t2<ramdisk/device1_temp2; else shd1_t2=0; fi
if [ -s "ramdisk/verbraucher1_watt" ]; then read verb1_w<ramdisk/verbraucher1_watt; else verb1_w=0; fi
verb1_w=$(printf "%.0f\n" $verb1_w)
if [ -s "ramdisk/verbraucher2_watt" ]; then read verb2_w<ramdisk/verbraucher2_watt; else verb2_w=0; fi
verb2_w=$(printf "%.0f\n" $verb2_w)
# if [ -s "ramdisk/verbraucher3_watt" ]; then read verb3_w<ramdisk/verbraucher3_watt; else verb3_w=0; fi
# verb3_w=$(printf "%.0f\n" $verb3_w)
verb3_w=0 # NC
#hausverbrauch=$((wattbezugint - pvwatt - ladeleistung - speicherleistung - shd1_w - shd2_w - shd3_w - shd4_w - shd5_w - shd6_w - shd7_w - shd8_w - shd9_w - verb1_w - verb2_w - verb3_w))
hausverbrauch=$((wattbezugint - pvwatt - ladeleistung - speicherleistung - shdall_w - verb1_w - verb2_w - verb3_w))
#hausverbrauch=$((wattbezugint - pvwatt - ladeleistung - speicherleistung - shd1_w - shd2_w - shd3_w - shd4_w - shd5_w - shd6_w - shd7_w - shd8_w - shd9_w - verb1_w - verb2_w - verb3_w))
hausverbrauch=$((wattbezugint - pvwatt - ladeleistung - speicherleistung - shdall_w - verb1_w - verb2_w))
if (( hausverbrauch < 0 )); then
if [ -f ramdisk/hausverbrauch.invalid ]; then
read hausverbrauchinvalid <ramdisk/hausverbrauch.invalid
let hausverbrauchinvalid+=1
else
hausverbrauchinvalid=1
fi
echo "$hausverbrauchinvalid" > ramdisk/hausverbrauch.invalid
if (( hausverbrauchinvalid < 3 )); then
read hausverbrauch <ramdisk/hausverbrauch
else
hausverbrauch=0
fi
else
echo "0" > ramdisk/hausverbrauch.invalid
fi
echo $hausverbrauch > ramdisk/hausverbrauch
read #fronius_sm_bezug_meterlocation <ramdisk/fronius_sm_bezug_meterlocation
usesimbezug=$( (test ! -r modules/$wattbezugmodul/usesim && echo "0") || cat modules/$wattbezugmodul/usesim )
if [[ $usesimbezug == "1" ]]; then
openwbDebugLog "MAIN" 0 "#### UseSimbezug counter simulation"
ra='^-?[0-9]+$'
read watt2 <ramdisk/wattbezug
if [[ -e ramdisk/bezugwatt0pos ]]; then
read importtemp <ramdisk/bezugwatt0pos
else
importtemp=$(timeout 4 mosquitto_sub -t openWB/evu/WHImported_temp)
if ! [[ $importtemp =~ $ra ]] ; then
importtemp="0"
fi
openwbDebugLog "MAIN" 0 "loadvars read openWB/evu/WHImported_temp from mosquito $importtemp"
echo $importtemp > ramdisk/bezugwatt0pos
fi
if [[ -e ramdisk/bezugwatt0neg ]]; then
read exporttemp <ramdisk/bezugwatt0neg
else
exporttemp=$(timeout 4 mosquitto_sub -t openWB/evu/WHExport_temp)
if ! [[ $exporttemp =~ $ra ]] ; then
exporttemp="0"
fi
openwbDebugLog "MAIN" 0 "loadvars read openWB/evu/WHExport_temp from mosquito $exporttemp"
echo $exporttemp > ramdisk/bezugwatt0neg
fi
#########################################################################
openwbDebugLog "MAIN" 0 "EXEC: sudo python3 runs/simcount.py $watt2 bezug bezugkwh einspeisungkwh"