From 33962d8f1bfa67467c51eec4375c1aafd6bd4c02 Mon Sep 17 00:00:00 2001 From: snaptec Date: Fri, 23 Mar 2018 16:55:38 +0100 Subject: [PATCH] modbus evse DIN implementiert, SDM Abfrage umgebaut --- README.md | 4 +-- modules/sdm630modbusbezug/main.sh | 51 +++++++++++++++++++--------- modules/sdm630modbusbezug/readsdm.py | 33 ++++++++++++++++++ modules/sdm630modbusll/main.sh | 47 ++++++++++--------------- modules/sdm630modbusll/readsdm.py | 30 ++++++++++++++++ openwb-install.sh | 9 +---- openwb.conf | 13 +++---- ramdisk/bezuga1 | 1 + ramdisk/bezuga2 | 1 + ramdisk/bezuga3 | 1 + ramdisk/lademodus | 2 +- ramdisk/lla1 | 2 +- ramdisk/llaktuell | 2 +- ramdisk/pvwatt | 2 +- ramdisk/soc | 2 +- ramdisk/wattbezug | 2 +- regel.sh | 12 ++++--- runs/0.sh | 4 +++ runs/10.sh | 3 ++ runs/11.sh | 3 ++ runs/12.sh | 3 ++ runs/13.sh | 3 ++ runs/14.sh | 3 ++ runs/15.sh | 3 ++ runs/16.sh | 3 ++ runs/17.sh | 3 ++ runs/18.sh | 3 ++ runs/19.sh | 3 ++ runs/20.sh | 3 ++ runs/21.sh | 3 ++ runs/22.sh | 3 ++ runs/23.sh | 3 ++ runs/24.sh | 3 ++ runs/25.sh | 3 ++ runs/26.sh | 3 ++ runs/27.sh | 3 ++ runs/28.sh | 3 ++ runs/29.sh | 3 ++ runs/30.sh | 3 ++ runs/31.sh | 3 ++ runs/32.sh | 3 ++ runs/6.sh | 3 ++ runs/7.sh | 3 ++ runs/8.sh | 3 ++ runs/9.sh | 3 ++ runs/evsewritemodbus.py | 10 ++++++ web/config.php | 2 +- web/index.php | 12 +++---- web/settings.php | 22 +++++------- web/tools/savesettings.php | 15 ++------ 50 files changed, 254 insertions(+), 106 deletions(-) create mode 100644 modules/sdm630modbusbezug/readsdm.py create mode 100644 modules/sdm630modbusll/readsdm.py create mode 100644 ramdisk/bezuga1 create mode 100644 ramdisk/bezuga2 create mode 100644 ramdisk/bezuga3 create mode 100644 runs/evsewritemodbus.py diff --git a/README.md b/README.md index acc9ceae1..cd9c8e7d2 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ ausführen. + In der Shell folgendes eingeben: curl -s https://raw.githubusercontent.com/snaptec/openWB/master/openwb-install.sh | sudo sh @@ -146,8 +147,7 @@ aufrufen # Danke geht an: - Frank für das Bereitstellen von Hardware + Frank für das Bereitstellen von Hardware und sein Modbus Wissen! - Gonium für sein super Tool zum auslesen der SDM: https://github.com/gonium/gosdm630 diff --git a/modules/sdm630modbusbezug/main.sh b/modules/sdm630modbusbezug/main.sh index bb721db4d..93540def1 100755 --- a/modules/sdm630modbusbezug/main.sh +++ b/modules/sdm630modbusbezug/main.sh @@ -1,26 +1,45 @@ #!/bin/bash -############### -#SDM630v2 wird mithilfe von https://github.com/gonium/gosdm630 ausgelesen. -#auch für SDM230 nutzbar (L2 und L3 bleiben dann immer 0 -#bezug = bezug soll Modbus ID 2 sein . /var/www/html/openWB/openwb.conf -#check ob gonium reader lauft -if ps ax |grep -v grep |grep "sdm630_httpd-linux-arm -s $sdm630modbusbezugsource -d SDM:$sdm630modbusbezugid -u $sdm630modbusbezugport" > /dev/null +if [[ $sdm630modbusbezugsource = *virtual* ]] then -else - sudo /home/pi/bin/sdm630_httpd-linux-arm -s $sdm630modbusbezugsource -d SDM:$sdm630modbusbezugid -u $sdm630modbusbezugport & + if ps ax |grep -v grep |grep "socat pty,link=$sdm630modbusbezugsource,raw tcp:$sdm630modbusbezuglanip:26" > /dev/null + then + echo "test" > /dev/null + else + sudo socat pty,link=$sdm630modbusbezugsource,raw tcp:$sdm630modbusbezuglanip:26 & + fi +else + echo "echo" > /dev/null fi - -bezuga1=$(curl -s localhost:8080/last/$sdm630modbusbezugid |jq '.Current.L1' | tr -d '\n' | sed 's/\..*$//') -bezuga2=$(curl -s localhost:8080/last/$sdm630modbusbezugid |jq '.Current.L2' | tr -d '\n' | sed 's/\..*$//') -bezuga3=$(curl -s localhost:8080/last/$sdm630modbusbezugid |jq '.Current.L3' | tr -d '\n' | sed 's/\..*$//') -wattbezug=`curl -s localhost:8080/last/$sdm630modbusbezugid |jq '.Power.L1' | tr -d '\n' | sed 's/\..*$//'` +n=0 +output=$(sudo python /var/www/html/openWB/modules/sdm630modbusbezug/readsdm.py $sdm630modbusbezugsource $sdm630modbusbezugid) +while read -r line; do + if (( $n == 0 )); then + echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/bezuga1 + fi + if (( $n == 1 )); then + echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/bezuga2 + fi + if (( $n == 2 )); then + echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/bezuga3 + fi + if (( $n == 3 )); then + wl1=$(echo "$line" | cut -c2- |sed 's/\..*$//') + fi + if (( $n == 4 )); then + wl2=$(echo "$line" | cut -c2- |sed 's/\..*$//') + fi + if (( $n == 5 )); then + wl3=$(echo "$line" | cut -c2- |sed 's/\..*$//') + fi + n=$((n + 1)) +done <<< "$output" +wattbezug=`echo "($wl1+wl2+$wl3)" |bc` echo $wattbezug > /var/www/html/openWB/ramdisk/wattbezug -echo $bezuga1 > /var/www/html/openWB/ramdisk/bezuga1 -echo $bezuga2 > /var/www/html/openWB/ramdisk/bezuga2 -echo $bezuga3 > /var/www/html/openWB/ramdisk/bezuga3 + + diff --git a/modules/sdm630modbusbezug/readsdm.py b/modules/sdm630modbusbezug/readsdm.py new file mode 100644 index 000000000..a215e8d60 --- /dev/null +++ b/modules/sdm630modbusbezug/readsdm.py @@ -0,0 +1,33 @@ +#!/usr/bin/python +import sys +import os +import time +import getopt +import socket +import ConfigParser +import struct +import binascii +seradd = str(sys.argv[1]) +from pymodbus.client.sync import ModbusSerialClient +client = ModbusSerialClient(method = "rtu", port=seradd, baudrate=9600, + stopbits=1, bytesize=8, timeout=1) + +#rq = client.read_holding_registers(0,8,unit=5) +#print(rq.registers) +sdmid = int(sys.argv[2]) + +resp = client.read_input_registers(0x06,2, unit=sdmid) + +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) +resp = client.read_input_registers(0x08,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) +resp = client.read_input_registers(0x0A,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) + +resp = client.read_input_registers(0x0C,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) +resp = client.read_input_registers(0x0E,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) +resp = client.read_input_registers(0x10,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) + diff --git a/modules/sdm630modbusll/main.sh b/modules/sdm630modbusll/main.sh index 4afd26dca..ee591db53 100755 --- a/modules/sdm630modbusll/main.sh +++ b/modules/sdm630modbusll/main.sh @@ -1,45 +1,34 @@ #!/bin/bash - -############### -#SDM630v2 wird mithilfe von https://github.com/gonium/gosdm630 ausgelesen. -#auch für SDM230 nutzbar (L2 und L3 bleiben dann immer 0 -#ll = ladeleistung soll Modbus ID 1 sein -# Gonium Tool fragt standard nur ID1 ab - . /var/www/html/openWB/openwb.conf - if [[ $sdm630modbusllsource = *virtual* ]] then if ps ax |grep -v grep |grep "socat pty,link=$sdm630modbusllsource,raw tcp:$sdm630modbuslllanip:26" > /dev/null then echo "test" > /dev/null else - sudo socat pty,link=$sdm630modbusllsource,raw tcp:$sdm630modbuslllanip:26 + sudo socat pty,link=$sdm630modbusllsource,raw tcp:$sdm630modbuslllanip:26 & fi else echo "echo" > /dev/null fi +n=0 +output=$(sudo python /var/www/html/openWB/modules/sdm630modbusll/readsdm.py $sdm630modbusllsource $sdm630modbusllid) +while read -r line; do - -#check ob gonium reader lauft -if ps ax |grep -v grep |grep "sdm630_httpd-linux-arm -s $sdm630modbusllsource -d SDM:$sdm630modbusllid -u $sdm630modbusllport" > /dev/null -then - echo "test" > /dev/null -else - sudo /home/pi/bin/sdm630_httpd-linux-arm -s $sdm630modbusllsource -d SDM:$sdm630modbusllid -u $sdm630modbusllport & +if (( $n == 0 )); then +echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/lla1 fi +if (( $n == 1 )); then +echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/lla2 +fi +if (( $n == 2 )); then +echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/lla3 +fi +if (( $n == 3 )); then +echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llaktuell +fi +n=$((n + 1)) + done <<< "$output" - -lla1=$(curl -s localhost:8080/last/$sdm630modbusllid |jq '.Current.L1' | tr -d '\n' | sed 's/\..*$//') -lla2=$(curl -s localhost:8080/last/$sdm630modbusllid |jq '.Current.L2' | tr -d '\n' | sed 's/\..*$//') -lla3=$(curl -s localhost:8080/last/$sdm630modbusllid |jq '.Current.L3' | tr -d '\n' | sed 's/\..*$//') -ladeleistung=`curl -s localhost:8080/last/$sdm630modbusllid |jq '.Power.L1' | tr -d '\n' | sed 's/\..*$//'` - - -echo $ladeleistung > /var/www/html/openWB/ramdisk/llaktuell -echo $lla1 > /var/www/html/openWB/ramdisk/lla1 -echo $lla2 > /var/www/html/openWB/ramdisk/lla2 -echo $lla3 > /var/www/html/openWB/ramdisk/lla3 - -wattbezugint=0 + diff --git a/modules/sdm630modbusll/readsdm.py b/modules/sdm630modbusll/readsdm.py new file mode 100644 index 000000000..fe00f2ab0 --- /dev/null +++ b/modules/sdm630modbusll/readsdm.py @@ -0,0 +1,30 @@ +#!/usr/bin/python +import sys +import os +import time +import getopt +import socket +import ConfigParser +import struct +import binascii +seradd = str(sys.argv[1]) +from pymodbus.client.sync import ModbusSerialClient +client = ModbusSerialClient(method = "rtu", port=seradd, baudrate=9600, + stopbits=1, bytesize=8, timeout=1) + +#rq = client.read_holding_registers(0,8,unit=5) +#print(rq.registers) +sdmid = int(sys.argv[2]) + +resp = client.read_input_registers(0x06,2, unit=sdmid) + +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) +resp = client.read_input_registers(0x08,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) +resp = client.read_input_registers(0x0A,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) + +resp = client.read_input_registers(0x0C,2, unit=sdmid) +print(struct.unpack('>f',struct.pack('>HH',*resp.registers))) + + diff --git a/openwb-install.sh b/openwb-install.sh index 2e74578b1..414982ea1 100755 --- a/openwb-install.sh +++ b/openwb-install.sh @@ -118,14 +118,6 @@ else echo "...ok" fi -echo "check for gonium/sdm630" -if [ ! -d /home/pi/bin ]; then - wget https://github.com/gonium/gosdm630/releases/download/v0.5.0/sdm630-linux-arm.zip - unzip sdm630-linux-arm.zip - echo "... installed" -else - echo "...ok" -fi echo "check for socat" if ! [ -x "$(command -v socat)" ]; then @@ -143,6 +135,7 @@ then else echo "EXTRA_OPTS="-L 0"" >> /etc/default/cron fi +sudo pip install -U pymodbus chmod 777 /var/www/html/openWB/openwb.conf chmod +x /var/www/html/openWB/modules/* diff --git a/openwb.conf b/openwb.conf index c844a284d..0a1b557b3 100755 --- a/openwb.conf +++ b/openwb.conf @@ -6,7 +6,7 @@ debug=0 #Minimal mögliche Ladeleistung in A(nur höher Stellen wenn das Fahrzeug Probleme bereitet) #Einstellbar von 6-10 -minimalstromstaerke=6 +minimalstromstaerke=16 #Maximal erlaubte Ladeleistung in A. Als Beispiel: 16A entspricht einphasig 3,6kw, 3-phasig 11kw, Abhängig von genutzter Verkabelung (Querschnitt) etc.. #Einstellbar von 10-32 @@ -42,12 +42,11 @@ vzloggerip=10.20.0.51:8080 #Einstellungen für Modul sdm630modbusbezug # Modbus ID des sdm -sdm630modbusbezugid=1 +sdm630modbusbezugid=5 # Serieller Port. Bei USB-RS485 Adapter meist /dev/tty/USB0 -sdm630modbusbezugsource=/dev/virtualcom0 +sdm630modbusbezugsource=/dev/virtualcom1 # Port lokal für für das gonium tool. Darf sich nicht mit anderen Gonium Instanzen ueberschneiden. -sdm630modbusbezugport=:8081 - +sdm630modbusbezuglanip=10.20.0.180 @@ -74,8 +73,6 @@ sdm630modbusllid=1 # Serieller Port. Bei USB-RS485 Adapter meist /dev/tty/USB0 #fuer Verbindungen ueber Lan Konverter muss die source /dev/virtualcomX (0,1,usw..) sein sdm630modbusllsource=/dev/ttyUSB0 -# Port lokal für für das gonium tool. Darf sich nicht mit anderen Gonium Instanzen ueberschneiden, werden alle in dieser conf festgelegt. -sdm630modbusllport=:8080 #bei Verbindung über Lan Konverter sdm630modbuslllanip=10.20.0.180 #beim Wechsel von source einstellungen oder von ttyUSB auf virtualcom0 ist ein neustart des raspberry erforderlich. @@ -125,4 +122,4 @@ abschaltuberschuss=900 # Der Modi Sofort Laden lädt immer mit der vorgegebenen Ladeleistung # Mögliche Werte: 6-32 (A) -sofortll=16 +sofortll=20 diff --git a/ramdisk/bezuga1 b/ramdisk/bezuga1 new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/ramdisk/bezuga1 @@ -0,0 +1 @@ +0 diff --git a/ramdisk/bezuga2 b/ramdisk/bezuga2 new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/ramdisk/bezuga2 @@ -0,0 +1 @@ +0 diff --git a/ramdisk/bezuga3 b/ramdisk/bezuga3 new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/ramdisk/bezuga3 @@ -0,0 +1 @@ +0 diff --git a/ramdisk/lademodus b/ramdisk/lademodus index c22708346..56a6051ca 100755 --- a/ramdisk/lademodus +++ b/ramdisk/lademodus @@ -1 +1 @@ -0 \ No newline at end of file +1 \ No newline at end of file diff --git a/ramdisk/lla1 b/ramdisk/lla1 index 573541ac9..b6a7d89c6 100755 --- a/ramdisk/lla1 +++ b/ramdisk/lla1 @@ -1 +1 @@ -0 +16 diff --git a/ramdisk/llaktuell b/ramdisk/llaktuell index 573541ac9..f3bada829 100755 --- a/ramdisk/llaktuell +++ b/ramdisk/llaktuell @@ -1 +1 @@ -0 +3678 diff --git a/ramdisk/pvwatt b/ramdisk/pvwatt index 573541ac9..4ac943d1c 100755 --- a/ramdisk/pvwatt +++ b/ramdisk/pvwatt @@ -1 +1 @@ -0 +1032 diff --git a/ramdisk/soc b/ramdisk/soc index bb95160cb..84df3526d 100755 --- a/ramdisk/soc +++ b/ramdisk/soc @@ -1 +1 @@ -33 +87 diff --git a/ramdisk/wattbezug b/ramdisk/wattbezug index 700bb6889..e6bb77876 100755 --- a/ramdisk/wattbezug +++ b/ramdisk/wattbezug @@ -1 +1 @@ -1391 +4529 diff --git a/regel.sh b/regel.sh index 3faa06754..40d5a4e5d 100755 --- a/regel.sh +++ b/regel.sh @@ -10,7 +10,7 @@ cd /var/www/html/openWB/ #Wattbezug if [[ $wattbezugmodul != "none" ]]; then - wattbezug=`modules/$wattbezugmodul/main.sh` + wattbezug=`timeout 10 modules/$wattbezugmodul/main.sh` #uberschuss zur berechnung wattbezugint=`printf "%.0f\n" $wattbezug` uberschuss=`expr $wattbezugint \* -1` @@ -22,14 +22,14 @@ fi #PV Leistung ermitteln if [[ $pvwattmodul != "none" ]]; then - pvwatt=`modules/$pvwattmodul/main.sh` + pvwatt=`timeout 10 modules/$pvwattmodul/main.sh` if [[ $debug == "1" ]]; then echo pvwatt $pvwatt fi fi #Ladeleistung ermitteln if [[ $ladeleistungmodul != "none" ]]; then - modules/$ladeleistungmodul/main.sh + timeout 10 modules/$ladeleistungmodul/main.sh lla1=$(cat /var/www/html/openWB/ramdisk/lla1) lla2=$(cat /var/www/html/openWB/ramdisk/lla2) lla3=$(cat /var/www/html/openWB/ramdisk/lla3) @@ -202,7 +202,11 @@ if grep -q 1 "/var/www/html/openWB/ramdisk/lademodus"; then fi exit 0 else - exit 0 + if (( $llalt < $minimalstromstaerke )); then + llneu=$((llalt + 1 )) + runs/$llneu.sh + fi + exit 0 fi fi if (( $uberschuss > $schaltschwelle )); then diff --git a/runs/0.sh b/runs/0.sh index a84a35783..a3be5ffdc 100755 --- a/runs/0.sh +++ b/runs/0.sh @@ -3,6 +3,10 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 0 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 0 +fi + if [[ $debug == "2" ]]; then echo "setz ladung auf 0A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/10.sh b/runs/10.sh index bc7ce0412..00ee68038 100755 --- a/runs/10.sh +++ b/runs/10.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1298 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 10 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 10A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/11.sh b/runs/11.sh index eca5cf177..6b6123f4e 100755 --- a/runs/11.sh +++ b/runs/11.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1427 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 11 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 11A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/12.sh b/runs/12.sh index 4af1474b6..5244b7ef4 100755 --- a/runs/12.sh +++ b/runs/12.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1557 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 12 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 12A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/13.sh b/runs/13.sh index e57710594..609f936ec 100755 --- a/runs/13.sh +++ b/runs/13.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1687 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 13 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 13A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/14.sh b/runs/14.sh index 9f1a091ba..4d35bd049 100755 --- a/runs/14.sh +++ b/runs/14.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1814 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 14 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 14A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/15.sh b/runs/15.sh index a55ac6bc2..3b16c31bc 100755 --- a/runs/15.sh +++ b/runs/15.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1947 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 15 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 15A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/16.sh b/runs/16.sh index fbf9ef800..53de6df06 100755 --- a/runs/16.sh +++ b/runs/16.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2077 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 16 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 16A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/17.sh b/runs/17.sh index 00e933d79..8c7573d17 100755 --- a/runs/17.sh +++ b/runs/17.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2206 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 17 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 17A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/18.sh b/runs/18.sh index 9fe28094a..ee333bde6 100755 --- a/runs/18.sh +++ b/runs/18.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2336 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 18 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 18A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/19.sh b/runs/19.sh index b59e97b84..ac0ff605f 100755 --- a/runs/19.sh +++ b/runs/19.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2466 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 19 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 19A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/20.sh b/runs/20.sh index 91f625cab..5a104c91b 100755 --- a/runs/20.sh +++ b/runs/20.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2596 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 20 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 20A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/21.sh b/runs/21.sh index 4f81bf1da..c92c99903 100755 --- a/runs/21.sh +++ b/runs/21.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2726 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 21 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 21A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/22.sh b/runs/22.sh index 14d4d067a..381a33618 100755 --- a/runs/22.sh +++ b/runs/22.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2855 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 22 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 22A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/23.sh b/runs/23.sh index 7a621b7c1..3895f7838 100755 --- a/runs/23.sh +++ b/runs/23.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 2985 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 23 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 23A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/24.sh b/runs/24.sh index 95c84b19f..b148c19c8 100755 --- a/runs/24.sh +++ b/runs/24.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3115 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 24 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 24A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/25.sh b/runs/25.sh index b1b952928..58a9a830a 100755 --- a/runs/25.sh +++ b/runs/25.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3245 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 25 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 25A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/26.sh b/runs/26.sh index 7a2dd13c8..246f77b85 100755 --- a/runs/26.sh +++ b/runs/26.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3375 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 26 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 26A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/27.sh b/runs/27.sh index 5037aec8e..f78d63a24 100755 --- a/runs/27.sh +++ b/runs/27.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3505 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 27 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 27A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/28.sh b/runs/28.sh index 36a885ce5..2745b9660 100755 --- a/runs/28.sh +++ b/runs/28.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3634 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 28 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 28A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/29.sh b/runs/29.sh index b8abc69a6..e918843bc 100755 --- a/runs/29.sh +++ b/runs/29.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3764 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 29 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 29A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/30.sh b/runs/30.sh index 72a9f5caa..344f1bb3f 100755 --- a/runs/30.sh +++ b/runs/30.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 3894 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 30 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 30A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/31.sh b/runs/31.sh index c46cf95da..52baad3be 100755 --- a/runs/31.sh +++ b/runs/31.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 4024 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 31 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 31A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/32.sh b/runs/32.sh index 22720094f..4bf98bfc9 100755 --- a/runs/32.sh +++ b/runs/32.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 4096 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 32 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 32A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/6.sh b/runs/6.sh index a33e5caf0..8c3e0968d 100755 --- a/runs/6.sh +++ b/runs/6.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 790 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 6 + fi if [[ $debug == "2" ]]; then echo "setz ladung auf 6A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/7.sh b/runs/7.sh index 792766337..d888c44d4 100755 --- a/runs/7.sh +++ b/runs/7.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 908 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 7 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 7A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/8.sh b/runs/8.sh index c92528284..4874bf875 100755 --- a/runs/8.sh +++ b/runs/8.sh @@ -3,6 +3,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1038 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 8 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 8A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/9.sh b/runs/9.sh index 74eb19e09..262e97660 100755 --- a/runs/9.sh +++ b/runs/9.sh @@ -4,6 +4,9 @@ if [[ $evsecon == "dac" ]]; then sudo python /var/www/html/openWB/runs/dac.py 1168 $dacregister fi +if [[ $evsecon == "modbusevse" ]]; then + sudo python /var/www/html/openWB/runs/evsewritemodbus.py $modbusevsesource $modbusevseid 9 +fi if [[ $debug == "2" ]]; then echo "setz ladung auf 9A" >> /var/www/html/openWB/web/lade.log fi diff --git a/runs/evsewritemodbus.py b/runs/evsewritemodbus.py new file mode 100644 index 000000000..a8473af05 --- /dev/null +++ b/runs/evsewritemodbus.py @@ -0,0 +1,10 @@ +#!/usr/bin/python3 +import sys + +seradd = str(sys.argv[1]) +from pymodbus.client.sync import ModbusSerialClient +client = ModbusSerialClient(method = "rtu", port=seradd, baudrate=9600, + stopbits=1, bytesize=8, timeout=1) +evseid = int(sys.argv[2]) +lla = int(sys.argv[3]) +rq = client.write_registers(1000, lla, unit=evseid) diff --git a/web/config.php b/web/config.php index 018c95166..80ce1efbc 100755 --- a/web/config.php +++ b/web/config.php @@ -1,4 +1,4 @@ '0', + 'lademodus' => '1', 'sofortll' => '15', ); \ No newline at end of file diff --git a/web/index.php b/web/index.php index 751792b63..f301cbb2b 100644 --- a/web/index.php +++ b/web/index.php @@ -208,16 +208,16 @@ function getfile() {
-
-
- Nur PV -
-
+
+
+ Nur PV +
+

@@ -246,7 +246,7 @@ function getfile() {
- Ver0.13 + Ver0.14
Einstellungen diff --git a/web/settings.php b/web/settings.php index 20fc09119..c1c8ac46a 100644 --- a/web/settings.php +++ b/web/settings.php @@ -1,5 +1,7 @@ - +Zurück +
Gültige Werte /dev/ttyUSB0, /dev/virtualcom. Serieller Port an dem der SDM angeschlossen ist.

- -
- Gültige Werte 80xx +, Z.B. 8081. Der Port für das Zwischentool zum Auslesen des SDM.

+ +
+ Gültige Werte IP. Ist die source "virtualcomX" wird automatisch ein Lan Konverter genutzt.

PV Module


@@ -206,9 +205,6 @@
Gültige Werte 1-254. Modbus ID des SDM. Getestet SDM230 & SDM630v2.

- -
- Gültige Werte 80xx +, Z.B. 8081. Der Port für das Zwischentool zum Auslesen des SDM. Überschneidungen mit anderen Modulen verhindern


Gültige Werte IP. Ist die source "virtualcomX" wird automatisch ein Lan Konverter genutzt.

diff --git a/web/tools/savesettings.php b/web/tools/savesettings.php index 232876b62..8913a0199 100644 --- a/web/tools/savesettings.php +++ b/web/tools/savesettings.php @@ -130,17 +130,6 @@ file_put_contents('/var/www/html/openWB/openwb.conf', $result); $result = ''; $lines = file('/var/www/html/openWB/openwb.conf'); -foreach($lines as $line) { - if(strpos($line, "sdm630modbusbezugport=") !== false) { - $result .= 'sdm630modbusbezugport='.$_POST[sdm630modbusbezugport]."\n"; - } - else { - $result .= $line; - } -} -file_put_contents('/var/www/html/openWB/openwb.conf', $result); -$result = ''; -$lines = file('/var/www/html/openWB/openwb.conf'); foreach($lines as $line) { if(strpos($line, "pvwattmodul=") !== false) { $result .= 'pvwattmodul='.$_POST[pvwattmodul]."\n"; @@ -197,8 +186,8 @@ $result = ''; $lines = file('/var/www/html/openWB/openwb.conf'); foreach($lines as $line) { - if(strpos($line, "sdm630modbusllport=") !== false) { - $result .= 'sdm630modbusllport='.$_POST[sdm630modbusllport]."\n"; + if(strpos($line, "sdm630modbusbezuglanip=") !== false) { + $result .= 'sdm630modbusbezuglanip='.$_POST[sdm630modbusbezuglanip]."\n"; } else { $result .= $line;