forked from snaptec/openWB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alternative EVU+Batterie-Module für Solarwatt/MyReserve-Geräte mit Ga…
…teway (snaptec#1362) * Alternative EVU+Batterie-Module für Solarwatt/MyReserve-Geräte mit Gateway
- Loading branch information
Showing
5 changed files
with
156 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,42 @@ | ||
#!/bin/bash | ||
|
||
|
||
|
||
|
||
|
||
#sresponse=$(curl --connect-timeout 3 -s "http://$speichersolarwattip/rest/kiwigrid/wizard/devices") | ||
sresponse=$(curl --connect-timeout 3 -s "http://${speicher1_ip}/rest/kiwigrid/wizard/devices") | ||
|
||
#bezugwh=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.WorkConsumedFromGrid.value != null) | .tagValues.WorkConsumedFromGrid.value' | sed 's/\..*$//') | ||
#echo $bezugwh > /var/www/html/openWB/ramdisk/bezugkwh | ||
#einspeisungwh=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.WorkOut.value != null) | .tagValues.WorkOut.value' | sed 's/\..*$//') | ||
#echo $einspeisungwh > /var/www/html/openWB/ramdisk/einspeisungkwh | ||
|
||
bezugw=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerConsumedFromGrid.value != null) | .tagValues.PowerConsumedFromGrid.value' | sed 's/\..*$//') | ||
|
||
einspeisungw=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerOut.value != null) | .tagValues.PowerOut.value' | head -n 1 | sed 's/\..*$//') | ||
bezugwatt=$(echo "scale=0; $bezugw - $einspeisungw /1" |bc) | ||
|
||
echo $bezugwatt > /var/www/html/openWB/ramdisk/wattbezug | ||
|
||
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd) | ||
RAMDISKDIR="$OPENWBBASEDIR/ramdisk" | ||
MODULE="EVU" | ||
LOGFILE="$RAMDISKDIR/openWB.log" | ||
Debug=$debug | ||
BEZUGFILE="$RAMDISKDIR/wattbezug" | ||
|
||
DebugLog(){ | ||
if (( Debug > 0 )); then | ||
timestamp=`date +"%Y-%m-%d %H:%M:%S"` | ||
echo "$timestamp: ${MODULE}: $@" >> $LOGFILE | ||
fi | ||
} | ||
|
||
|
||
if (( $solarwattmethod == 0 )); then #Abruf über Energy Manager | ||
sresponse=$(curl --connect-timeout 3 -s "http://${speicher1_ip}/rest/kiwigrid/wizard/devices") | ||
|
||
if ((${#sresponse} < 10)); then | ||
bezugwatt=$(<$BEZUGFILE) | ||
else | ||
bezugw=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerConsumedFromGrid.value != null) | .tagValues.PowerConsumedFromGrid.value' | sed 's/\..*$//') | ||
einspeisungw=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerOut.value != null) | .tagValues.PowerOut.value' | head -n 1 | sed 's/\..*$//') | ||
bezugwatt=$(echo "scale=0; $bezugw - $einspeisungw /1" |bc) | ||
fi | ||
fi | ||
if (( $solarwattmethod == 1 )); then #Abruf über Gateway | ||
sresponse=$(curl --connect-timeout 3 -s "http://${speicher1_ip2}:8080/") | ||
|
||
if ((${#sresponse} < 10)); then | ||
bezugwatt=$(<$BEZUGFILE) | ||
else | ||
bezugw=$(echo $sresponse | jq '.FData.PGrid' | sed 's/\..*$//') | ||
bezugwatt=$(echo "scale=0; $bezugw / 1" | bc) | ||
fi | ||
fi | ||
|
||
DebugLog "Netzbezug: $bezugwatt W" | ||
echo $bezugwatt > $BEZUGFILE | ||
echo $bezugwatt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,49 @@ | ||
#!/bin/bash | ||
|
||
DMOD="MAIN" | ||
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd) | ||
RAMDISKDIR="$OPENWBBASEDIR/ramdisk" | ||
MODULE="Speicher" | ||
LOGFILE="$RAMDISKDIR/openWB.log" | ||
Debug=$debug | ||
|
||
openwbDebugLog ${DMOD} 1 "URL: ${speicher1_ip}/rest/kiwigrid/wizard/devices" | ||
sresponse=$(curl --connect-timeout 5 -s "http://${speicher1_ip}/rest/kiwigrid/wizard/devices") | ||
#sresponse=$(curl --connect-timeout 5 -s "http://192.168.178.64/rest/kiwigrid/wizard/devices") | ||
openwbDebugLog ${DMOD} 1 "Resp: $?" | ||
#pvwh=$(echo $sresponse | jq '.result.items | .[0].tagValues.WorkProduced.value') | ||
#echo "PV erzeugt $pvwh" | ||
#pvwatt=$(echo $sresponse | jq '.result.items | .[0].tagValues.PowerProduced.value') | ||
#echo "PV Leistung aktuellt $pvwatt" | ||
#bezugwh=$(echo $sresponse | jq '.result.items | .[0].tagValues.WorkConsumedFromGrid.value') | ||
#echo "Vom Netz bezogen Gesamt $bezugwh" | ||
#bezugw=$(echo $sresponse | jq '.result.items | .[0].tagValues.PowerConsumedFromGrid.value') | ||
#einspeisungw=$(echo $sresponse | jq '.result.items | .[0].tagValues.PowerOut.value') | ||
#bezugwatt=$(echo "scale=0; $bezugw - $einspeisungw /1" |bc) | ||
#echo "Bezug/Einspeisung am Übergabepunkt $bezugwatt" | ||
#einspeisungwh=$(echo $sresponse | jq '.result.items | .[0].tagValues.WorkOut.value') | ||
#echo "Ins Netz eingespeist Gesamt $einspeisungwh" | ||
|
||
speichere=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerConsumedFromStorage.value != null) | .tagValues.PowerConsumedFromStorage.value' | sed 's/\..*$//') | ||
openwbDebugLog ${DMOD} 1 "Speichere: ${speichere}" | ||
speicherein=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerOutFromStorage.value != null) | .tagValues.PowerOutFromStorage.value' | sed 's/\..*$//') | ||
openwbDebugLog ${DMOD} 1 "Speicherein: ${speicherein}" | ||
speicheri=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerBuffered.value != null) | .tagValues.PowerBuffered.value' | sed 's/\..*$//') | ||
openwbDebugLog ${DMOD} 1 "Speicheri: ${speicheri}" | ||
#speicherleistung=$((speichere + speicherin - speicheri)) | ||
speicherleistung=$(echo "scale=0; ($speichere + $speicherin - $speicheri) *-1" | bc) | ||
openwbDebugLog ${DMOD} 1 "Speicherleistung: ${speicherleistung}" | ||
DebugLog(){ | ||
if (( Debug > 0 )); then | ||
timestamp=`date +"%Y-%m-%d %H:%M:%S"` | ||
echo "$timestamp: ${MODULE}: $@" >> $LOGFILE | ||
fi | ||
} | ||
|
||
if (( $solarwattmethod == 0 )); then #Abruf über Energy Manager | ||
sresponse=$(curl --connect-timeout 5 -s "http://${speicher1_ip}/rest/kiwigrid/wizard/devices") | ||
|
||
if ((${#sresponse} < 10)); then | ||
exit 1 | ||
fi | ||
|
||
speichere=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerConsumedFromStorage.value != null) | .tagValues.PowerConsumedFromStorage.value' | sed 's/\..*$//') | ||
speicherein=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerOutFromStorage.value != null) | .tagValues.PowerOutFromStorage.value' | sed 's/\..*$//') | ||
speicheri=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerBuffered.value != null) | .tagValues.PowerBuffered.value' | sed 's/\..*$//') | ||
|
||
speicherleistung=$(echo "scale=0; ($speichere + $speicherin - $speicheri) *-1" | bc) | ||
speichersoc=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.StateOfCharge.value != null) | .tagValues.StateOfCharge.value' | sed 's/\..*$//') | ||
fi | ||
|
||
if (( $solarwattmethod == 1 )); then #Abruf über Gateway | ||
sresponse=$(curl --connect-timeout 3 -s "http://${speicher1_ip2}:8080/") | ||
|
||
if ((${#sresponse} < 10)); then | ||
exit 1 | ||
fi | ||
|
||
ibat=$(echo $sresponse | jq '.FData.IBat') | ||
vbat=$(echo $sresponse | jq '.FData.VBat') | ||
speicherleistung=$(echo "($ibat * $vbat)" | bc) | ||
speicherleistung=$(echo "scale=0; ($speicherleistung) / (-1)" | bc) | ||
speichersoc=$(echo $sresponse | jq '.SData.SoC' | sed 's/\..*$//') | ||
fi | ||
|
||
DebugLog "Speicherleistung: ${speicherleistung} W" | ||
echo $speicherleistung > /var/www/html/openWB/ramdisk/speicherleistung | ||
#echo "Batterieladung/entladung $speicherleistung" | ||
speichersoc=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.StateOfCharge.value != null) | .tagValues.StateOfCharge.value' | sed 's/\..*$//') | ||
openwbDebugLog ${DMOD} 1 "SpeicherSoC: ${speichersoc}" | ||
#echo "Batterieladezustand $speichersoc" | ||
|
||
DebugLog "SpeicherSoC: ${speichersoc} %" | ||
echo $speichersoc > /var/www/html/openWB/ramdisk/speichersoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
#!/bin/bash | ||
|
||
#sresponse=$(curl --connect-timeout 3 -s "http://$speichersolarwattip/rest/kiwigrid/wizard/devices") | ||
OPENWBBASEDIR=$(cd `dirname $0`/../../ && pwd) | ||
RAMDISKDIR="$OPENWBBASEDIR/ramdisk" | ||
MODULE="PV" | ||
LOGFILE="$RAMDISKDIR/openWB.log" | ||
Debug=$debug | ||
|
||
DebugLog(){ | ||
if (( Debug > 0 )); then | ||
timestamp=`date +"%Y-%m-%d %H:%M:%S"` | ||
echo "$timestamp: ${MODULE}: $@" >> $LOGFILE | ||
fi | ||
} | ||
|
||
sresponse=$(curl --connect-timeout 3 -s "http://${speicher1_ip}/rest/kiwigrid/wizard/devices") | ||
|
||
#pvwh=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.WorkProduced.value != null) | .tagValues.WorkProduced.value' | sed 's/\..*$//') | ||
#echo "PV erzeugt $pvwh" | ||
#echo $pvwh > /var/www/html/openWB/ramdisk/pvkwh | ||
pvwatt=$(echo $sresponse | jq '.result.items | .[] | select(.tagValues.PowerProduced.value != null) | .tagValues.PowerProduced.value' | sed 's/\..*$//') | ||
DebugLog "PV-Leistung: ${pvwatt} W" | ||
pvwatt=$((pvwatt * -1)) | ||
|
||
echo $pvwatt > /var/www/html/openWB/ramdisk/pvwatt | ||
echo $pvwatt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters