Skip to content

Instantly share code, notes, and snippets.

@ckdake
Created May 1, 2020 16:57
Show Gist options
  • Save ckdake/0153d4280ecf41f705b673a20cf30a5e to your computer and use it in GitHub Desktop.
Save ckdake/0153d4280ecf41f705b673a20cf30a5e to your computer and use it in GitHub Desktop.
Export from Automatic

Automatic.com is shutting down their connected car tracking device and service, and there isn't a one-button data export!

You'll need a few things to get your trip data out:

https://developer.automatic.com/

  1. Sign up for an app, name it whatever you like.
  2. Generate a test token and save this, generate the "OAuth Authorize URL", and go there to get an OAuth authorization code
  3. Create the "Example CURL for OAuth Access Token", paste in your OAuth auth code, and run it. save your 'access token'

install the 'automatic-client' and 'json' gem.

put your access token in launcher.sh below

read exporter.rb and make sure you like it

./launcher.sh

Wait a bit, see some http request debug information scroll by, and once it finishes...

enjoy JSON representations of all of your trips for future use.

If you want the path data, you'll want to use https://github.com/joshuaclayton/polylines to decode it

require 'automatic/client'
require 'json'
trips = Automatic::Models::Trips.all
trips.each do |trip|
File.open("trips/#{trip.id}.json","w") do |f|
f.write(trip.to_json)
end
end
export API_HOST='https://api.automatic.com'
export AUTOMATIC_ACCESS_TOKEN='yourtoken123'
mkdir trips
ruby exporter.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment