Tesla Custom Integration & Fleet API

I am also using HA in docker and using nginx proxy manager as a reverse proxy in its own container. I tried to use the tesa-http-proxy-docker but the description ist just to difficult for me. Did you install another nginx to serve the certs? Maybe you still got your config files and can share? Thanks in advance!

I posted my setup detail in an issue on the github page for tesla-http-proxy-docker, here is the direct link to my post.

Take a look there, and read through the other comments as well. If you still have questions you can post them here.

1 Like

Thank you very much. I will look into it!

This isnā€™t a step-by-step guide. Itā€™s mostly for myself to fill in the confusion I had when doing this so in the future if I had to help a friend or do it myself, again, I would save a lot of time.

This requires a few things

  1. A web server using HTTPS and a valid certificate to serve up a public key file. The path to the file is not configurable under the FQDN. Teslaā€™s cloud at AWS (in my case it was us-west-2) will need to access this file. From my understanding it has to be always online, not just for initial authentication. An example URL : https://tesla.mydom.com/.well-known/appspecific/com.tesla.3p.public-key.pem . As a side note, this could probably be blog.mydom.com as long as the file/path is correct.
  2. A Phone with the Tesla App to assist when running through the auth process
  3. HASS Tesla custom integration installed and unconfigured.
  4. Tesla HTTP Proxy software - I used the addon but a lot of the information here applies to the docker version
  5. You probably also have to be the primary account for the car on tesla.com. I didnā€™t test on a secondary account.

How the communication works? (I believe this is correct)

  1. After the public key is hosted, you can setup your developer account at https://developer.tesla.com/. Tesla will access your hosted key during the account setup.
  2. Then using Tesla HTTP Proxy, it will setup an auth flow and reach out to Teslaā€™s cloud.
  3. Finally, the Tesla custom integration talks to the proxy, and the proxy talks to the AWS servers.

Process I Followed (well, not actually. This is what I would do if I ever did this again) :slight_smile:

  1. Install Tesla HTTP Proxy using the HASS addon.
    1. This generates a public/private key under /share/tesla. You now have a key for Tesla cloud to consume.
  2. Install/Configure the ā€œApache2 Minimalā€ addon to serve up the public key under the required path: /.well-known/appspecific/com.tesla.3p.public-key.pem
  3. Configure HAproxy on my edge to forward tesla.mydom.com to Apache2 Minimal.
  4. Using the HASS app on my phone, goto Tesla HTTP Proxy and open the link ā€œOpen Web UIā€
    1. Run through the auth flow. Save the refresh token in your clipboard. This flow should also create a key in the Tesla app on your phone.
  5. In HASS, Open ā€œDevices & servicesā€, select add integration. Everything was filled in here for me already because I used the addon except for the refresh token which you paste in. (you saved it in a previous step)
  6. Done.

Issues I had and solutions:

  1. I read docs, github issues, etc. I didnā€™t have a good high level understanding of how this was supposed to work. Hopefully the introduction covers this.
  2. Running through the auth flow and on the phone app you get ā€œunable to share vehicleā€. I fixed this by going into Tesla HTTP Proxy configuration and enabling ā€œRegenerate Tesla authenticationā€.
  3. The HASS app on my phone got locked into the Tesla HTTP Proxy Addon auth-flow screen and I couldnā€™t exit even if I killed the app. To get the app working again, I stopped the addon from my desktop computer and then restarted the app.
2 Likes

Hello im using nginx proxy manager my self a create a subdomain on cloudflare of may domains tesla.mydoamain.com and used tesla-http-proxy-docker pointed the nginx proxy manager to my local ip 192.168.1.5 port 4430 (tesla-http-proxy-docker port) still not able to make it work im getting 502 on tesla-http-proxy-docker logs any idea?

Why use Apache2 Minimal and not nginx reverse proxy ?

HA 2024.08 has a new Tesla Fleet integration.
Might be easier to setup: Tesla Fleet - Home Assistant

1 Like

Iā€™ve just set it up - it was trivial. Itā€™s only limitation is that it can only poll 200 times/day. And for the moment it doesnā€™t support commands to the car yet:

2 Likes

It works for me only to point where I need link with callback. When Iā€™m trying to generate token it says invalid code no matter what I paste there. Any suggestions?
I have public key on my website in folder as per spec and it works. Itā€™s just callback link Iā€™m having issue with. Any suggestions?

Thanks for your hard work. It would be perfect if it was possible to control the charging amps and the limit charge percentage. I used to use that on automations to keep the flow of electricity balanced with family usage with tesla custom integration. I am already following your integration in hopes that this is implemented there and that I can fully migrate from tesla custom integration to yours. Is there any way this can come to your integration?

2 Likes

Here are the steps I used to set up my HA with Fleet API using DuckDNS, Nginx Proxy and Tesla HTTP Proxy. It took a few days of tinkering to figure it out so I figured it might be worth sharing my steps. I also included a diagram of all of the things that have to be set up, to hopefully make the system easier to understand.

I wrote up the steps on Google Docs for easier editing & commenting: Setting up home assistant with tesla - Google Docs

1 Like

Still stuck at ā€œunable to share vehicleā€ when I try to finish setup using Tesla http proxy

Iā€™ve made sure I have the third party app in my Tesla account in the security settings.

Any idea ?