I had just started really playing around with the Onion Omega2+ and ran into Brad Buskey's GPS Info to Oled article around the same time I got the "Two Bullet Tuesday" email from Onion with instructions on setting up the Omega with Losant. Well, I can't resist a mashup when I see one, so I had to put the two together.
This is just a quick and dirty example to show that the GPS info can be sent up to Losant to display on a map dashboard. I'm sure there are better ways to do a lot of it (in particular, the "awk and kill" seems like an awful way to get things done).
Step 1It would be easier to just implement Brad's "GPS Info to OLED" first, then get the Losant setup going. Grab the "getgps.sh" and "showgps.py" files. Edit the "getgps.sh" file and put your device ID in the placeholder. Once you're connected to Losant, you can create (on your Losant "Device") a "gps" attribute to send data to (Data Type: GPS String, Name: gps).
Then in the upper left go to the "Dashboards" menu and choose "+ Create Dashboard" and give it a name (I just called mine "map") and click the green "Create" button at the bottom. Now you can choose a "block" to add (I chose the "GPS History" block (the heatmap looks interesting as well):
The block should configure itself for the most part but you may want to look at the "Duration" (do you only want to see the last known location or see a whole "trip" on the map?) or tweak other settings. There is a live preview in the upper right so you can get an idea what your map will look like.
TroubleshootingIf you aren't getting any data in your map, the best place to start is the "Communication Log".
If the data is getting to Losant, but it isn't valid JSON or from there it isn't valid NMEA data then it won't work. The log should shed some light on the problem. Most of the time the first MQTT message at boot is missing the NMEA info and will be marked bad. The messages following afterward should be ok.
A valid JSON string for this setup would look like this:
{"data":{"gps":"$GPGLL,3906.71226,N,8430.74572,W,000653,A,*24"}}
To display the data sent to the OLED:
cat /root/gpsinfo.txt
To display the most recent GPS output from the "awk" line:
cat /root/gpsnema.txt
To display the JSON data generated by the script:
cat /root/gpsmqtt.txt
Losant's definition of the GPS data it expects to receive in this case is this one:
NMEA GLL Example:
$GPGLL,3906.71226,N,8430.74572,W,000653,A,*24
Comments