Copyright (c) 2017, Ward Mundy & Associates LLC with MIT License
-
Install all files in a secure directory on your LAMP server: git clone https://github.com/wardmundy/php-api-tesla.git
-
Run scripts from command line only! Switch to php-api-tesla directory before proceeding and chmod +x *.php.
-
Edit config.php: set install directory, Tesla credentials and desired valet & web PINs and temp settings for car.
-
Before doing anything else, run these two scripts in the following order: ./token.php AND ./vehicle.php
All of the rest of the scripts will then work properly for 90 DAYS, e.g. ./vehicle_state.php
NOTE: TOKENS last for 90 days! After 90 days, you must rerun token.php and vehicle.php. You'll be reminded.
FUTURE-PROOFING: A web app is coming soon. Please be sure your web server has access to the install directory.
RESOLVING FAILURES: If you get a failure noting "could_not_wake_buses", simply rerun the script a second time.
Special thanks to Hank Lloyd Right of the Tesla Motors Forum for numerous PHP suggestions.