Update powerwall.sh
This commit is contained in:
12
powerwall.sh
12
powerwall.sh
@@ -610,11 +610,15 @@ LOGROTATE(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(){
|
TEST(){
|
||||||
|
temptotal=0
|
||||||
while IFS=$'\t' read date sensorid temp hum ;do
|
while IFS=$'\t' read date sensorid temp hum ;do
|
||||||
echo date:$date sensorid:$sensorid temp:$temp hum:$hum
|
# echo date:$date sensorid:$sensorid temp:$temp hum:$hum
|
||||||
|
temptotal=`expr ${temptotal} + ${temp}`
|
||||||
done < <(${mysql_conn} -se "USE servermonitor; SELECT date,sensorid,temp,hum from sensor_data WHERE sensorid=2 ORDER BY id DESC LIMIT 1000;")
|
done < <(${mysql_conn} -se "USE servermonitor; SELECT date,sensorid,temp,hum from sensor_data WHERE sensorid=2 ORDER BY id DESC LIMIT 10000;")
|
||||||
|
|
||||||
|
average=$(bc <<< "scale=2; ${temptotal}/10000")
|
||||||
|
|
||||||
|
echo "Average: ${average}"
|
||||||
|
|
||||||
# QRY="INSERT INTO inv_jsonstats (\`date\`, \`data\`) VALUES ('${datetime}','${JSONSTATS}')"
|
# QRY="INSERT INTO inv_jsonstats (\`date\`, \`data\`) VALUES ('${datetime}','${JSONSTATS}')"
|
||||||
# ${mysql_conn} -e "USE servermonitor; ${QRY}"
|
# ${mysql_conn} -e "USE servermonitor; ${QRY}"
|
||||||
|
|||||||
Reference in New Issue
Block a user