iainbullock / tesla-http-proxy-docker

Apache License 2.0
27 stars 8 forks source link

Tesla HTTP Proxy Docker

Tested and working as expected with Home Assistant custom integration https://github.com/alandtse/tesla

Originally this was a fork of https://github.com/llamafilm/tesla-http-proxy-addon. All credit to llamafilm (https://github.com/llamafilm) for developing most of this.

This version provides a standalone docker version instead of a Home Assistant Add-on. This means it can work with versions of Home Assistant which don't allow Add-Ons (e.g. docker version).

This docker runs the official Tesla HTTP Proxy to allow Fleet API requests on modern vehicles. Please do not bother Tesla for support on this.

Buy Me A Coffee

About

Runs a temporary Flask web server to handle initial Tesla authorization flow and store the refresh token. Once that is complete, it quits Flask and runs Tesla's HTTP Proxy code in Go.

Setting this up is fairly complex. Please read DOCS.md for details (TODO), or follow the high level summary below:

Installation and set up

Many thanks to @tux43 for creating this blog, which describes his set up in detail: https://www.smartmotion.life/2024/04/23/tesla-custom-integration-with-home-assistant-on-docker

Also many thanks to @juchong for writing a Cloudflare configuration / setup guide: CLOUDFLARE.md

[16:14:02] main:INFO: Generating Partner Authentication Token [16:14:03] main:INFO: {"access_token":"LongString","expires_in":28800,"token_type":"Bearer"} [16:14:03] main:INFO: Registering Tesla account [16:14:05] main:INFO: {"response":{"account_id":"XXXX-XXX-XXXX-XXX","domain":"tesla.example.com","name":"TeslaH","description":"Home automation for my Tesla. Application is for personal use only","csr":null,"client_id":"XX-XXXX-XX-XXXXXXXXXX","ca":null,"created_at":"2024-02-28T13:50:49.494Z","updated_at":"2024-04-07T16:14:05.827Z","enterprise_tier":"free","issuer":null,"csr_updated_at":null,"public_key":"FairlyLongString"}} [16:14:05] werkzeug:INFO: 192.168.1.5 - - [07/Apr/2024 16:14:05] "GET /register-partner-account HTTP/1.0" 302 - [16:14:05] werkzeug:INFO: 192.168.1.5 - - [07/Apr/2024 16:14:05] "GET /?success=1 HTTP/1.0" 200 -