-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tesla authentication fails #54177
Comments
Hey there @zabuldon, @alandtse, mind taking a look at this issue as it has been labeled with an integration ( tesla documentation |
Same here. |
Just updated to core-2021.8.2 and now seeing the same. |
Same here as well, just tried it after enabling 2FA and no go. |
The "me too posts" clutters the thread. Please +1 the original post if you are having this issue. That said, I will not be working on this for reasons described here. Alternatively, someone posted a workaround for advanced users who want to manually log in and copy their tokens over. Modifying .storage directly is not recommended so proceed with caution. |
It seems every other time I upgrade HA, the Tesla integration breaks :-/ |
I'm on core-2021.8.3 and still hitting it. Debug log, sanitized anything that looked like a UUID or a token.
The response looks like a captcha. |
Still an issue with 2021.8.4 |
And it is strange that other API-users seem not to have so many problems - tibber for instance. https://support.tibber.com/en/articles/4408566-smart-charging-explained |
I use an app called A Better Routeplanner to plan out multi waypoint trips with my car. It offers to poll data from the car through the Tesla API in order to adjust estimations and when to charge the car where. Anyhow, I noticed the other day it wasn't providing live data anymore, and just now had time to investigate. This is the screen I would typically type in my Tesla account credentials in order for their service to gain a token from Tesla, I don't remember there being a captcha here before. So I'm guessing their API is requiring captcha completion for some (not all) of the logins, and the HA integration isn't setup to deal with that usecase? |
Correct. That is the cause. |
It would be nice if we could be given the option to provide an API token instead of user/pass[/mfa]. Not sure if that would fix the problem. |
Do a search for |
Workaround for TeslaFi users (or the ones who can obtain auth keys from other similar service):
The result will look like this:
|
Please test this branch to log in with your tesla refresh and access tokens. (Username = refresh token, Password = access token). Use this app to obtain both of those tokens. If that works I will create a new config flow option to use your refresh token to login. (The access token can be generated by itself once this fix gets merged to teslajsonpy) Keep in mind that this is not a fix for production use, this is just for texting and WILL break. |
I was able to authenticate and add the car to HASS again. But I get an error when it tries to fetch actual data it seems.
All sensors are unavailable. |
Expected as much, this was just for testing. Ill be pushing a change on there that should allow it to work past the initial setup phase today or tomorrow. |
Thanks, worked fine! |
Just so I can wrap my head around how the SSO refresh token. If the token is cycled by a different client hitting the endpoint with the same token as what's entered in HA, will HA be able to roll the token forward itself too? |
I guess this doesn't work if I've removed the integration already? I can't re-add it because it gives me the error upon attempting to do so. |
I went into my backups to retrieve an older version of |
@bdoooh Did you push back the expiration time? |
Yeah I input the expiration date in September specified in TeslaFi into the unix time converter and copied that value. I can double check & try again I guess. Edit: Yeah I just checked the config_entries and this is what I have..
|
I need this to be solved, all my automations are broken 😢 |
@bdoooh I had botched up pasting my API keys on my first attempt. Try looking at your logs for any mention of @mat1990dj @denisjoshua : The workaround listed in this previous comment worked for me. You can grab your API keys from this app on Android, if you search around there's a similar app for iOS. If you know how to edit your If you need a proper solution, feel free to fix the code and drop a pull request as per the guidelines of this open source project, or wait for a volunteer dev to get to this issue. Otherwise that workaround does indeed work. |
I don't know how to edit my configuration.yaml file directly on my HASS machine in my case
…________________________________
De: Rubin Starset ***@***.***>
Enviado: jueves, 12 de agosto de 2021 17:14
Para: home-assistant/core ***@***.***>
Cc: mat1990dj ***@***.***>; Mention ***@***.***>
Asunto: Re: [home-assistant/core] Tesla authentication fails (#54177)
@bdoooh<https://github.com/bdoooh> I had botched up pasting my API keys on my first attempt. Try looking at your logs for any mention of tesla. You may need to change your default logging level<https://www.home-assistant.io/integrations/logger/#log-levels> to get more details.
@mat1990dj<https://github.com/mat1990dj> @denisjoshua<https://github.com/denisjoshua> : The workaround listed in this previous comment<#54177 (comment)> worked for me. You can grab your API keys from this app on Android<https://play.google.com/store/apps/details?id=net.leveugle.teslatokens>, if you search around there's a similar app for iOS. If you know how to edit your configuration.yaml file directly on your HASS machine, you're capable of making this work around go in order to fix your crucial automations.
If you need a proper solution, feel free to fix the code and drop a pull request as per the guidelines of this open source project<https://github.com/home-assistant/core/blob/master/CONTRIBUTING.md>, or wait for a volunteer dev to get to this issue. Otherwise that workaround does indeed work.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#54177 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABH2NW5G5C27DZ7WOWTDO3DT4PQOXANCNFSM5BWSWJZQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email>.
|
Can maybe @frenck have some from HA core Team take a look at it and help? It seems there is no one capable to take over the role of code owner right now and code is broken for this official integration. |
For those interested in using Postman to obtain the access token and refresh token, you can follow this https://github.com/jdemeyer1/TeslaAPIThruPostman. |
Seeing the same problem. |
This comment has been minimized.
This comment has been minimized.
@Nicao I think that's because there is no "HA Core Team".... there are moderators who try to aim the efforts in the same direction, but this is oss, everyone is the team. |
It wasn't an indirect "f*ck off" it was indirect "Not cool": You pulled me into a conversation. In general, it is unpolite to randomly mention someone and ask for support. This is also documented in our community guidelines. I don't own a Tesla, nor have I any idea what is going on. Please don't tag/mention people @ random. Thanks 👍 |
Hello guys, |
I don't know why... but I was sure that you wasn't send an indirect "f*ck off" :-) Thanks all |
@zabuldon: Quality engineer here who can read logs and edit files. Happy to help test changes through the standard update process for HA, but due to work I don't have the spoons right now to build anything with patches and deploy onto my local instance. Mostly I think just providing fields to enter in API tokens will give most of the commenters here a work around avenue to stop "me tooing" on this ticket. API tokens can be obtained through Tesla Tokens on Android and Auth app for Tesla on iOS, no fiddling with JSON required. I don't understand how some of my other Tesla 3rd party tools sidestep captcha, I believe Teslamate is in that bucket but I could be wrong. One major problem with the HA's Tesla integration (and many many other 3rd party integrations) is the refresh rate constantly waking up the car which turns into a vampire drain on the battery over night, as described in the docs. Teslamate is very intelligent on when it should or shouldn't pole data in order to avoid vampire drain, and even documents how it should be used in parallel with the HA Tesla integration (directing the use to extended out the wait before next refresh in HA). Would it be ok to edit the HA doc to provide a link to Teslamate's documentation regarding this to give the user another option? |
I can take up being a maintainer for the Tesla integration, though I dont know how I would go on doing so. Also I am still on holiday so thatll have to wait a few more days / weeks. |
Thanks @zabuldon for your help getting this integration started. Do you want to be removed from
Please open a new issue if you're having a problem and I can look at it. I spent a lot of time looking at the algorithm with other people and tested it across my own use case of 3 separate Teslas till we found 11 minute as a good sweet spot. I've also pushed individual users who want more frequent data precisely because I'm concerned about vampire drain for the majority of users. You're free to edit the documentation as you want to make it better since this is a community effort. I know at least one person who configured their HA to stop updates for a car if Teslamate indicated it was trying to let it sleep. But I don't use it so don't know the automation.
Welcome aboard @BreakingBread0 and thanks. As mentioned in teslajsonpy, I can push out your changes in that API pretty quickly and can help explain where I think you'll need changes. I will also review your changes here as that will also help unstick the PR queue. The complexity for the fix is the fact you'll need a process that will detect if the captcha shows up and also if the MFA shows up. I see it as at least 3 stages in the config flow, but you may be able to simplify it. I'm on the HA discord if you want to chat. If you decide to avoid the login and just allow tokens, that may avoid the complexity as you have outsourced the login to the other apps but the PR may be rejected since no other integrations do that. It'd probably worth raising in Discord before you try the token method. I would not suggest doing both methods unless you want to take on the complexity of two login paths. |
Thanks so much for the link to the Android app. I only changed the Refresh token and the date and now my integration is functional again. |
I've got one and I'm ready to help
…________________________________
From: Alan Tse ***@***.***>
Sent: Friday, August 27, 2021 1:44:40 AM
To: home-assistant/core ***@***.***>
Cc: mat1990dj ***@***.***>; Mention ***@***.***>
Subject: Re: [home-assistant/core] Tesla authentication fails (#54177)
I don't have Tesla anymore, so it is not easy to support this whiothout having a cat, so if someone ready to help with troubleshooting I can spend some time to work on the integration again, but I'm not sure if that issue not occurs again in the future. Ideal solution in this case to find out a new maintainer.
Thanks @zabuldon<https://github.com/zabuldon> for your help getting this integration started. Do you want to be removed from codeowners since it's hard for you to support it now? It also might help if people notice the list of owners has lost people. One thing that's been discussed is that HA could show the health of integrations by looking at number of active codeowners. I don't know what happened to that initiative though.
One major problem with the HA's Tesla integration (and many many other 3rd party integrations) is the refresh rate constantly waking up the car which turns into a vampire drain on the battery over night, as described<https://www.home-assistant.io/integrations/tesla/#potential-battery-impacts> in the docs. Teslamate is very intelligent on when it should or shouldn't pole data in order to avoid vampire drain, and even documents<https://docs.teslamate.org/docs/integrations/home_assistant/> how it should be used in parallel with the HA Tesla integration (directing the use to extended out the wait before next refresh in HA). Would it be ok to edit the HA doc to provide a link to Teslamate's documentation regarding this to give the user another option?
Please open a new issue if you're having a problem and I can look at it. I spent a lot of time looking at the algorithm with other people and tested it across my own use case of 3 separate Teslas till we found 11 minute as a good sweet spot. I've also pushed individual users who want more frequent data precisely because I'm concerned about vampire drain for the majority of users. You're free to edit the documentation as you want to make it better since this is a community effort. I know at least one person who configured their HA to stop updates for a car if Teslamate indicated it was trying to let it sleep. But I don't use it so don't know the automation.
I can take up being a maintainer for the Tesla integration, though I dont know how I would go on doing so. Also I am still on holiday so thatll have to wait a few more days / weeks.
Welcome aboard @BreakingBread0<https://github.com/BreakingBread0> and thanks. As mentioned in teslajsonpy, I can push out your changes in that API pretty quickly and can help explain where I think you'll need changes. I will also review your changes here as that will also help unstick the PR queue. The complexity for the fix is the fact you'll need a process that will detect if the captcha shows up and also if the MFA shows up. I see it as at least 3 stages in the config flow, but you may be able to simplify it. I'm on the HA discord if you want to chat.
If you decide to avoid the login and just allow tokens, that may avoid the complexity as you have outsourced the login to the other apps but the PR may be rejected since no other integrations do that. It'd probably worth raising in Discord before you try the token method.
I would not suggest doing both methods unless you want to take on the complexity of two login paths.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#54177 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABH2NWZQXLVEPMEZPQSONGDT63GWRANCNFSM5BWSWJZQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I don't think that it is necessary to remove myself from codeowners as sometimes I'm still checking issues and PRs. |
To integrate the full captcha-based login to obtain a token, you are free to look at the Postman Collection I linked to above. It's another Github project and has all of the steps to connect to Tesla's authentication endpoint, generate the appropriate codes / strings, pull up the Tesla authentication UI with captcha, and obtain the access token and refresh token. |
Most of the Telsa integration in done via teslajsonpy library. The upstream issue is here: zabuldon/teslajsonpy#205 Switching auth to a refresh token should be pretty straight forward once/if zabuldon/teslajsonpy#211 is done. May be a good stop gap solution vs trying to get captcha auth going. To get refresh tokens there are app available and this is how teslascope has changed their auth to support the captchas: As for supporting "two types of auth" they are really the same. The user/pass/mfa/captcha is just used to get the tokens for authenticating the rest of of the API calls. Providing one directly just bypasses that step. I may try to get a development environment going and code it up as a POC. |
Thanks. I'm referring to the UI work to handle it in the config flow. You'd have a user name password flow that would have to handle MFA and captcha and a second flow to take the raw tokens. The token flow would be easier but it's also something to maintain separately in HA. |
I have this working as a custom component where I've just made password optional and added the refresh token as a fourth option in the config flow. I've just published my custom component at https://github.com/omelhus/tesla_custom_component |
As an update, Tesla enabled recaptcha this weekend. This broke my custom component and likely will break it for many other implementations since it requires JavaScript parsing. The most likely solution is the token solution assuming there remains some apps able to generate the refresh token every 45 days. EDIT: There's a workaround for my custom component so it's still a viable option if you understand how to edit your |
Thanks for the update @alandtse. I wish Tesla would properly support third party applications. |
Maybe the config flow UI should be changed to only accept the refresh token then, as username and password is unlikely to ever work again? |
That's probably the way forward at least in HA core. Since you have it basically done in your custom component code, do you want to just submit that PR? We'll probably want the setup screen to point to the documentation where it lists the known authenticator apps. |
Yep, I’ll see what I can do. 👍 |
Sorry folks, Tesla is coming out of core. We'll need to maintain it as a custom component. For now, there's omelhus's version which requires a 3rd party app to generate tokens and mine which requires some hosts file editing as a workaround. I'll probably spend time this weekend getting it into the custom_components and HACS as a default. |
The problem
My Tesla-integration stopped working yesterday without any changes on the Tesla-accout or the home assistant integration.
What is version of Home Assistant Core has the issue?
core-2021.8.2
What was the last working version of Home Assistant Core?
core-2021.8.2
What type of installation are you running?
Home Assistant Container
Integration causing the issue
Tesla
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tesla/
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
credentials are working on tesla.com. I tried to uninstall integration, restart home assistant, re-install integration. Error occurs again.
The text was updated successfully, but these errors were encountered: