mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-08 20:09:03 +02:00
#707 add UPS status info
This commit is contained in:
@@ -7,6 +7,7 @@ source /mnt/hdd/raspiblitz.conf
|
|||||||
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
|
||||||
echo "Configure a UPS (Uninterruptible Power Supply)"
|
echo "Configure a UPS (Uninterruptible Power Supply)"
|
||||||
echo "blitz.ups.sh on apcusb"
|
echo "blitz.ups.sh on apcusb"
|
||||||
|
echo "blitz.ups.sh status"
|
||||||
echo "blitz.ups.sh off"
|
echo "blitz.ups.sh off"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -58,6 +59,39 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
###################
|
||||||
|
# STATUS
|
||||||
|
###################
|
||||||
|
|
||||||
|
if [ "$1" = "status" ]; then
|
||||||
|
|
||||||
|
# check if already activated
|
||||||
|
if [ ${#ups} -eq 0 ]; then
|
||||||
|
echo "upsStatus='OFF'"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${ups}" = "apcusb" ]; then
|
||||||
|
status=$(apcaccess -p STATUS)
|
||||||
|
if [ ${#status} -eq 0 ]; then
|
||||||
|
echo "upsStatus='n/a'"
|
||||||
|
else
|
||||||
|
# get battery level if possible
|
||||||
|
if [ "${status}" = "ONLINE" ] || [ "${status}" = "ONLINE" ]; then
|
||||||
|
status=$(apcaccess -p BCHARGE | cut -d "." -f1)
|
||||||
|
echo "upsStatus='${status}%'"
|
||||||
|
else
|
||||||
|
echo "upsStatus='${status}'"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "upsStatus='CONFIG'"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# SWITCH OFF
|
# SWITCH OFF
|
||||||
###################
|
###################
|
||||||
|
Reference in New Issue
Block a user