Skip to content

Instantly share code, notes, and snippets.

@noerw
Created May 15, 2019 17:44
Show Gist options
  • Save noerw/3a3312b621911d9667dbc2f552558b52 to your computer and use it in GitHub Desktop.
Save noerw/3a3312b621911d9667dbc2f552558b52 to your computer and use it in GitHub Desktop.
opensensemap gnome shell extension via https://github.com/p-e-w/argos
#!/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