Tesla Custom Integration & Fleet API

How do you solve this problem, using Nginx SSL prxoxy duck dns?

OK…
So the “Address in the Netherlands” workaround is only about being able to register a valid tesla developer account to have a Fleet API.

For my setup I found the response in iainbullock/tesla-http-proxy-docker (github.com)

I found this well written blog article on how to setup the Fleet API for Home Assistant running on Docker: https://www.smartmotion.life/2024/04/23/tesla-custom-integration-with-home-assistant-on-docker/?v=6cc98ba2045f

4 Likes

Just found that I need to use the fleet API.
I’m running HA on an old laptop (Generic x86-64) and using Nabu-Casa for logging in externally.
I’ve installed the Tesla HTTP proxy thing, but thats as far as I got.
Please tell me the next steps aren’t as complicated as it looks!

Hello everyone,

I followed the entire registration procedure on the developer.tesla.com website, but when I got to the end of the OAuth 2.0 process, only the “Client ID” appeared, and there is no “Client Secret” anywhere. So, I don’t know what to enter in the configuration of the “Tesla HTTP Proxy” component…

Has this happened to you? Did I do something wrong? What can I do???
ttt

I also have the same problem! Did you find a solution?

You don’t need to choose the open-source software option.
Tesla support wrote to me:

Hey David,

Open source applications documentation will be released and updated soon! For now, you can create an application that is standard application for now until instructions are updated.

Sorry for inconvenience,

Jason

Is there any easier method on the horizon? I was quite happy with the Tesla Integration so far that just required to generate a token with my phone app.

Now all this exposing HA to the internet, SSL certificates, (reverse) proxy setup … WHY?

:pensive:

1 Like

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 ?