Skip to content

Commit

Permalink
update grid modules
Browse files Browse the repository at this point in the history
  • Loading branch information
benderl committed Jun 27, 2022
1 parent 0edb3e8 commit 1a61520
Show file tree
Hide file tree
Showing 42 changed files with 196 additions and 265 deletions.
16 changes: 5 additions & 11 deletions modules/bezug_alphaess/main.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.alpha_ess.device" "counter" "${alphasource}" "${alphav123}" "${alphaip}" >>${MYLOGFILE} 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.alpha_ess.device" "counter" "${alphasource}" "${alphav123}" "${alphaip}" >>"${MYLOGFILE}" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
wattbezug=$(<${RAMDISKDIR}/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"
8 changes: 4 additions & 4 deletions modules/bezug_batterx/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ DMOD="MAIN"
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

# Werte werden im WR ausgelesen, max eine Abfrage pro Sekunde
if [ ${pvwattmodul} != "wr_batterx" ]; then
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.batterx.device" "counter" "${batterx_ip}" >>"${MYLOGFILE}" 2>&1
ret=$?
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.batterx.device" "counter" "${batterx_ip}" >>"${MYLOGFILE}" 2>&1
ret=$?
fi

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
Expand Down
14 changes: 4 additions & 10 deletions modules/bezug_carlogavazzilan/main.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu_carlo_gavazzi.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.carlo_gavazzi.device" "counter" "${bezug1_ip}" >>${MYLOGFILE} 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.carlo_gavazzi.device" "counter" "${bezug1_ip}" >>"${MYLOGFILE}" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"

wattbezug=$(<${RAMDISKDIR}/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"
18 changes: 13 additions & 5 deletions modules/bezug_discovergy/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
#DMOD="EVU"
DMOD="MAIN"

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

# If both wr_discovergy and bezug_discovergy are activated, then runs/loadvars.sh will run `wr_discovergy` first.
# In this case that wr_discovergy will fetch data for both inverter end counter and there is nothing left for us to do
Expand All @@ -9,9 +18,8 @@ OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
#
# The usage of wr_discovergy without bezug_discovergy is not intended and thus not handled.

if [[ "$pvwattmodul" != "wr_discovergy" ]]
then
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.discovergy.device" "$discovergyuser" "$discovergypass" "$discovergyevuid" "" >> "$OPENWBBASEDIR/ramdisk/openWB.log" 2>&1
if [[ "$pvwattmodul" != "wr_discovergy" ]]; then
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.discovergy.device" "$discovergyuser" "$discovergypass" "$discovergyevuid" "" >> "$MYLOGFILE" 2>&1
fi

cat /var/www/html/openWB/ramdisk/wattbezug
cat "${RAMDISKDIR}/wattbezug"
3 changes: 1 addition & 2 deletions modules/bezug_e3dc/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ bash "$OPENWBBASEDIR/packages/legacy_run.sh" "bezug_e3dc.e3dc" "${e3dcip}" >>"${
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
wattbezug=$(<"${RAMDISKDIR}/wattbezug")
echo "$wattbezug"
cat "${RAMDISKDIR}/wattbezug"
12 changes: 6 additions & 6 deletions modules/bezug_ethmpm3pm/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ DMOD="MAIN"
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi
if { [[ $pvwattmodul != "wr_ethmpm3pmaevu" ]] || [[ $pv2wattmodul != "wr2_ethlovatoaevu" ]]; } && [[ $speichermodul != "speicher_sdmaevu" ]]; then
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.openwb_evu_kit.device" "counter" "${evukitversion}" >>"${MYLOGFILE}" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.openwb_evu_kit.device" "counter" "${evukitversion}" >>"${MYLOGFILE}" 2>&1
ret=$?
openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
fi

cat "${RAMDISKDIR}/wattbezug"
14 changes: 4 additions & 10 deletions modules/bezug_ethmpm3pmflex/main.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu_json.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.openwb_flex.device" "counter" "${evuflexversion}" "${evuflexip}" "${evuflexport}" "${evuflexid}" >>${MYLOGFILE} 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.openwb_flex.device" "counter" "${evuflexversion}" "${evuflexip}" "${evuflexport}" "${evuflexid}" >>"${MYLOGFILE}" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"

wattbezug=$(<${RAMDISKDIR}/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"
10 changes: 4 additions & 6 deletions modules/bezug_fems/fems.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@

def write_ramdisk(val, file):
try:
f = open('/var/www/html/openWB/ramdisk/'+file, 'w')
f.write(str(val))
f.close()
with open('/var/www/html/openWB/ramdisk/'+file, 'w') as f:
f.write(str(val))
except:
traceback.print_exc()

Expand All @@ -24,9 +23,8 @@ def get_value(url, file):
try:
response = requests.get(url, timeout=2).json()
val = response["value"]
f = open('/var/www/html/openWB/ramdisk/'+file, 'w')
f.write(str(val))
f.close()
with open('/var/www/html/openWB/ramdisk/'+file, 'w') as f:
f.write(str(val))
except:
traceback.print_exc()

Expand Down
3 changes: 1 addition & 2 deletions modules/bezug_fems/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ bash "$OPENWBBASEDIR/packages/legacy_run.sh" "bezug_fems.fems" "$femskacopw" "$f
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
wattbezug=$(<"${RAMDISKDIR}/wattbezug")
echo "$wattbezug"
cat "${RAMDISKDIR}/wattbezug"
8 changes: 4 additions & 4 deletions modules/bezug_fronius_sm/froniusloadmeterdata.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
$url = "http://".$_GET["ip"]."/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System";
$url = "http://".$_GET["ip"]."/solar_api/v1/GetMeterRealtimeData.cgi?Scope=System";

ini_set("default_socket_timeout", 5);
header('Content-Type: application/json');
echo file_get_contents($url);
ini_set("default_socket_timeout", 5);
header('Content-Type: application/json');
echo file_get_contents($url);
?>
4 changes: 2 additions & 2 deletions modules/bezug_good_we/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ DMOD="MAIN"
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.good_we.device" "counter" "${good_we_ip}" "${good_we_id}">>"${MYLOGFILE}" 2>&1
Expand Down
16 changes: 5 additions & 11 deletions modules/bezug_http/main.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="$OPENWBBASEDIR/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ $DMOD == "MAIN" ]; then
MYLOGFILE="$RAMDISKDIR/openWB.log"
MYLOGFILE="$RAMDISKDIR/openWB.log"
else
MYLOGFILE="$RAMDISKDIR/evu.log"
MYLOGFILE="$RAMDISKDIR/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.http.device" "counter" "${bezug_http_w_url}" "${bezug_http_ikwh_url}" "${bezug_http_ekwh_url}" "${bezug_http_l1_url}" "${bezug_http_l2_url}" "${bezug_http_l3_url}" >>$MYLOGFILE 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.http.device" "counter" "${bezug_http_w_url}" "${bezug_http_ikwh_url}" "${bezug_http_ekwh_url}" "${bezug_http_l1_url}" "${bezug_http_l2_url}" "${bezug_http_l3_url}" >>"$MYLOGFILE" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "RET: ${ret}"

wattbezug=$(</var/www/html/openWB/ramdisk/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"
2 changes: 1 addition & 1 deletion modules/bezug_huawei/main.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
OPENWBBASEDIR=$(cd $(dirname "${BASH_SOURCE[0]}")/../.. && pwd)
OPENWBBASEDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)

#datenauslesung erfolgt im PV Modul
cat "$OPENWBBASEDIR/ramdisk/wattbezug"
14 changes: 4 additions & 10 deletions modules/bezug_janitza/main.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu_janitza.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.janitza.device" "counter" "${bezug1_ip}" >>${MYLOGFILE} 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.janitza.device" "counter" "${bezug1_ip}" >>"${MYLOGFILE}" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"

wattbezug=$(<${RAMDISKDIR}/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"
14 changes: 4 additions & 10 deletions modules/bezug_json/main.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu_json.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

openwbDebugLog ${DMOD} 2 "EVU URL: ${bezugjsonurl}"
openwbDebugLog ${DMOD} 2 "Filter Watt : ${bezugjsonwatt}"
openwbDebugLog ${DMOD} 2 "Filter Bezug: ${bezugjsonkwh}"
openwbDebugLog ${DMOD} 2 "Filter Einsp: ${einspeisungjsonkwh}"

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.json.device" "counter" "${bezugjsonurl}" "${bezugjsonwatt}" "${bezugjsonkwh}" "${einspeisungjsonkwh}" >>$MYLOGFILE 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.json.device" "counter" "${bezugjsonurl}" "${bezugjsonwatt}" "${bezugjsonkwh}" "${einspeisungjsonkwh}" >>"$MYLOGFILE" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "RET: ${ret}"

evuwatt=$(<${RAMDISKDIR}/wattbezug)
echo ${evuwatt}
cat "${RAMDISKDIR}/wattbezug"
3 changes: 1 addition & 2 deletions modules/bezug_kostalpiko/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ ret=$?

openwbDebugLog ${DMOD} 2 "RET: ${ret}"

wattbezug=$(<"$RAMDISKDIR/wattbezug")
echo "$wattbezug"
cat "${RAMDISKDIR}/wattbezug"
3 changes: 1 addition & 2 deletions modules/bezug_ksem/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ bash "$OPENWBBASEDIR/packages/legacy_run.sh" "bezug_ksem.readksem" "${ksemip}" >
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"
wattbezug=$(<"${RAMDISKDIR}/wattbezug")
echo "$wattbezug"
cat "${RAMDISKDIR}/wattbezug"
4 changes: 2 additions & 2 deletions modules/bezug_lgessv1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ DMOD="MAIN"
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu.log"
MYLOGFILE="${RAMDISKDIR}/evu.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.lg.device" "counter" "${lgessv1ip}" "${lgessv1pass}" >>"${MYLOGFILE}" 2>&1
Expand Down
6 changes: 2 additions & 4 deletions modules/bezug_mqtt/main.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="$OPENWBBASEDIR/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)

wattbezug=$(<$RAMDISKDIR/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"

openwbModulePublishState "EVU" 0 "Kein Fehler"
13 changes: 3 additions & 10 deletions modules/bezug_powerdog/main.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@

#!/bin/bash
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd)
OPENWBBASEDIR=$(cd "$(dirname "$0")/../../" && pwd)
RAMDISKDIR="${OPENWBBASEDIR}/ramdisk"
MODULEDIR=$(cd `dirname $0` && pwd)
#DMOD="EVU"
DMOD="MAIN"
Debug=$debug

#For development only
#Debug=1

if [ ${DMOD} == "MAIN" ]; then
MYLOGFILE="${RAMDISKDIR}/openWB.log"
else
MYLOGFILE="${RAMDISKDIR}/evu_powerdog.log"
fi

bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.powerdog.device" "counter" "${bezug1_ip}" >>${MYLOGFILE} 2>&1
bash "$OPENWBBASEDIR/packages/legacy_run.sh" "modules.powerdog.device" "counter" "${bezug1_ip}" >>"${MYLOGFILE}" 2>&1
ret=$?

openwbDebugLog ${DMOD} 2 "EVU RET: ${ret}"

wattbezug=$(<${RAMDISKDIR}/wattbezug)
echo $wattbezug
cat "${RAMDISKDIR}/wattbezug"
3 changes: 1 addition & 2 deletions modules/bezug_powerfox/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ bash "$OPENWBBASEDIR/packages/legacy_run.sh" "bezug_powerfox.powerfox" "${powerf
ret=$?

openwbDebugLog ${DMOD} 2 "RET: ${ret}"
wattbezug=$(<"${RAMDISKDIR}/wattbezug")
echo "$wattbezug"
cat "${RAMDISKDIR}/wattbezug"
Loading

0 comments on commit 1a61520

Please sign in to comment.