Skip to content

Commit

Permalink
WR Fronius PV Watt Abfrage String geaendert, Loadsharing LP12 16A Mod…
Browse files Browse the repository at this point in the history
…e Bugfix
  • Loading branch information
snaptec committed Jan 16, 2019
1 parent 3e59c6d commit 47848bb
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 13 deletions.
11 changes: 8 additions & 3 deletions modules/wr_fronius/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
#Auslesen eine Fronius Symo WR über die integrierte API des WR. Rückgabewert ist die aktuelle Wattleistung
. /var/www/html/openWB/openwb.conf

pvwatttmp=$(curl --connect-timeout 5 -s $wrfroniusip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System)
pvwatt=$(echo $pvwatttmp | jq '.Body.Data.PAC.Values' | sed 's/.*://' | tr -d '\n' | sed 's/^.\{2\}//' | sed 's/.$//' )
#pvwatttmp=$(curl --connect-timeout 5 -s $wrfroniusip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System)
#pvwatt=$(echo $pvwatttmp | jq '.Body.Data.PAC.Values' | sed 's/.*://' | tr -d '\n' | sed 's/^.\{2\}//' | sed 's/.$//' )
pvwatttmp=$(curl --connect-timeout 5 -s "$wrfroniusip/solar_api/v1/GetPowerFlowRealtimeData.fcgi?Scope?System")
pvwatt=$(echo $pvwatttmp | jq '.Body.Data.Site.P_PV' |sed 's/\..*$//')


#wenn WR aus bzw. im standby (keine Antwort) ersetze leeren Wert durch eine 0
re='^[0-9]+$'
re='^-?[0-9]+$'
if ! [[ $pvwatt =~ $re ]] ; then
pvwatt="0"
fi
Expand All @@ -16,5 +19,7 @@ echo $pvwatt
echo $pvwatt > /var/www/html/openWB/ramdisk/pvwatt


pvwatttmp=$(curl --connect-timeout 5 -s $wrfroniusip/solar_api/v1/GetInverterRealtimeData.cgi?Scope=System)

pvkwh=$(echo $pvwatttmp | jq '.Body.Data.TOTAL_ENERGY.Values' | sed '2!d' |sed 's/.*: //' )
echo $pvkwh > /var/www/html/openWB/ramdisk/pvkwh
40 changes: 40 additions & 0 deletions regel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,46 @@ if (( lademodus == 3 )); then
auslademodus
fi

#loadsharing check
if [[ $loadsharinglp12 == "1" ]]; then
if (( loadsharingalp12 == 16 )); then
agrenze=8
aagrenze=16
if (( current > 16 )); then
current=16
fi
else
agrenze=16
aagrenze=32
fi
tcurrent=$(( llalt + llalts1 ))
if (( tcurrent > aagrenze )); then
#detect charging cars
if (( lla1 > 1 )); then
lp1c=1
if (( lla2 > 1 )); then
lp1c=2
fi
else
lp1c=0
fi
if (( llas11 > 1 )); then
lp2c=1
if (( llas12 > 1 )); then
lp2c=2
fi
else
lp2c=0
fi
chargingphases=$(( lp1c + lp2c ))
if (( chargingphases > 2 )); then
runs/set-current "$agrenze" all
exit 0
fi
fi
fi


#########################################
#Regelautomatiken

Expand Down
26 changes: 16 additions & 10 deletions runs/set-current.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ if [[ $loadsharinglp12 == "1" ]]; then
aagrenze=16
if (( current > 16 )); then
current=16
new2=all
fi
else
agrenze=16
Expand All @@ -206,28 +207,29 @@ if [[ $loadsharinglp12 == "1" ]]; then
lslpl2=$((lla2 + llas13))
lslpl3=$((lla3 + llas11))
#detect charging cars
if (( lla1 > 5 )); then
if (( lla1 > 1 )); then
lp1c=1
if (( lla2 > 5 )); then
if (( lla2 > 1 )); then
lp1c=2
fi
else
lp1c=0
fi
if (( llas12 > 5 )); then
if (( llas11 > 1 )); then
lp2c=1
if (( llas13 > 5 )); then
if (( llas12 > 1 )); then
lp2c=2
fi
else
lp2c=0
fi
chargingphases=$(( lp1c + lp2c ))
if (( chargingphases > 2 )); then
current=agrenze
current=$agrenze
fi
if (( lslpl1 > aagrenze )) && (( lslpl2 > aagrenze )) && (( lslpl3 > aagrenze )); then
current=$(( agrenze - 2))
current=$(( agrenze - 1))
new2=all
if [[ $debug == "2" ]]; then
echo "setzeladung auf $current durch loadsharing LP12" >> /var/www/html/openWB/web/lade.log
fi
Expand All @@ -236,18 +238,22 @@ if [[ $loadsharinglp12 == "1" ]]; then
fi



if ! [ -z $new2 ]; then
points=$new2
else
points=$2
fi

# set charging current - first charging point
if [[ $2 == "all" ]] || [[ $2 == "m" ]]; then
if [[ $points == "all" ]] || [[ $points == "m" ]]; then
setChargingCurrent
echo $current > /var/www/html/openWB/ramdisk/llsoll
echo $lstate > /var/www/html/openWB/ramdisk/ladestatus
fi

# set charging current - second charging point
if [[ $lastmanagement == "1" ]]; then
if [[ $2 == "all" ]] || [[ $2 == "s1" ]]; then
if [[ $points == "all" ]] || [[ $points == "s1" ]]; then
evsecon=$evsecons1
dacregister=$dacregisters1
modbusevsesource=$evsesources1
Expand All @@ -267,7 +273,7 @@ fi

# set charging current - second charging point
if [[ $lastmanagements2 == "1" ]]; then
if [[ $2 == "all" ]] || [[ $2 == "s2" ]]; then
if [[ $points == "all" ]] || [[ $points == "s2" ]]; then
evsecon=$evsecons2
dacregister=$dacregisters2
modbusevsesource=$evsesources2
Expand Down

0 comments on commit 47848bb

Please sign in to comment.