Created
October 26, 2016 05:25
-
-
Save SkaTeMasTer/89bdb89a2ef20eb7dae5c9f87bed6082 to your computer and use it in GitHub Desktop.
GPS and pushover notifications and speedtest from: http://decryption.net.au/index.php/2013/10/05/raspberry-pi-portable-3g4g-network-quality-logger-project-part-2-3/
This file contains hidden or 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
#!/bin/bash | |
# time stamp this shit yo | |
nowdate=$(date "+%d-%m-%y") | |
nowtime=$(date "+%H:%M:%S") | |
# stole this idea of using gpspipe, grep and awk from here: http://thomasloughlin.com/gpspipe-gps-client/ | |
gpsdata=$(gpspipe -w -n 10 | grep -m 1 lon) | |
lat=$(echo "$gpsdata" | jsawk ‘return this.lat’) | |
lon=$(echo "$gpsdata" | jsawk ‘return this.lon’) | |
gpsspeed=$(echo "$gpsdata" | jsawk ‘return this.speed’) | |
# runs my modified the speedtest-cli python script and uses tr instead of grep to remove some line feeds and change it to a comma to suit the csv | |
speed=$(python /home/pi/speed.py –simple –server 3252 | tr ‘n’ ‘,’) | |
# writes the values to a csv file – the $speed value returns like 5.01,0.03, (note the trailing comma) which is why there’s no comma between $speed and $lat | |
echo "$nowdate,$nowtime,$speed$lat,$lon,$gpsspeed" >> /home/pi/vha_speedlog.csv | |
# sends info to the Pushover service, which then sends a push notification to my iPad with the results of the speedtest | |
curl -s | |
-F "token=sekrit" | |
-F "user=sekrit" | |
-F "message=down,up speedtest result : $speed" | |
https://api.pushover.net/1/messages.json | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment