polybar: nightscout

This commit is contained in:
Michael Grote 2021-07-02 12:20:02 +02:00
parent 437b8cbb52
commit c993763dc0

View file

@ -1,14 +1,13 @@
#!/bin/bash #!/bin/bash
api_url=$(curl -s -X GET "https://nightscout.mgrote.net/api/v1/entries/sgv?count=1&token=polybar-ae6fe2720f2c30f4") api_url=$(curl -s -X GET "https://nightscout.mgrote.net/api/v1/entries/sgv?count=1&token=polybar-ae6fe2720f2c30f4")
#echo $api_url #echo $api_url
symbol=$(echo $api_url | awk '{print $4}')
#echo $symbol
wert=$(echo $api_url | awk '{printf "%.1f\n",$3*0.0555}')
#echo $wert
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "---" echo "---"
else else
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 case $symbol in
'"Flat"') '"Flat"')
echo $wert "=" echo $wert "="
@ -16,7 +15,6 @@ else
'"FortyFiveDown"') '"FortyFiveDown"')
echo $wert "-" echo $wert "-"
;; ;;
*) *)
echo $symbol echo $symbol
;; ;;