core icon indicating copy to clipboard operation
core copied to clipboard

TESLA integration broken after update to core-2025.1.2

Open boxer747 opened this issue 11 months ago • 30 comments

The problem

Settings show the following message: "Home Assistant Core Integration Authentication expired for bxxxxxxxxxxxxxxxxx8"

When clicked, TESLA (https://auth.tesla.com/) responds with this message: "Error has occurred We don't recognize this redirect_uri. Please use the redirect_uri found in your app details. Reference ID: abcdefgkdjfhlasdkjfasdkl;fjasdfkljasd;f copy https://developer.tesla.com/docs/fleet-api#help-and-support"

What version of Home Assistant Core has the issue?

2025.1.2

What was the last working version of Home Assistant Core?

2025.1.1

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Tesla Fleet

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

boxer747 avatar Jan 10 '25 19:01 boxer747

Hey there @bre77, mind taking a look at this issue as it has been labeled with an integration (tesla_fleet) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tesla_fleet can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign tesla_fleet Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tesla_fleet documentation tesla_fleet source (message by IssueLinks)

home-assistant[bot] avatar Jan 10 '25 22:01 home-assistant[bot]

Is your redirect URl set to https://my.home-assistant.io/redirect/oauth on the Tesla Developer portal?

Bre77 avatar Jan 10 '25 23:01 Bre77

Per the page for https://my.home-assistant.io/redirect/oauth at https://www.home-assistant.io/integrations/my/ is this my: in your configuration.yaml anywhere? Adding that fixed my errors with the Tesla website trying to redirect to my local Home Assistant URL.

tmason818 avatar Jan 11 '25 04:01 tmason818

@tmason818 Where did you enter the URL? Under this: http: cors_allowed_origins:

Xioon83 avatar Jan 12 '25 16:01 Xioon83

Under Allowed Origin URL(s), enter your domain where you hosted your public key earlier. Using the example above, this would be https://my.domain.com/.

What does that even mean?

florian-asche avatar Jan 13 '25 18:01 florian-asche

Getting the same error too. I was on 2024.12 oh Home Assistant, just updated to 2025.1.2 and this integration broke. Error message was something along the lines of the token has expired. I've delete the integration to set it up again, and now getting the error, a condition has not been met to process this request. Have also recreated the application in developer.tesla.com.

Edit: I have just downgrade back to 2024.12.4 and have been able to re link successfully. The app i created following the documentation still doesn't work. But when you click on add, you get the option to setup with "open source client ID" and it takes your through a process of linking it to your account. I did not get / see this in 2025.1.2

Slee2112 avatar Jan 15 '25 14:01 Slee2112

I had full functionality before updating HA, and now, after reconfiguring everything (it has been a headache) I see that the effort has been for nothing. I'll stay here in case there is any news.

MrLopHA avatar Jan 17 '25 16:01 MrLopHA

Under Allowed Origin URL(s), enter your domain where you hosted your public key earlier. Using the example above, this would be https://my.domain.com/.

What does that even mean?

Tesla changed their business model for their Fleet API and in order to use it on its own or with things like Home Assistant you'll need to host a public key for them to access on the public internet. It will need to be hosted on a website at a domain you are the registrant for that is accessible at https:// or more specifically https://[your.domain.com]/.well-known/appspecific/com.tesla.3p.public-key.pem.

I had full functionality before updating HA, and now, after reconfiguring everything (it has been a headache) I see that the effort has been for nothing. I'll stay here in case there is any news.

As mentioned- Tesla changed their business model regarding the Fleet API so even if you did not upgrade HA Tesla is going stop providing data to the Tesla Fleet integration on February 1st regardless.

This other thread is sort of a "master" thread that should help you stay up to date and/or assist with setting up the methodology that Tesla now requires.

tmason818 avatar Jan 17 '25 17:01 tmason818

Under Allowed Origin URL(s), enter your domain where you hosted your public key earlier. Using the example above, this would be https://my.domain.com/.

What does that even mean?

Tesla changed their business model for their Fleet API and in order to use it on its own or with things like Home Assistant you'll need to host a public key for them to access on the public internet. It will need to be hosted on a website at a domain you are the registrant for that is accessible at https:// or more specifically https://[your.domain.com]/.well-known/appspecific/com.tesla.3p.public-key.pem.

I had full functionality before updating HA, and now, after reconfiguring everything (it has been a headache) I see that the effort has been for nothing. I'll stay here in case there is any news.

As mentioned- Tesla changed their business model regarding the Fleet API so even if you did not upgrade HA Tesla is going stop providing data to the Tesla Fleet integration on February 1st regardless.

This other thread is sort of a "master" thread that should help you stay up to date and/or assist with setting up the methodology that Tesla now requires.

i dont understand the key part. I host a key, ok. But how and where is it used? Does tesla only check if there is a key and thats it?

florian-asche avatar Jan 17 '25 17:01 florian-asche

i dont understand the key part. I host a key, ok. But how and where is it used? Does tesla only check if there is a key and thats it?

It doesn't matter if you generate the public key and host it on a tesla-recognised host (I used Cloudfare by git-ing a GitHub repository) and, in general, perform all the necessary steps. I have done this and the integration does not work.

MrLopHA avatar Jan 17 '25 17:01 MrLopHA

Under Allowed Origin URL(s), enter your domain where you hosted your public key earlier. Using the example above, this would be https://my.domain.com/.

What does that even mean?

Tesla changed their business model for their Fleet API and in order to use it on its own or with things like Home Assistant you'll need to host a public key for them to access on the public internet. It will need to be hosted on a website at a domain you are the registrant for that is accessible at https:// or more specifically https://[your.domain.com]/.well-known/appspecific/com.tesla.3p.public-key.pem.

I had full functionality before updating HA, and now, after reconfiguring everything (it has been a headache) I see that the effort has been for nothing. I'll stay here in case there is any news.

As mentioned- Tesla changed their business model regarding the Fleet API so even if you did not upgrade HA Tesla is going stop providing data to the Tesla Fleet integration on February 1st regardless. This other thread is sort of a "master" thread that should help you stay up to date and/or assist with setting up the methodology that Tesla now requires.

i dont understand the key part. I host a key, ok. But how and where is it used? Does tesla only check if there is a key and thats it?

ahhh i see, there is a new documentation. The integration expects your private key to be located at config/tesla_fleet.key.

@Bre77 the documentation about putting the private key into the homeassistant directory... it is better if we move it after or in the "Hosting a Public/Private Key Pair" part.

florian-asche avatar Jan 17 '25 17:01 florian-asche

i dont understand the key part. I host a key, ok. But how and where is it used? Does tesla only check if there is a key and thats it?

It doesn't matter if you generate the public key and host it on a tesla-recognised host (I used Cloudfare by git-ing a GitHub repository) and, in general, perform all the necessary steps. I have done this and the integration does not work.

mine is working now. What you need to do:

  1. Host public key on a domain with working https.
  2. copy your private key to the config folder
  3. setup the developer account, add your domain to the key and the oauth domain.
  4. Register your application as a fleet api partner (run curl commands)
  5. configure (link) your homeassistant tesla integration
  6. optional: if your tesla is late 2023 or older you need to command signing in the tesla app. i didnt do that.

based on this information the documentation needs restructuring!

florian-asche avatar Jan 17 '25 21:01 florian-asche

mine is working now. What you need to do:

  1. Host public key on a domain with working https.
  2. copy your private key to the config folder
  3. setup the developer account, add your domain to the key and the oauth domain.
  4. Register your application as a fleet api partner (run curl commands)
  5. configure (link) your homeassistant tesla integration
  6. optional: if your tesla is late 2023 or older you need to command signing in the tesla app. i didnt do that.

based on this information the documentation needs restructuring!

What do you mean by:

2- copy your private key to the config folder?

I haven’t seen that step in the documentation, which config folder are you referring to?I have done the rest of the steps correctly, maybe if I also do number 2 it will work, but I need a little more detail

MrLopHA avatar Jan 17 '25 22:01 MrLopHA

So could we host the public key in HA itself if it's accessible remotely (via DDNS, Nabu Casa, etc.)?

Cikkajes avatar Jan 19 '25 13:01 Cikkajes

So could we host the public key in HA itself if it's accessible remotely (via DDNS, Nabu Casa, etc.)?

yes, but then you have to tell tesla your dns for your smarthome and make something accessible there. i rather use a small webhost or virtual server for that.

florian-asche avatar Jan 19 '25 14:01 florian-asche

mine is working now. What you need to do:

  1. Host public key on a domain with working https.
  2. copy your private key to the config folder
  3. setup the developer account, add your domain to the key and the oauth domain.
  4. Register your application as a fleet api partner (run curl commands)
  5. configure (link) your homeassistant tesla integration
  6. optional: if your tesla is late 2023 or older you need to command signing in the tesla app. i didnt do that.

based on this information the documentation needs restructuring!

What do you mean by:

2- copy your private key to the config folder?

I haven’t seen that step in the documentation, which config folder are you referring to?I have done the rest of the steps correctly, maybe if I also do number 2 it will work, but I need a little more detail

i was wondering the same some time. not sure if the documentation changed while we had the problem. but its in there if u scroll some more.

florian-asche avatar Jan 19 '25 14:01 florian-asche

I am using nabu casa and my home assistant is located at: https://XXXX.ui.nabu.casa/ How can I host a the public key file using nabu casa ? As far as I know, I don't have access to public root of the sub domain. Can someone help ? @Bre77

yalmog99 avatar Jan 21 '25 13:01 yalmog99

I am using nabu casa and my home assistant is located at: https://XXXX.ui.nabu.casa/ How can I host a the public key file using nabu casa ? As far as I know, I don't have access to public root of the sub domain. Can someone help ? @Bre77

You can't.

Bre77 avatar Jan 21 '25 20:01 Bre77

e Tesla Developer portal?

May be this is an issue

Siminhu74 avatar Jan 23 '25 13:01 Siminhu74

I am using nabu casa and my home assistant is located at: https://XXXX.ui.nabu.casa/ How can I host a the public key file using nabu casa ? As far as I know, I don't have access to public root of the sub domain. Can someone help ? @Bre77

You can't.

What is possible with NabuCasa then? It worked for me without A [Developer Application] has been added as 3rd party one..

Siminhu74 avatar Jan 23 '25 14:01 Siminhu74

Hi,

Still don't know what is a preferred solution.. Is don't remember that I setup Developer API but used it with 3rd party asaps line Testify or Tessie get the data.

Registered one on https://developer.tesla.com/ if it works..

Used https://____.ui.nabu.casa for approved sources

Used https://____.ui.nabu.casa/redirect/oauth for routing one

Doesn't work..

Error has occurred We don't recognize this redirect_uri. Please use the redirect_uri found in your app details. Reference ID: dd1fbcbccd9d4ea997144fae4598d5cc-1737644242529 copy https://developer.tesla.com/docs/fleet-api#help-and-support

Any tips?

BR,

Zoltan

Siminhu74 avatar Jan 23 '25 14:01 Siminhu74

Used https://____.ui.nabu.casa/redirect/oauth for routing one

@Siminhu74 According to the configuration setup documentation the "Allowed Redirect URI(s)" field needs to literally be filled in with https://my.home-assistant.io/redirect/oauth i.e. you would not swap out the my.home-assistant.io for your nabu.casa domain. I got tripped up by that detail because the instructions have to use variables like my.domain but my.homeassistant.io is not a variable in this case.

Make sure you have this default integration configured correctly so redirects will correctly go to Home Assistant- mine was not set up by default (or I messed it up over the years who knows). You can view my post in this other thread for more background info.

tmason818 avatar Jan 24 '25 22:01 tmason818

Used https://____.ui.nabu.casa/redirect/oauth for routing one

@Siminhu74 According to the configuration setup documentation the "allowed Origin URI(s)" needs to literally be https://my.home-assistant.io/redirect/oauth

You mean the redirect URL, the origin has to be something else you own with an SSL cert and hosting your public key.

Bre77 avatar Jan 26 '25 09:01 Bre77

You mean the redirect URL, the origin has to be something else you own with an SSL cert and hosting your public key.

Whoops- yes had them backwards. I've edited my original post to prevent confusion.

tmason818 avatar Jan 26 '25 17:01 tmason818

I followed the many advices of the official integration documentation and @[email protected] https://www.wswapps.com/books/home-assistant/page/tesla-fleet-setup

I successfully worked through until the final step to configure the integration with my AppName, ClientID, ClientSecret....... I am ending up with We don't recognize this redirect_uri. Please use the redirect_uri found in your app details.

I am 100% sure I used https://my.home-assistant.io/redirect/oauth and have "my:" in my configuration.yaml May the error be with the fact that my home assistant is not accessible by open internet - so https://my.home-assistant.io/ leads to a local URL http://ha.fritz.box:8123?

If so: any remediation?

PS: home assisatnt is locally hosted (not nabu.casa)

matejek avatar Mar 24 '25 16:03 matejek

I found this video on YouTube

Instalar Tesla Fleet en Home Assistant paso a paso

https://youtu.be/AhtY69hpSNU

I followed the instructions and it worked.

MrLopHA avatar Mar 24 '25 17:03 MrLopHA

@matejek Make sure that these two fields in the Tesla Developer App Settings aren't reversed. It could be that.

Image

JaggedJax avatar Mar 24 '25 18:03 JaggedJax

@JaggedJax how stupid one can be! I am!! I in deed mixed the rows.

Image

that "final" step worked like a charm after I corrected the entries...... now, I am getting an error telling me "no devices or entities"

Image

matejek avatar Mar 24 '25 22:03 matejek

@matejek did you call the register API endpoints for your region? That is what that error typically means.

Bre77 avatar Mar 25 '25 00:03 Bre77

Hi all, I am definately stuck at the "no devices or entities". I archived the Tesla-Development-Apps, created a new one, assigned the correct URLs

Image

assigned the right areas (I removed energy)

Image

assinged EU server and adjusted scope in postman

Image

received positive TeslaPartnerAccount

Image

in home assistant I removed TeslaFleet instance and oAuth, added TeslaFleet again

linked HA to Tesla successfully

Image

but still no success

Image

I am lost, again

matejek avatar Mar 25 '25 12:03 matejek