Created
May 15, 2019 17:44
-
-
Save noerw/3a3312b621911d9667dbc2f552558b52 to your computer and use it in GitHub Desktop.
opensensemap gnome shell extension via https://github.com/p-e-w/argos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# export OSEM_BOX=yourboxid | |
BOX=${OSEM_BOX:-5b26181b1fef04001b69093c} | |
API="https://api.opensensemap.org" | |
boxMeta=`curl "${API}/boxes/${BOX}"` | |
sensors=`curl "${API}/boxes/${BOX}/sensors"` | |
updated=`echo $boxMeta | jq -r '.lastMeasurementAt'` | |
weblink=`echo $boxMeta | jq -r '.weblink'` | |
echo $boxMeta | jq -r '.name' | |
echo "---" | |
echo $sensors | jq -r '.sensors[] | .title + ":\t\t" + .lastMeasurement.value + " " + .unit' | |
echo "---" | |
echo "last measurement from `date -d $updated +'%d.%m. %H:%M'`" | |
echo "refresh | refresh=true" | |
echo "---" | |
echo "view on openSenseMap.org | href='https://opensensemap.org/explore/$BOX'" | |
[ ! $weblink == "null" ] && echo "open weblink | href='$weblink'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment