Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Webhooks added, Kostal Piko SmartMeter EVU Modul added, Logging tim a…
Browse files Browse the repository at this point in the history
…djustable
  • Loading branch information
snaptec committed Feb 20, 2019
1 parent 6ba71da commit 1ad7b08
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 96 deletions.
77 changes: 0 additions & 77 deletions modules/sdm120modbusll/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,83 +18,6 @@ fi
if [[ $sdm120modbusllid1 != "none" ]] && [[ $sdm120modbusllid2 != "none" ]] && [[ $sdm120modbusllid3 != "none" ]] ; then
n=0
output=$(sudo python /var/www/html/openWB/modules/sdm120modbusll/readsdm3.py $sdm120modbusllsource $sdm120modbusllid1 $sdm120modbusllid2 $sdm120modbusllid3)
while read -r line; do
if (( $n == 0 )); then
llv1=$(echo "$line" | cut -c2- )
llv1=${llv1%??}
LANG=C printf "%.1f\n" $llv1 > /var/www/html/openWB/ramdisk/llv1
fi
if (( $n == 1 )); then
lla1=$(echo "$line" | cut -c2- )
lla1=${lla1%??}
LANG=C printf "%.3f\n" $lla1 > /var/www/html/openWB/ramdisk/lla1
fi
if (( $n == 2 )); then
wl1=$(echo "$line" | cut -c2- |sed 's/\..*$//')
fi
if (( $n == 3 )); then
llpf1=$(echo "$line" | cut -c2- )
llpf1=${llpf1%??}
LANG=C printf "%.3f\n" $llpf1 > /var/www/html/openWB/ramdisk/llpf1
fi
if (( $n == 4 )); then
llkwh=$(echo "$line" | cut -c2- )
llkwh=${llkwh%???}
fi
if (( $n == 5 )); then
llv2=$(echo "$line" | cut -c2- )
llv2=${llv2%??}
LANG=C printf "%.1f\n" $llv2 > /var/www/html/openWB/ramdisk/llv2
fi
if (( $n == 6 )); then
lla2=$(echo "$line" | cut -c2- )
lla2=${lla2%??}
LANG=C printf "%.3f\n" $lla2 > /var/www/html/openWB/ramdisk/lla2
fi
if (( $n == 7 )); then
wl2=$(echo "$line" | cut -c2- |sed 's/\..*$//')
fi
if (( $n == 8 )); then
llpf2=$(echo "$line" | cut -c2- )
llpf2=${llpf2%??}
LANG=C printf "%.3f\n" $llpf2 > /var/www/html/openWB/ramdisk/llpf2
fi
if (( $n == 9 )); then
llkwh2=$(echo "$line" | cut -c2- )
llkwh2=${llkwh2%???}
fi
if (( $n == 10 )); then
llv3=$(echo "$line" | cut -c2- )
llv3=${llv3%??}
LANG=C printf "%.1f\n" $llv3 > /var/www/html/openWB/ramdisk/llv3
fi
if (( $n == 11 )); then
lla3=$(echo "$line" | cut -c2- )
lla3=${lla3%??}
LANG=C printf "%.3f\n" $lla3 > /var/www/html/openWB/ramdisk/lla3
fi
if (( $n == 12 )); then
wl3=$(echo "$line" | cut -c2- |sed 's/\..*$//')
fi
if (( $n == 13 )); then
llpf3=$(echo "$line" | cut -c2- )
llpf3=${llpf3%??}
LANG=C printf "%.3f\n" $llpf3 > /var/www/html/openWB/ramdisk/llpf3
fi
if (( $n == 14 )); then
llkwh3=$(echo "$line" | cut -c2- )
llkwh3=${llkwh3%???}
fi
n=$((n + 1))
done <<< "$output"
if [[ $llkwh =~ $rekwh ]] && [[ $llkwh2 =~ $rekwh ]] && [[ $llkwh3 =~ $rekwh ]]; then
lltotal=`echo "($llkwh+$llkwh2+$llkwh3)" |bc`
LANG=C printf "%.3f\n" $lltotal > /var/www/html/openWB/ramdisk/llkwh
fi
if [[ $wl1 =~ $re ]] && [[ $wl2 =~ $re ]] && [[ $wl3 =~ $re ]]; then
llaktuell=`echo "($wl1+$wl2+$wl3)" |bc`
echo $llaktuell > /var/www/html/openWB/ramdisk/llaktuell
fi

