Skip to content

Commit

Permalink
Fix Audi SoC
Browse files Browse the repository at this point in the history
  • Loading branch information
snaptec committed Dec 8, 2020
1 parent 462300a commit 4ce7be6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
13 changes: 1 addition & 12 deletions modules/soc_audi/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ if (( auditimer < 180 )); then
fi
echo $auditimer > /var/www/html/openWB/ramdisk/soctimer
else
answer=$(sudo python3 /var/www/html/openWB/modules/soc_audi/Run.py $soc_audi_username $soc_audi_passwort)
vin=$(echo $answer | sed 's/.*: //' | head -c-3 | cut -c 2-)
acctoken=$(cat token.json | jq -r .access_token)
battsoc=$(curl -s --header "Accept: application/json" --header "X-App-Name: eRemote" --header "X-App-Version: 1.0.0" --header "User-Agent: okhttp/2.3.0" --header "Authorization: AudiAuth 1 $acctoken" https://msg.audi.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/$vin/charger)
soclevel=$(echo $battsoc | jq .charger.status.batteryStatusData.stateOfCharge.content)

re='^-?[0-9]+$'
if [[ $soclevel =~ $re ]] ; then
if (( $soclevel != 0 )) ; then
echo $soclevel > /var/www/html/openWB/ramdisk/soc
fi
fi
/var/www/html/openWB/modules/evcc-soc audi --user "$soc_audi_username" --password "$soc_audi_passwort" > /var/www/html/openWB/ramdisk/soc &
echo 1 > /var/www/html/openWB/ramdisk/soctimer
fi
12 changes: 1 addition & 11 deletions modules/soc_audilp2/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,7 @@ if (( auditimer < 180 )); then
fi
echo $auditimer > /var/www/html/openWB/ramdisk/soctimer1
else
answer=$(sudo python3 /var/www/html/openWB/modules/soc_audilp2/Run.py $soc2user $soc2pass)
vin=$(echo $answer | sed 's/.*: //' | head -c-3 | cut -c 2-)
acctoken=$(cat token.json | jq -r .access_token)
battsoc=$(curl -s --header "Accept: application/json" --header "X-App-Name: eRemote" --header "X-App-Version: 1.0.0" --header "User-Agent: okhttp/2.3.0" --header "Authorization: AudiAuth 1 $acctoken" https://msg.audi.de/fs-car/bs/batterycharge/v1/Audi/DE/vehicles/$vin/charger)
soclevel=$(echo $battsoc | jq .charger.status.batteryStatusData.stateOfCharge.content)
/var/www/html/openWB/modules/evcc-soc audi --user "$soc2user" --password "$soc2pass" > /var/www/html/openWB/ramdisk/soc1 &

re='^-?[0-9]+$'
if [[ $soclevel =~ $re ]] ; then
if (( $soclevel != 0 )) ; then
echo $soclevel > /var/www/html/openWB/ramdisk/soc1
fi
fi
echo 1 > /var/www/html/openWB/ramdisk/soctimer1
fi

0 comments on commit 4ce7be6

Please sign in to comment.