dotfiles/polybar/scripte/nightscout_cgm.sh

38 lines
750 B
Bash
Raw Normal View History

2021-06-08 14:39:33 +02:00
#!/bin/bash
2021-08-18 08:37:53 +02:00
api_url=$(curl -s -X GET "https://nightscout.mgrote.net/api/v1/entries/sgv?count=1&token=polybar-dbd088fd5b49a4da")
2021-07-02 12:14:18 +02:00
#echo $api_url
2021-06-08 18:00:20 +02:00
if [ $? -ne 0 ]; then
echo "---"
else
2021-07-02 17:11:55 +02:00
symbol=$(echo $api_url | awk '{print $4}')
#echo $symbol
wert=$(echo $api_url | awk '{printf "%.1f\n",$3*0.0555}')
#echo $wert
case $symbol in
'"SingleDown"')
2021-07-02 17:29:22 +02:00
echo $wert "⇓"
2021-07-02 17:11:55 +02:00
;;
'"SingleUp"')
2021-07-02 17:29:22 +02:00
echo $wert "⇑"
2021-07-02 17:11:55 +02:00
;;
'"DoubleDown"')
2021-07-02 17:29:22 +02:00
echo $wert "⇓⇓"
2021-07-02 17:11:55 +02:00
;;
'"DoubleUp"')
2021-07-02 17:29:22 +02:00
echo $wert "⇑⇑"
2021-07-02 17:11:55 +02:00
;;
'"FortyFiveDown"')
2021-07-02 17:14:39 +02:00
echo $wert "⇘"
2021-07-02 17:11:55 +02:00
;;
'"FortyFiveUp"')
echo $wert "⇗"
;;
'"Flat"')
2021-07-02 17:29:22 +02:00
echo $wert "⇒"
2021-07-02 17:11:55 +02:00
;;
*)
echo $symbol
;;
esac
2021-06-08 18:00:20 +02:00
fi