Skip to content

aduyng/tesla-client

Repository files navigation

tesla-client

A collection of Firebase Cloud functions to report the car status using Tesla Unofficial API

I set up this repo with my Raspberry Pi as a cronjob to report the status of the vehicle very 30 minutes.

Installation

(Replace /home/pi/tesla-client to your installation folder)

  1. Clone this repository
    git clone https://github.com/aduyng/tesla-client.git /home/pi/tesla-client
  2. Install dependencies
    cd /home/pi/tesla-client
    [sudo] npm install forever --global
    npm install --production
  3. Follow the instruction here: https://firebase.google.com/docs/admin/setup to set up your firebase project and obtain the parameters for initializeApp(). Download the service account JSON file and save it to /home/pi/tesla-client/private/firebase-service-account-key.json
  4. Enter environment variables in /home/pi/tesla-client/.env
    TESLA_CLIENT_ID=<the tesla client id as instructed here https://tesla-api.timdorr.com/api-basics/authentication>
    TESLA_CLIENT_SECRET=<the tesla client secret>
    TESLA_ACCOUNT_USERNAME=<owner email address>
    TESLA_ACCOUNT_PASSWORD=<owner password>
    FIREBASE_API_KEY=<firebase apiKey>
    FIREBASE_AUTH_DOMAIN=<firebase authDomain>
    FIREBASE_DATABASE_URL=<firebase databaseURL>
    FIREBASE_PROJECT_ID=<firebase projectId>
    FIREBASE_STORAGE_BUCKET=<firebase storageBucket>
    FIREBASE_MESSAGING_SENDER_ID=<firebase messagingSenderId>
    FIREBASE_APP_ID=<firebase appId>
    GOOGLE_APPLICATION_CREDENTIALS=/home/pi/tesla-client/private/firebase-service-account-key.json
    CRON_SCHEDULE="*/5 * * * *"
  5. Start with forever
forever start /home/pi/tesla-client/forever.json

Development

Run npm run dev to start the development

About

A NodeJS application to report my Tesla status

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published