forked from snaptec/openWB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
u1p3pcheck.sh
executable file
·190 lines (187 loc) · 7.15 KB
/
u1p3pcheck.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
#!/bin/bash
if [[ "$1" == "1" ]]; then
if [[ $evsecon == "modbusevse" ]]; then
sudo python runs/trigopen.py
fi
if [[ $evsecon == "ipevse" ]]; then
sudo python runs/u1p3premote.py $evseiplp1 $u1p3plp2id 1
fi
if [[ $lastmanagement == 1 && $evsecons1 == "ipevse" && $u1p3plp2aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp2 $u1p3plp2id 1
fi
if [[ $lastmanagements2 == 1 && $evsecons2 == "ipevse" && $u1p3plp3aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp3 $u1p3plp3id 1
fi
if [[ $lastmanagementlp4 == 1 && $evseconlp4 == "ipevse" && $u1p3plp4aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp4 $u1p3plp4id 1
fi
if [[ $lastmanagementlp5 == 1 && $evseconlp5 == "ipevse" && $u1p3plp5aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp5 $u1p3plp5id 1
fi
if [[ $lastmanagementlp6 == 1 && $evseconlp6 == "ipevse" && $u1p3plp6aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp6 $u1p3plp6id 1
fi
if [[ $lastmanagementlp7 == 1 && $evseconlp7 == "ipevse" && $u1p3plp7aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp7 $u1p3plp7id 1
fi
if [[ $lastmanagementlp8 == 1 && $evseconlp8 == "ipevse" && $u1p3plp8aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp8 $u1p3plp8id 1
fi
echo 1 > ramdisk/u1p3pstat
fi
if [[ "$1" == "3" ]]; then
if [[ $evsecon == "modbusevse" ]]; then
sudo python runs/trigclose.py
fi
if [[ $evsecon == "ipevse" ]]; then
sudo python runs/u1p3premote.py $evseiplp1 $u1p3plp2id 3
fi
if [[ $lastmanagement == 1 && $evsecons1 == "ipevse" && $u1p3plp2aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp2 $u1p3plp2id 3
fi
if [[ $lastmanagements2 == 1 && $evsecons2 == "ipevse" && $u1p3plp3aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp3 $u1p3plp3id 3
fi
if [[ $lastmanagementlp4 == 1 && $evseconlp4 == "ipevse" && $u1p3plp4aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp4 $u1p3plp4id 3
fi
if [[ $lastmanagementlp5 == 1 && $evseconlp5 == "ipevse" && $u1p3plp5aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp5 $u1p3plp5id 3
fi
if [[ $lastmanagementlp6 == 1 && $evseconlp6 == "ipevse" && $u1p3plp6aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp6 $u1p3plp6id 3
fi
if [[ $lastmanagementlp7 == 1 && $evseconlp7 == "ipevse" && $u1p3plp7aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp7 $u1p3plp7id 3
fi
if [[ $lastmanagementlp8 == 1 && $evseconlp8 == "ipevse" && $u1p3plp8aktiv == "1" ]]; then
sudo python runs/u1p3premote.py $evseiplp8 $u1p3plp8id 3
fi
echo 3 > ramdisk/u1p3pstat
fi
if [[ "$1" == "stop" ]]; then
if [[ $evsecon == "modbusevse" ]]; then
oldll=$(<ramdisk/llsoll)
echo $oldll > ramdisk/tmpllsoll
runs/set-current.sh 0 m
fi
if [[ $evsecon == "ipevse" ]]; then
oldll=$(<ramdisk/llsoll)
echo $oldll > ramdisk/tmpllsoll
runs/set-current.sh 0 m
fi
if [[ $lastmanagement == 1 && $evsecons1 == "modbusevse" && $u1p3plp2aktiv == "1" ]]; then
oldlls1=$(<ramdisk/llsolls1)
echo $oldlls1 > ramdisk/tmpllsolls1
runs/set-current.sh 0 s1
fi
if [[ $lastmanagement == 1 && $evsecons1 == "ipevse" && $u1p3plp2aktiv == "1" ]]; then
oldlls1=$(<ramdisk/llsolls1)
echo $oldlls1 > ramdisk/tmpllsolls1
runs/set-current.sh 0 s1
fi
if [[ $lastmanagements2 == 1 && $evsecons2 == "ipevse" && $u1p3plp3aktiv == "1" ]]; then
oldlls2=$(<ramdisk/llsolls2)
echo $oldlls2 > ramdisk/tmpllsolls2
runs/set-current.sh 0 s2
fi
if [[ $lastmanagementlp4 == 1 && $evseconlp4 == "ipevse" && $u1p3plp4aktiv == "1" ]]; then
oldlllp4=$(<ramdisk/llsolllp4)
echo $oldlllp4 > ramdisk/tmpllsolllp4
runs/set-current.sh 0 lp4
fi
if [[ $lastmanagementlp5 == 1 && $evseconlp5 == "ipevse" && $u1p3plp5aktiv == "1" ]]; then
oldlllp5=$(<ramdisk/llsolllp5)
echo $oldlllp5 > ramdisk/tmpllsolllp5
runs/set-current.sh 0 lp5
fi
if [[ $lastmanagementlp6 == 1 && $evseconlp6 == "ipevse" && $u1p3plp6aktiv == "1" ]]; then
oldlllp6=$(<ramdisk/llsolllp6)
echo $oldlllp6 > ramdisk/tmpllsolllp6
runs/set-current.sh 0 lp6
fi
if [[ $lastmanagementlp7 == 1 && $evseconlp7 == "ipevse" && $u1p3plp7aktiv == "1" ]]; then
oldlllp7=$(<ramdisk/llsolllp7)
echo $oldlllp7 > ramdisk/tmpllsolllp7
runs/set-current.sh 0 lp7
fi
if [[ $lastmanagementlp8 == 1 && $evseconlp8 == "ipevse" && $u1p3plp8aktiv == "1" ]]; then
oldlllp8=$(<ramdisk/llsolllp8)
echo $oldlllp8 > ramdisk/tmpllsolllp8
runs/set-current.sh 0 lp8
fi
fi
if [[ "$1" == "start" ]]; then
if [[ $evsecon == "modbusevse" ]]; then
oldll=$(<ramdisk/tmpllsoll)
runs/set-current.sh $oldll m
fi
if [[ $evsecon == "ipevse" ]]; then
oldll=$(<ramdisk/tmpllsoll)
runs/set-current.sh $oldll m
fi
if [[ $lastmanagement == 1 && $evsecons1 == "modbusevse" && $u1p3plp2aktiv == "1" ]]; then
oldlls1=$(<ramdisk/tmpllsolls1)
runs/set-current.sh $oldlls1 s1
fi
if [[ $lastmanagement == 1 && $evsecons1 == "ipevse" && $u1p3plp2aktiv == "1" ]]; then
oldlls1=$(<ramdisk/tmpllsolls1)
runs/set-current.sh $oldlls1 s1
fi
if [[ $lastmanagements2 == 1 && $evsecons2 == "ipevse" && $u1p3plp3aktiv == "1" ]]; then
oldlls2=$(<ramdisk/tmpllsolls2)
runs/set-current.sh $oldlls2 s2
fi
if [[ $lastmanagementlp4 == 1 && $evseconlp4 == "ipevse" && $u1p3plp4aktiv == "1" ]]; then
oldlllp4=$(<ramdisk/tmpllsolllp4)
runs/set-current.sh $oldlllp4 lp4
fi
if [[ $lastmanagementlp5 == 1 && $evseconlp5 == "ipevse" && $u1p3plp5aktiv == "1" ]]; then
oldlllp5=$(<ramdisk/tmpllsolllp5)
runs/set-current.sh $oldlllp5 lp5
fi
if [[ $lastmanagementlp6 == 1 && $evseconlp6 == "ipevse" && $u1p3plp6aktiv == "1" ]]; then
oldlllp6=$(<ramdisk/tmpllsolllp6)
runs/set-current.sh $oldlllp6 lp6
fi
if [[ $lastmanagementlp7 == 1 && $evseconlp7 == "ipevse" && $u1p3plp7aktiv == "1" ]]; then
oldlllp7=$(<ramdisk/tmpllsolllp7)
runs/set-current.sh $oldlllp7 lp7
fi
if [[ $lastmanagementlp8 == 1 && $evseconlp8 == "ipevse" && $u1p3plp8aktiv == "1" ]]; then
oldlllp8=$(<ramdisk/tmpllsolllp8)
runs/set-current.sh $oldlllp8 lp8
fi
fi
if [[ "$1" == "startslow" ]]; then
if [[ $evsecon == "modbusevse" ]]; then
runs/set-current.sh $minimalapv m
fi
if [[ $evsecon == "ipevse" ]]; then
runs/set-current.sh $minimalapv m
fi
if [[ $lastmanagement == 1 && $evsecons1 == "modbusevse" && $u1p3plp2aktiv == "1" ]]; then
runs/set-current.sh $minimalapv s1
fi
if [[ $lastmanagement == 1 && $evsecons1 == "ipevse" && $u1p3plp2aktiv == "1" ]]; then
runs/set-current.sh $minimalapv s1
fi
if [[ $lastmanagements2 == 1 && $evsecons2 == "ipevse" && $u1p3plp3aktiv == "1" ]]; then
runs/set-current.sh $minimalapv s2
fi
if [[ $lastmanagementlp4 == 1 && $evseconlp4 == "ipevse" && $u1p3plp4aktiv == "1" ]]; then
runs/set-current.sh $minimalapv lp4
fi
if [[ $lastmanagementlp5 == 1 && $evseconlp5 == "ipevse" && $u1p3plp5aktiv == "1" ]]; then
runs/set-current.sh $minimalapv lp5
fi
if [[ $lastmanagementlp6 == 1 && $evseconlp6 == "ipevse" && $u1p3plp6aktiv == "1" ]]; then
runs/set-current.sh $minimalapv lp6
fi
if [[ $lastmanagementlp7 == 1 && $evseconlp7 == "ipevse" && $u1p3plp7aktiv == "1" ]]; then
runs/set-current.sh $minimalapv lp7
fi
if [[ $lastmanagementlp8 == 1 && $evseconlp8 == "ipevse" && $u1p3plp8aktiv == "1" ]]; then
runs/set-current.sh $minimalapv lp8
fi
fi