Add CGM value to Waybar
This commit is contained in:
18
scripts/.local/share/scripts/cgm-value
Executable file
18
scripts/.local/share/scripts/cgm-value
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
fetch_value() {
|
||||
CGM_VALUE=$(curl -s -H "api-secret: $(pass api/nightscout)" -H "accept: application/json" \
|
||||
"https://nightscout.coolneng.duckdns.org/api/v1/entries?count=1" |
|
||||
grep -o '"sgv":[0-9]*' | cut -d ":" -f 2)
|
||||
echo "$CGM_VALUE"
|
||||
}
|
||||
|
||||
check_connectivity() {
|
||||
if nc -zw1 freebsd.org 443; then
|
||||
fetch_value
|
||||
else
|
||||
echo "NA"
|
||||
fi
|
||||
}
|
||||
|
||||
check_connectivity
|
||||
Reference in New Issue
Block a user