Browse Source

#707 added ups info to screen

v1.3
Christian Rotzoll 5 years ago
parent
commit
86839947ac
  1. 12
      home.admin/00infoBlitz.sh
  2. 7
      home.admin/config.scripts/blitz.ups.sh

12
home.admin/00infoBlitz.sh

@ -15,6 +15,16 @@ color_purple='\033[0;35m'
source /home/admin/raspiblitz.info 2>/dev/null
source /mnt/hdd/raspiblitz.conf 2>/dev/null
# get UPS info
source <(/home/admin/config.scripts/blitz.ups.sh status)
upsInfo=""
if [ "${upsStatus}" = "ONLINE" ]; then
upsInfo="${color_gray}${upsBattery}"
fi
if [ "${upsStatus}" = "ONBATT" ]; then
upsInfo="${color_red}${upsBattery}"
fi
# check hostname
if [ ${#hostname} -eq 0 ]; then hostname="raspiblitz"; fi
@ -287,7 +297,7 @@ printf "
${color_yellow}
${color_yellow}
${color_yellow}
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias}
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias} ${upsInfo}
${color_yellow} ${color_gray}${network} Fullnode + Lightning Network ${torInfo}
${color_yellow} ,/ ${color_yellow}%s
${color_yellow} ,'/ ${color_gray}%s, temp %s°C %s°F

7
home.admin/config.scripts/blitz.ups.sh

@ -79,12 +79,11 @@ if [ "$1" = "status" ]; then
if [ ${#status} -eq 0 ]; then
echo "upsStatus='n/a'"
else
echo "upsStatus='${status}'"
# get battery level if possible
if [ "${status}" = "ONLINE" ] || [ "${status}" = "ONBATT" ]; then
status=$(apcaccess -p BCHARGE | xargs | cut -d "." -f1)
echo "upsStatus='${status}%'"
else
echo "upsStatus='${status}'"
battery=$(apcaccess -p BCHARGE | xargs | cut -d "." -f1)
echo "upsBattery='${battery}%'"
fi
fi
exit 0

Loading…
Cancel
Save