Skip to content
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

Possible new login issue #43

Open
scienceintheshed opened this issue Apr 18, 2021 · 8 comments
Open

Possible new login issue #43

scienceintheshed opened this issue Apr 18, 2021 · 8 comments

Comments

@scienceintheshed
Copy link

This just started this morning...currently happening on two separate machines.

Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

=================== RESTART: C:\Python\Powerwall 3\tesla5%.py ==================
Traceback (most recent call last):
File "C:\Python\Powerwall 3\tesla5%.py", line 14, in
asyncio.run(main())
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Python\Powerwall 3\tesla5%.py", line 7, in main
energy_sites = await client.list_energy_sites()
File "C:\Python\Powerwall 3\tesla_api_init_.py", line 174, in list_energy_sites
for product in await self.get("products") if "energy_site_id" in product]
File "C:\Python\Powerwall 3\tesla_api_init_.py", line 142, in get
await self.authenticate()
File "C:\Python\Powerwall 3\tesla_api_init_.py", line 130, in authenticate
self._token = await self.get_new_token()
File "C:\Python\Powerwall 3\tesla_api_init
.py", line 90, in _get_new_token
redirect_location = resp.headers["Location"]
KeyError: 'Location'

@tbee
Copy link

tbee commented Apr 19, 2021

With MFA using old bearer token is still working for TeslaTasks.

@scienceintheshed
Copy link
Author

AFAIK TeslaTasks connects to a vehicle. I'm using this on a Powerwall and there is no option for me to setup MFA through the Powerwall app.

@tbee
Copy link

tbee commented Apr 19, 2021

You setup MFA on Tesla's website, not via the app.

@scienceintheshed
Copy link
Author

MFA does not change the fact that the new code has stopped working.

@tbee
Copy link

tbee commented Apr 26, 2021

All I can say is that TT experiences no problems, both with actually logging in (using MFA) and using the obtained long lived token.

It seems your error is when obtaining the Location header after the login. You could give my Java implementation a try, if you're up to it, to see if that also has the problem. That is what TT uses.
https://github.com/tbee/teslaApi/blob/main/src/main/java/org/tbee/tesla/TeslaMFALogic.java#L310

@scienceintheshed
Copy link
Author

Digging deeper I'm finding that I'm getting a 403 response when trying to get a new token even though I can authenticate locally using the gateway ip address and same credentials, so something has changed at Tesla.

@erichump
Copy link

erichump commented Aug 8, 2021

Same here. Getting a 403 response.

@tbee
Copy link

tbee commented Aug 9, 2021

I've been getting a 500 response since a few weeks now on the request for the factor id's. And have not been able to figure out why. I see that the process is okay (compared to what happens in a browser). The actual commands do still work, it's just the login process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants