Skip to content

Commit 324bb96

Browse files
authored
Merge pull request #36 from snaptec/master
Release 1.0
2 parents 03bb23e + 76441bf commit 324bb96

163 files changed

Lines changed: 2159 additions & 4578 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ladelog.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ if (( ladeleistungs2 > 500 )); then
132132
gelrlp3=$(echo "scale=3;$bishergeladens2 / $durchslp3 * 100" |bc)
133133
gelrlp3=${gelrlp3%.*}
134134
echo $gelrlp3 > ramdisk/gelrlp3
135-
restzeitlp3=$(echo "scale=5;($lademkwhs2 - $bishergeladens2)/ $ladeleistungs2 * 1000" |bc)
135+
restzeitlp3=$(echo "scale=6;($lademkwhs2 - $bishergeladens2)/ $ladeleistungs2 * 1000 * 60" |bc)
136136
restzeitlp3=${restzeitlp3%.*}
137137
if (( restzeitlp3 > 60 )); then
138138
restzeitlp3h=$((restzeitlp3 / 60))
@@ -141,7 +141,6 @@ if (( ladeleistungs2 > 500 )); then
141141
else
142142
echo "$restzeitlp3 Min" > ramdisk/restzeitlp3
143143
fi
144-
145144
else
146145
touch ramdisk/ladeustarts2
147146
echo -e $(date +%d.%m.%y-%H:%M) > ramdisk/ladeustarts2

modules/bezug_solaredge/main.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
. /var/www/html/openWB/openwb.conf
3+
4+
5+
6+
sudo python /var/www/html/openWB/modules/bezug_solaredge/solaredge.py $solaredgeip
7+
wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
8+
echo $wattbezug
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/python
2+
import sys
3+
import os
4+
import time
5+
import getopt
6+
import socket
7+
import ConfigParser
8+
import struct
9+
import binascii
10+
ipaddress = str(sys.argv[1])
11+
from pymodbus.client.sync import ModbusTcpClient
12+
client = ModbusTcpClient(ipaddress, port=502)
13+
14+
15+
resp= client.read_holding_registers(40206,1,unit=1)
16+
value1 = resp.registers[0]
17+
all = format(value1, '04x')
18+
final = int(struct.unpack('>h', all.decode('hex'))[0]) * -1
19+
f = open('/var/www/html/openWB/ramdisk/wattbezug', 'w')
20+
f.write(str(final))
21+
f.close()
22+
23+
resp= client.read_holding_registers(40084,2,unit=1)
24+
multipli = resp.registers[0]
25+
multiplint = format(multipli, '04x')
26+
fmultiplint = int(struct.unpack('>h', multiplint.decode('hex'))[0])
27+
28+
respw= client.read_holding_registers(40083,2,unit=1)
29+
value1w = respw.registers[0]
30+
allw = format(value1w, '04x')
31+
rawprodw = finalw = int(struct.unpack('>h', allw.decode('hex'))[0]) * -1
32+
if fmultiplint == -1:
33+
rawprodw = rawprodw / 10
34+
if fmultiplint == -2:
35+
rawprodw = rawprodw / 100
36+
if fmultiplint == -3:
37+
rawprodw = rawprodw / 1000
38+
if fmultiplint == -4:
39+
rawprodw = rawprodw / 10000
40+
f = open('/var/www/html/openWB/ramdisk/pvwatt', 'w')
41+
f.write(str(rawprodw))
42+
f.close()
43+
44+
resp= client.read_holding_registers(40093,2,unit=1)
45+
value1 = resp.registers[0]
46+
value2 = resp.registers[1]
47+
all = format(value1, '04x') + format(value2, '04x')
48+
final = int(struct.unpack('>i', all.decode('hex'))[0])
49+
f = open('/var/www/html/openWB/ramdisk/pvkwh', 'w')
50+
f.write(str(final))
51+
f.close()
52+
pvkwhk= final / 1000
53+
f = open('/var/www/html/openWB/ramdisk/pvkwhk', 'w')
54+
f.write(str(pvkwhk))
55+
f.close()
56+
57+
58+
resp= client.read_holding_registers(40234,2,unit=1)
59+
value1 = resp.registers[0]
60+
value2 = resp.registers[1]
61+
all = format(value1, '04x') + format(value2, '04x')
62+
final = int(struct.unpack('>i', all.decode('hex'))[0])
63+
f = open('/var/www/html/openWB/ramdisk/bezugkwh', 'w')
64+
f.write(str(final))
65+
f.close()
66+
67+
resp= client.read_holding_registers(40226,2,unit=1)
68+
value1 = resp.registers[0]
69+
value2 = resp.registers[1]
70+
all = format(value1, '04x') + format(value2, '04x')
71+
final = int(struct.unpack('>i', all.decode('hex'))[0])
72+
f = open('/var/www/html/openWB/ramdisk/einspeisungkwh', 'w')
73+
f.write(str(final))
74+
f.close()
75+

modules/goelp1/main.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
. /var/www/html/openWB/openwb.conf
3+
re='^-?[0-9]+$'
4+
rekwh='^[-+]?[0-9]+\.?[0-9]*$'
5+
6+
output=$(curl --connect-timeout $goetimeoutlp1 -s http://$goeiplp1/status)
7+
if [[ $? == "0" ]] ; then
8+
watt=$(echo $output | jq -r '.nrg[11]')
9+
watt=$(echo "scale=0;$watt * 10 /1" |bc)
10+
if [[ $watt =~ $re ]] ; then
11+
echo $watt > /var/www/html/openWB/ramdisk/llaktuell
12+
fi
13+
lla1=$(echo $output | jq -r '.nrg[4]')
14+
lla1=$(echo "scale=0;$lla1 / 10" |bc)
15+
if [[ $lla1 =~ $re ]] ; then
16+
echo $lla1 > /var/www/html/openWB/ramdisk/lla1
17+
fi
18+
lla2=$(echo $output | jq -r '.nrg[5]')
19+
lla2=$(echo "scale=0;$lla2 / 10" |bc)
20+
if [[ $lla2 =~ $re ]] ; then
21+
echo $lla2 > /var/www/html/openWB/ramdisk/lla2
22+
fi
23+
lla3=$(echo $output | jq -r '.nrg[6]')
24+
lla3=$(echo "scale=0;$lla3 / 10" |bc)
25+
if [[ $lla3 =~ $re ]] ; then
26+
echo $lla3 > /var/www/html/openWB/ramdisk/lla3
27+
fi
28+
llv1=$(echo $output | jq -r '.nrg[0]')
29+
if [[ $lla1 =~ $re ]] ; then
30+
echo $llv1 > /var/www/html/openWB/ramdisk/llv1
31+
fi
32+
llv2=$(echo $output | jq -r '.nrg[1]')
33+
if [[ $lla2 =~ $re ]] ; then
34+
echo $llv2 > /var/www/html/openWB/ramdisk/llv2
35+
fi
36+
llv3=$(echo $output | jq -r '.nrg[2]')
37+
if [[ $lla3 =~ $re ]] ; then
38+
echo $llv3 > /var/www/html/openWB/ramdisk/llv3
39+
fi
40+
41+
llkwh=$(echo $output | jq -r '.eto')
42+
llkwh=$(echo "scale=3;$llkwh / 10" |bc)
43+
if [[ $llkwh =~ $rekwh ]] ; then
44+
echo $llkwh > /var/www/html/openWB/ramdisk/llkwh
45+
fi
46+
fi

modules/goelp2/main.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
. /var/www/html/openWB/openwb.conf
3+
re='^-?[0-9]+$'
4+
rekwh='^[-+]?[0-9]+\.?[0-9]*$'
5+
6+
output=$(curl --connect-timeout $goetimeoutlp2 -s http://$goeiplp2/status)
7+
if [[ $? == "0" ]] ; then
8+
watt=$(echo $output | jq -r '.nrg[11]')
9+
watt=$(echo "scale=0;$watt * 10 /1" |bc)
10+
if [[ $watt =~ $re ]] ; then
11+
echo $watt > /var/www/html/openWB/ramdisk/llaktuells1
12+
fi
13+
lla1=$(echo $output | jq -r '.nrg[4]')
14+
lla1=$(echo "scale=0;$lla1 / 10" |bc)
15+
if [[ $lla1 =~ $re ]] ; then
16+
echo $lla1 > /var/www/html/openWB/ramdisk/llas11
17+
fi
18+
lla2=$(echo $output | jq -r '.nrg[5]')
19+
lla2=$(echo "scale=0;$lla2 / 10" |bc)
20+
if [[ $lla2 =~ $re ]] ; then
21+
echo $lla2 > /var/www/html/openWB/ramdisk/llas12
22+
fi
23+
lla3=$(echo $output | jq -r '.nrg[6]')
24+
lla3=$(echo "scale=0;$lla3 / 10" |bc)
25+
if [[ $lla3 =~ $re ]] ; then
26+
echo $lla3 > /var/www/html/openWB/ramdisk/llas13
27+
fi
28+
llv1=$(echo $output | jq -r '.nrg[0]')
29+
if [[ $lla1 =~ $re ]] ; then
30+
echo $llv1 > /var/www/html/openWB/ramdisk/llvs11
31+
fi
32+
llv2=$(echo $output | jq -r '.nrg[1]')
33+
if [[ $lla2 =~ $re ]] ; then
34+
echo $llv2 > /var/www/html/openWB/ramdisk/llvs12
35+
fi
36+
llv3=$(echo $output | jq -r '.nrg[2]')
37+
if [[ $lla3 =~ $re ]] ; then
38+
echo $llv3 > /var/www/html/openWB/ramdisk/llvs13
39+
fi
40+
41+
llkwh=$(echo $output | jq -r '.eto')
42+
llkwh=$(echo "scale=3;$llkwh / 10" |bc)
43+
if [[ $llkwh =~ $rekwh ]] ; then
44+
echo $llkwh > /var/www/html/openWB/ramdisk/llkwhs1
45+
fi
46+
fi

modules/goelp3/main.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
. /var/www/html/openWB/openwb.conf
3+
re='^-?[0-9]+$'
4+
rekwh='^[-+]?[0-9]+\.?[0-9]*$'
5+
6+
output=$(curl --connect-timeout $goetimeoutlp3 -s http://$goeiplp3/status)
7+
if [[ $? == "0" ]] ; then
8+
watt=$(echo $output | jq -r '.nrg[11]')
9+
watt=$(echo "scale=0;$watt * 10 /1" |bc)
10+
if [[ $watt =~ $re ]] ; then
11+
echo $watt > /var/www/html/openWB/ramdisk/llaktuells2
12+
fi
13+
lla1=$(echo $output | jq -r '.nrg[4]')
14+
lla1=$(echo "scale=0;$lla1 / 10" |bc)
15+
if [[ $lla1 =~ $re ]] ; then
16+
echo $lla1 > /var/www/html/openWB/ramdisk/llas21
17+
fi
18+
lla2=$(echo $output | jq -r '.nrg[5]')
19+
lla2=$(echo "scale=0;$lla2 / 10" |bc)
20+
if [[ $lla2 =~ $re ]] ; then
21+
echo $lla2 > /var/www/html/openWB/ramdisk/llas22
22+
fi
23+
lla3=$(echo $output | jq -r '.nrg[6]')
24+
lla3=$(echo "scale=0;$lla3 / 10" |bc)
25+
if [[ $lla3 =~ $re ]] ; then
26+
echo $lla3 > /var/www/html/openWB/ramdisk/llas23
27+
fi
28+
llv1=$(echo $output | jq -r '.nrg[0]')
29+
if [[ $lla1 =~ $re ]] ; then
30+
echo $llv1 > /var/www/html/openWB/ramdisk/llvs21
31+
fi
32+
llv2=$(echo $output | jq -r '.nrg[1]')
33+
if [[ $lla2 =~ $re ]] ; then
34+
echo $llv2 > /var/www/html/openWB/ramdisk/llvs22
35+
fi
36+
llv3=$(echo $output | jq -r '.nrg[2]')
37+
if [[ $lla3 =~ $re ]] ; then
38+
echo $llv3 > /var/www/html/openWB/ramdisk/llvs23
39+
fi
40+
41+
llkwh=$(echo $output | jq -r '.eto')
42+
llkwh=$(echo "scale=3;$llkwh / 10" |bc)
43+
if [[ $llkwh =~ $rekwh ]] ; then
44+
echo $llkwh > /var/www/html/openWB/ramdisk/llkwhs2
45+
fi
46+
fi

modules/sdm120modbusll/main.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ rekwh='^[-+]?[0-9]+\.?[0-9]*$'
55

66
if [[ $modbusevsesource = *virtual* ]]
77
then
8-
if ps ax |grep -v grep |grep "socat pty,link=$modbusevsesource,raw tcp:$modbusevselanip:26" > /dev/null
8+
if ps ax |grep -v grep |grep "socat pty,link=$sdm630modbusllsource,raw tcp:$sdm630modbuslllanip:26" > /dev/null
99
then
1010
echo "test" > /dev/null
1111
else
12-
sudo socat pty,link=$modbusevsesource,raw tcp:$modbusevselanip:26 &
12+
sudo socat pty,link=$sdm630modbusllsource,raw tcp:$sdm630modbuslllanip:26 &
1313
fi
1414
else
1515
echo "echo" > /dev/null
1616
fi
1717

1818
if [[ $sdm120modbusllid1 != "none" ]] && [[ $sdm120modbusllid2 != "none" ]] && [[ $sdm120modbusllid3 != "none" ]] ; then
1919
n=0
20-
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm3.py $modbusevsesource $sdm120modbusllid1 $sdm120modbusllid2 $sdm120modbusllid3)
20+
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm3.py $sdm630modbusllsource $sdm120modbusllid1 $sdm120modbusllid2 $sdm120modbusllid3)
2121
while read -r line; do
2222
if (( $n == 0 )); then
2323
llv1=$(echo "$line" | cut -c2- )
@@ -99,7 +99,7 @@ if [[ $sdm120modbusllid1 != "none" ]] && [[ $sdm120modbusllid2 != "none" ]] && [
9999
else
100100
if [[ $sdm120modbusll2id != "none" ]] ; then
101101
n=0
102-
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm1.py $modbusevsesource $sdm120modbusllid1)
102+
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm1.py $sdm630modbusllsource $sdm120modbusllid1)
103103
while read -r line; do
104104
if (( $n == 0 )); then
105105
llv1=$(echo "$line" | cut -c2- )
@@ -131,7 +131,7 @@ else
131131
fi
132132
else
133133
n=0
134-
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm2.py $modbusevsesource $sdm120modbusllid1 $sdm120modbusllid2)
134+
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm2.py $sdm630modbusllsource $sdm120modbusllid1 $sdm120modbusllid2)
135135
while read -r line; do
136136
if (( $n == 0 )); then
137137
llv1=$(echo "$line" | cut -c2- )

modules/sdm120modbusll/readsdm3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
2828
resp = client.read_input_registers(0x0156,2, unit=sdmid)
2929
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
30-
time.sleep(0.3)
30+
time.sleep(0.5)
3131
resp = client.read_input_registers(0x00,2, unit=sdm2id)
3232
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
3333
resp = client.read_input_registers(0x06,2, unit=sdm2id)
@@ -38,7 +38,7 @@
3838
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
3939
resp = client.read_input_registers(0x0156,2, unit=sdm2id)
4040
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
41-
time.sleep(0.3)
41+
time.sleep(0.5)
4242
resp = client.read_input_registers(0x00,2, unit=sdm3id)
4343
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
4444
resp = client.read_input_registers(0x06,2, unit=sdm3id)

modules/sdm120modbuslls1/main.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
re='^-?[0-9]+$'
44
rekwh='^[-+]?[0-9]+\.?[0-9]*$'
55

6-
if [[ $sdm120modbusllsources1 = *virtual* ]]
6+
if [[ $sdm120lp2source = *virtual* ]]
77
then
8-
if ps ax |grep -v grep |grep "socat pty,link=$evsesources1,raw tcp:$evselanips1:26" > /dev/null
8+
if ps ax |grep -v grep |grep "socat pty,link=$sdm120lp2source,raw tcp:$lllaniplp2:26" > /dev/null
99
then
1010
echo "test" > /dev/null
1111
else
12-
sudo socat pty,link=$evsesources1,raw tcp:$evselanips1:26 &
12+
sudo socat pty,link=$sdm120lp2source,raw tcp:$lllaniplp2:26 &
1313
fi
1414
else
1515
echo "echo" > /dev/null
1616
fi
1717

