Added an endpoint for UPS stats.

This commit is contained in:
fabian committed 2020-10-31 11:57:54 +01:00
1 parent 864d4385c3
commit 3de70efa44
3 files changed
+18 -1

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
echo -n '{"connected":true'
apcaccess | while read key _ value unit _; do
#echo $key - $value - $unit
case "$key" in
"STATUS") echo -n ", \"status\":\"$value\"" ;;
"LOADPCT") echo -n ", \"loadpct\":$value" ;;
"BCHARGE") echo -n ", \"bcharge\":$value" ;;
"TIMELEFT") echo -n ", \"timeleft\":$value" ;;
"BATTV") echo -n ", \"battv\":$value" ;;
"LINEV") echo -n ", \"linev\":$value" ;;
esac
done
echo "}"