-
Download this repo (either via a
git clone
or via the zip download) -
Salesforce
- Create a Developer Edition
- Deploy the metadata to Salesforce by running the following in this project's root dir: Mac & Linux: SALESFORCE_USERNAME=[email protected] SALESFORCE_PASSWORD=yourPasswordAndAccessToken ./activator force:deploy Windows: SALESFORCE_USERNAME=[email protected] SALESFORCE_PASSWORD=yourPasswordAndAccessToken activator force:deploy
- On Salesforce in the
Rental Bike
tab, create a new example Rental Bike and keep track of it's ID for later use - Create a new Connected App
1. Check
Enable OAuth Settings
1. Set theCallback URL
tohttp://localhost:9000/
1. InAvailable OAuth Scopes
selectFull access (full)
and clickAdd
1. Save the new Connected App and keep track of the Consumer Key & Consumer Secret for later use
-
Raspberry Pi
- Obtain a Raspberry Pi (1 or 2)
- Obtain the Adafruit Ultimate GPS Breakout Sensor (requires soldering) or Flora Wearable Ultimate GPS (can be used with alligator clips)
- Follow the setup instructions to get the GPS working with the Raspberry Pi
- Setup the tracker app on the Raspberry Pi
- Copy the
raspberrypi/tracker.py
file to the device - In the file update the rental bike id's value with the one your created
- Copy the
- From your project's root directory, create a new
conf/local.conf
file containing: salesforce.consumer.key="YOUR CONSUMER KEY" salesforce.consumer.secret="YOUR CONSUMER SECRET" salesforce.username="YOUR USERNAME" salesforce.password="YOUR PASSWORD AND ACCESS TOKEN" - Start the local server: Mac & Linux: ./activator ~run Windows: activator ~run
- Optionally send a test location using CURL: curl -d "bike_rental_id=YOUR_RENTAL_BIKE_ID&lat=38.869903333&lon=-106.98946" http://localhost:9000/
- Setup the tracker app on the Raspberry Pi
- Make sure the device is connected to the same network as your machine
- Update the web connection info in the
tracker.py
on your device by changing theconn = ...
line to the following (replacing the IP with you machine's local IP): httplib.HTTPConnection("192.168.0.5", 9000) - Run the tracker script: python tracker.py