Skip to content

Commit

Permalink
Monthly array pos change bug
Browse files Browse the repository at this point in the history
Monthly growing array in json -> adaption of position in array for correct values neccesary. Old stuff is depricated and will be removed in next Update
  • Loading branch information
sa0win committed May 16, 2020
1 parent d6f00e0 commit 0211d70
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion modules/bezug_lgessv1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ess_pass=$lgessv1pass
if [ "$ess_api_ver" == "10.2019" ]; then
arr_pos="13"
else
arr_pos="0"
arr_pos="1"
fi
#
## Prüfen, ob ein Sessionkey in der Ramdisk vorhanden ist. Wenn nicht,
Expand Down Expand Up @@ -71,6 +71,8 @@ fi
## Daten für Langzeitlog holen
#
jahr=$(date +%Y)
monat=$(date +%m)
arr_pos=$(($monat))
year_of_stat='"'year'"':'"'$jahr'"'
json=$(curl -s -k --connect-timeout 5 -d '{"auth_key":'$session_key', '$year_of_stat'}' -H "Content-Type: application/json" -X POST $ess_url'/v1/user/graph/load/year')
ikwh=$(echo $json | jq '.loginfo['$arr_pos'].total_purchase' | sed 's/.*://' | tr -d '\n' | sed 's/\"//' | sed 's/\"//' | sed 's/kwh//' | sed 's/\.//')
Expand Down
4 changes: 3 additions & 1 deletion modules/speicher_lgessv1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ess_pass=$lgessv1pass
if [ "$ess_api_ver" == "10.2019" ]; then
arr_pos="13"
else
arr_pos="0"
arr_pos="1"
fi
#
## Prüfen, ob ein Sessionkey in der Ramdisk vorhanden ist. Wenn nicht,
Expand Down Expand Up @@ -74,6 +74,8 @@ fi
#
jahr=$(date +%Y)
year_of_stat='"'year'"':'"'$jahr'"'
monat=$(date +%m)
arr_pos=$($monat)
json=$(curl -s -k --connect-timeout 5 -d '{"auth_key":'$session_key', '$year_of_stat'}' -H "Content-Type: application/json" -X POST $ess_url'/v1/user/graph/batt/year')
speicherikwh=$(echo $json | jq '.loginfo['$arr_pos'].total_charge' | sed 's/.*://' | tr -d '\n' | sed 's/\"//' | sed 's/\"//' | sed 's/kwh//' | sed 's/\.//')
speicherekwh=$(echo $json | jq '.loginfo['$arr_pos'].total_discharge' | sed 's/.*://' | tr -d '\n' | sed 's/\"//' | sed 's/\"//' | sed 's/kwh//' | sed 's/\.//')
Expand Down
4 changes: 3 additions & 1 deletion modules/wr_lgessv1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ess_pass=$lgessv1pass
if [ "$ess_api_ver" == "10.2019" ]; then
arr_pos="13"
else
arr_pos="0"
arr_pos="1"
fi
#
## Prüfen, ob ein Sessionkey in der Ramdisk vorhanden ist. Wenn nicht,
Expand Down Expand Up @@ -67,6 +67,8 @@ pcs_pv_total_power=$(echo $json | jq '.statistics.pcs_pv_total_power' | sed 's/.
#
jahr=$(date +%Y)
year_of_stat='"'year'"':'"'$jahr'"'
monat=$(date +%m)
arr_pos=$($monat)
json=$(curl -s -k --connect-timeout 5 -d '{"auth_key":'$session_key', '$year_of_stat'}' -H "Content-Type: application/json" -X POST $ess_url'/v1/user/graph/pv/year')
pvkwh=$(echo $json | jq '.loginfo['$arr_pos'].total_generation' | sed 's/.*://' | tr -d '\n' | sed 's/\"//' | sed 's/\"//' | sed 's/kwh//' | sed 's/\.//')
ekwh=$(echo $json | jq '.loginfo['$arr_pos'].total_Feed_in' | sed 's/.*://' | tr -d '\n' | sed 's/\"//' | sed 's/\"//' | sed 's/kwh//' | sed 's/\.//')
Expand Down

0 comments on commit 0211d70

Please sign in to comment.