Update powerwall.sh
This commit is contained in:
@@ -41,6 +41,7 @@ CHECKTEMP_SERVICE(){
|
||||
do
|
||||
${mqtt_conn} -t tele/${1}/SENSOR | while read -r mqtt_message
|
||||
do
|
||||
echo $mqtt_message | cut -d':' -f 7 | cut -d',' -f 1 | read temp_h
|
||||
echo $mqtt_message | cut -d':' -f 6 | cut -d',' -f 1 | read temp_c
|
||||
echo $mqtt_message | cut -d'T' -f 2 | cut -d"\"" -f 3 | read temp_d
|
||||
echo $mqtt_message | cut -d'T' -f 3 | cut -d"\"" -f 1 | read temp_t
|
||||
@@ -55,8 +56,8 @@ CHECKTEMP_SERVICE(){
|
||||
#echo "WARNING TEMP: $temp_f°F" | mail -s "${1} TEMP WARNING" $email_alert
|
||||
echo "($temp_d @ $temp_t) WARNING: $temp_f°F"
|
||||
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\`) VALUES ('${SENSOR_ID[$1]}','${temp_d} ${temp_t}','${temp_f}'"
|
||||
mysql_conn -e "${QRY}"
|
||||
QRY="USE servermonitor; INSERT INTO sensor_data (\`sensorid\`, \`date\`, \`temp\` \`hum\`) VALUES ('${SENSOR_ID[$1]}','${temp_d} ${temp_t}','${temp_f}','${temp_h}')"
|
||||
${mysql_conn} -e "${QRY}"
|
||||
|
||||
elif [ $(bc -l <<< "$temp_f >= $temp_crit") -eq 1 ]; then
|
||||
#echo "CRITICAL TEMP: $temp_f°F" | mail -s "${1} TEMP CRITICAL" $email_alert
|
||||
|
||||
Reference in New Issue
Block a user