1818
if [[ $sdm120modbusllid1s1 != "none" ]] && [[ $sdm120modbusllid2s1 != "none" ]] && [[ $sdm120modbusllid3s1 != "none" ]] ; then
1919
n=0
20-
output=$(sudo python /var/www/html/openWB/modules/sdm120modbuslls1/readsdm3.py $evsesources1 $sdm120modbusllid1s1 $sdm120modbusllid2s1 $sdm120modbusllid3s1)
20+
output=$(sudo python /var/www/html/openWB/modules/sdm120modbuslls1/readsdm3.py $sdm120lp2source $sdm120modbusllid1s1 $sdm120modbusllid2s1 $sdm120modbusllid3s1)
2121
while read -r line; do
2222
if (( $n == 0 )); then
2323
llv1=$(echo "$line" | cut -c2- )
@@ -99,7 +99,7 @@ if [[ $sdm120modbusllid1s1 != "none" ]] && [[ $sdm120modbusllid2s1 != "none" ]]
9999
else
100100
if [[ $sdm120modbusll2ids1 != "none" ]] ; then
101101
n=0
102-
output=$(sudo python /var/www/html/openWB/modules/sdm120modbuslls1/readsdm3.py $evsesources1 $sdm120modbusllid1s1 $sdm120modbusllid2s1)
102+
output=$(sudo python /var/www/html/openWB/modules/sdm120modbuslls1/readsdm3.py $sdm120lp2source $sdm120modbusllid1s1 $sdm120modbusllid2s1)
103103
while read -r line; do
104104
if (( $n == 0 )); then
105105
llv1=$(echo "$line" | cut -c2- )
@@ -157,7 +157,7 @@ else
157157
fi
158158
else
159159
n=0
160-
output=$(sudo python /var/www/html/openWB/modules/sdm120modbuslls1/readsdm3.py $evsesources1 $sdm120modbusllid1s1)
160+
output=$(sudo python /var/www/html/openWB/modules/sdm120modbuslls1/readsdm3.py $sdm120lp2source $sdm120modbusllid1s1)
161161
while read -r line; do
162162
if (( $n == 0 )); then
163163
llv1=$(echo "$line" | cut -c2- )

modules/sdm120modbuslls1/readsdm3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
sdmid = int(sys.argv[2])
1818
sdm2id = int(sys.argv[3])
1919
sdm3id = int(sys.argv[4])
20-
time.sleep(0.2)
20+
time.sleep(0.3)
2121
resp = client.read_input_registers(0x00,2, unit=sdmid)
2222
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
2323
time.sleep(0.1)

0 commit comments

Comments
 (0)