Update powerwall.sh
This commit is contained in:
21
powerwall.sh
21
powerwall.sh
@@ -114,6 +114,7 @@ CHECKTEMP_SERVICE(){
|
||||
|
||||
CHECKACV_SERVICE(){
|
||||
voltstatus=0
|
||||
battstatus=0
|
||||
while true
|
||||
do
|
||||
INPUTACV=$(curl -s "http://10.10.0.61/stats.json" | jq '.inputs .inV')
|
||||
@@ -123,6 +124,7 @@ CHECKACV_SERVICE(){
|
||||
[ $VERBOSE = true ] && echo "($datetime) back to normal voltage: ${INPUTACV}V"
|
||||
echo -e "($datetime) Normal voltage detected\nVOLTAGE: ${INPUTACV}V" | mail -s "POWER NOMINAL AGAIN" $email_alert
|
||||
[ $VERBOSE = true ] && echo "($datetime) alert sent"
|
||||
battstatus=0
|
||||
else
|
||||
[ $VERBOSE = true ] && echo "($datetime) normal voltage: ${INPUTACV}V"
|
||||
if [ $voltstatus -eq 0 ]; then
|
||||
@@ -142,15 +144,26 @@ CHECKACV_SERVICE(){
|
||||
BATTVOLT=$(curl -s "http://10.10.0.61/stats.json" | jq '.inputs .battV')
|
||||
if [ ${BATTVOLT%.*} -lt ${min_battvolt} ] && [ ${BATTVOLT%.*} -gt ${min_battvolt_sys} ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) LOW BATTERY voltage: ${BATTVOLT}V"
|
||||
[ $VERBOSE = true ] && echo "($datetime) Shutting down main servers..."
|
||||
if [ $battstatus -lt 2 ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) Shutting down main servers..."
|
||||
echo -e "($datetime) Battery Voltage LOW: ${BATTVOLT}V\nShutting down main servers" | mail -s "BATT-VOLT LOW: SHUTDOWN SERVERS" $email_alert
|
||||
|
||||
battstatus=2
|
||||
fi
|
||||
|
||||
elif [ ${BATTVOLT%.*} -le ${min_battvolt_sys} ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) SYSTEM LOW BATTERY voltage: ${BATTVOLT}V"
|
||||
[ $VERBOSE = true ] && echo "($datetime) Shutting down all remaining servers..."
|
||||
|
||||
if [ $battstatus -lt 3 ]; then
|
||||
[ $VERBOSE = true ] && echo "($datetime) Shutting down all remaining servers..."
|
||||
echo -e "($datetime) Battery Voltage REALLY LOW: ${BATTVOLT}V\nShutting down all servers" | mail -s "BATT-VOLT REALLY LOW: SHUTDOWN SERVERS" $email_alert
|
||||
|
||||
battstatus=3
|
||||
fi
|
||||
|
||||
else
|
||||
[ $VERBOSE = true ] && echo "($datetime) Battery Voltage Nominal: ${BATTVOLT}V"
|
||||
[ $VERBOSE = true ] && echo "($datetime) Battery Voltage: ${BATTVOLT}V"
|
||||
|
||||
battstatus=1
|
||||
|
||||
fi
|
||||
volt_diff=$((${last_battvolt%.*} - ${BATTVOLT%.*}))
|
||||
|
||||
Reference in New Issue
Block a user