-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.txt
More file actions
104 lines (93 loc) · 1.54 KB
/
script.txt
File metadata and controls
104 lines (93 loc) · 1.54 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
>D 64
;variablen für berechnungen
res=0
rstr=""
label=""
test=""
lraw=""
val=0
val2=""
batno=0
dbatno=0
volt=0
curr=0
temp=0
coul=0
Timer=0
Text1="Battery"
is1=""
is2=""
>B
res=0
res=so(3 1 115200 8N1 1024)
;print open %res%
>F
res=sa()
if res>0 {
rstr=sr(10)
;print rstr=%rstr%
rstr=sb(rstr 1 sl(rstr))
label=sb(rstr 0 9)
lraw=sb(rstr 0 13)
;print %lraw%:
val=st(rstr : 2)
if val==0 {
val2=st(rstr : 2)
}
switch label
case "Voltage "
volt=val/1000
case "Temperatu"
temp=val/1000
case "Coulomb "
coul=val
case "Current "
curr=val/1000
case "Basic Sta"
is1=val2
case "Soh. Stat"
is2=val2
ends
}
>S
;Executed every second
if upsecs%5==0
then
res=sw("pwr 1\n")
;print write cmd
endif
;print %volt% %curr% %temp% %coul%
Timer+=1
;print Timer %Timer%
if Timer==10
then
->DisplayText [z]
->DisplayText [l1c1]%Text1%
->DisplayText [l2c1]Volt %1volt%V
->DisplayText [l1c17]Curr %1curr%A
->DisplayText [l2c17]Temp %1temp%~DFC
->DisplayText [l1c9]SOC %0coul%%%
test=sb(is1 1 4)
->DisplayText [l2c13]%test%
test=sb(is2 1 4)
->DisplayText [l1c29]%test%
endif
if Timer>20
then
Timer=0
endif
>T
; send mqtt individualtopics also/instead json see below in J
=>publish iot/%topic%/Voltage %4volt%
=>publish iot/%topic%/Current %0curr%
=>publish iot/%topic%/Coulomb %0coul%
>W
Voltage{m}%4volt% V
Current{m}%1curr% A
Temperature{m}%1temp% °C
SOC{m}%0coul% %%
Status{m}%is1%
SOH Status{m}%is2%
>J
,"pylon":{"Voltage":%4volt%,"Current":%0curr%,"Coulomb":%0coul%,"Temperature":%3temp%}
#