else
if [[ $sdm120modbusllid2 != "none" ]] ; then
Expand Down
69 changes: 51 additions & 18 deletions modules/sdm120modbusll/readsdm3.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,73 @@
sdm2id = int(sys.argv[3])
sdm3id = int(sys.argv[4])
resp = client.read_input_registers(0x00,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
llv1 = struct.unpack('>f',struct.pack('>HH',*resp.registers))
llv1 = float("%.1f" % llv1[0])
f = open('/var/www/html/openWB/ramdisk/llv1', 'w')
f.write(str(llv1))
f.close()
resp = client.read_input_registers(0x06,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
lla1 = struct.unpack('>f',struct.pack('>HH',*resp.registers))
lla1 = float("%.3f" % lla1[0])
f = open('/var/www/html/openWB/ramdisk/lla1', 'w')
f.write(str(lla1))
f.close()
resp = client.read_input_registers(0x0C,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x1E,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
ll = struct.unpack('>f',struct.pack('>HH',*resp.registers))
wl1 = int(ll[0])

resp = client.read_input_registers(0x0156,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
llwh = struct.unpack('>f',struct.pack('>HH',*resp.registers))
llwh1 = float("%.3f" % llwh[0])
time.sleep(0.5)
resp = client.read_input_registers(0x00,2, unit=sdm2id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
llv2 = struct.unpack('>f',struct.pack('>HH',*resp.registers))
llv2 = float("%.1f" % llv2[0])
f = open('/var/www/html/openWB/ramdisk/llv2', 'w')
f.write(str(llv2))
f.close()
resp = client.read_input_registers(0x06,2, unit=sdm2id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
lla2 = struct.unpack('>f',struct.pack('>HH',*resp.registers))
lla2 = float("%.3f" % lla2[0])
f = open('/var/www/html/openWB/ramdisk/lla2', 'w')
f.write(str(lla3))
f.close()
resp = client.read_input_registers(0x0C,2, unit=sdm2id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x1E,2, unit=sdm2id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
ll = struct.unpack('>f',struct.pack('>HH',*resp.registers))
wl2 = int(ll[0])
resp = client.read_input_registers(0x0156,2, unit=sdm2id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
llwh = struct.unpack('>f',struct.pack('>HH',*resp.registers))
llwh2 = float("%.3f" % llwh[0])
time.sleep(0.5)
resp = client.read_input_registers(0x00,2, unit=sdm3id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
llv3 = struct.unpack('>f',struct.pack('>HH',*resp.registers))
llv3 = float("%.1f" % llv3[0])
f = open('/var/www/html/openWB/ramdisk/llv3', 'w')
f.write(str(llv3))
f.close()
resp = client.read_input_registers(0x06,2, unit=sdm3id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
lla3 = struct.unpack('>f',struct.pack('>HH',*resp.registers))
lla3 = float("%.3f" % lla3[0])
f = open('/var/www/html/openWB/ramdisk/lla3', 'w')
f.write(str(lla3))
f.close()
resp = client.read_input_registers(0x0C,2, unit=sdm3id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x1E,2, unit=sdm3id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
ll = struct.unpack('>f',struct.pack('>HH',*resp.registers))
wl3 = int(ll[0])
resp = client.read_input_registers(0x0156,2, unit=sdm3id)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
llwh = struct.unpack('>f',struct.pack('>HH',*resp.registers))
llwh3 = float("%.3f" % llwh[0])


llwh = llwh1 + llwh2 + llwh3
f = open('/var/www/html/openWB/ramdisk/llkwh', 'w')
f.write(str(llwh))
f.close()

ll = wl1 + wl2 + wl3
f = open('/var/www/html/openWB/ramdisk/llaktuell', 'w')
f.write(str(ll))
f.close()



2 changes: 1 addition & 1 deletion web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@
<div class="col-xs-4">


<!-- master --> Ver 1.23 Beta </div>
<!-- master --> Ver 1.231 Beta </div>


<div class="col-xs-4 text-center">
Expand Down

0 comments on commit 1ad7b08

Please sign in to comment.