Update powerwall.sh

This commit is contained in:
2022-10-01 08:08:28 -05:00
parent 2ce46a9e81
commit c8cc130c55

View File

@@ -202,14 +202,15 @@ POWERLOGGER_SERVICE(){
while true
do
datetime=`date +'%Y-%m-%d %H:%M:%S'`
outV=$(curl -s "http://10.10.0.61/stats.json" | jq '.outputs .outV')
outA=$(curl -s "http://10.10.0.61/stats.json" | jq '.outputs .outA')
inV=$(curl -s "http://10.10.0.61/stats.json" | jq '.inputs .inV')
inA=$(curl -s "http://10.10.0.61/stats.json" | jq '.inputs .inA')
battV=$(curl -s "http://10.10.0.61/stats.json" | jq '.inputs .battV')
battA=$(curl -s "http://10.10.0.61/stats.json" | jq '.inputs .xfA')
JSONSTATS=$(curl -s "http://10.10.0.61/stats.json")
inV=`echo ${JSONSTATS} | jq '.inputs .inV'`
inA=`echo ${JSONSTATS} | jq '.inputs .inA'`
outV=`echo ${JSONSTATS} | jq '.outputs .outV'`
outA=`echo ${JSONSTATS} | jq '.outputs .outA'`
battV=`echo ${JSONSTATS} | jq '.inputs .battV'`
xfA=`echo ${JSONSTATS} | jq '.inputs .xfA'`
QRY="USE servermonitor; INSERT INTO power_data (\`sensorid\`, \`date\`, \`volt\`, \`amp\`) VALUES ('2','${datetime}','${inV}','${inA}')"
QRY="${QRY}; INSERT INTO power_data (\`sensorid\`, \`date\`, \`volt\`, \`amp\`) VALUES ('3','${datetime}','${outV}','${outA}')"
QRY="${QRY}; INSERT INTO power_data (\`sensorid\`, \`date\`, \`volt\`, \`amp\`) VALUES ('4','${datetime}','${battV}','${battA}')"