From 7ef972b22881137a1792238dcd5cb39848022608 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 3 Sep 2022 13:01:44 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 8079294a..bdceca12 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -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