-
Notifications
You must be signed in to change notification settings - Fork 84
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
Seems like the teslapy is no longer working with the new Tesla APIs #156
Comments
Perhaps the intent was to rely on Tesla to support these apps, sadly I made my code rather reliant on the easy calls in TeslaPy |
Same here on vehicle_list() requests.exceptions.HTTPError: 412 Client Error: Endpoint is only available on fleetapi. Visit https://developer.tesla.com/docs for more info for url: https://owner-api.teslamotors.com/api/1/vehicles |
Yes access to the https://owner-api.teslamotors.com/api/1/vehicles endpoint stopped sometime over night (in UK), I would guess that for vehicle data you now have to use the Fleet API. However |
yes, but for how long? :( I looked at registering for the fleet api, but you have to be a business :( |
In the same boat as you guys. I just tried the Home Assistant Tesla HACS integration and that works fine for 2 cars so I'm guessing there other implementations available to get at our Tesla data. Also see issue 150 |
This patch makes it work again for me by switching from VEHICLE_LIST to PRODUCT_LIST and filtering out batteries and solar (there is no 'vehicle' resource_type in the vehicle product response)
|
I was able to register my app on tesla dev site ( Application Onboarding Request Approved ) . so now I have the keys from tesla. but how do I plug those into this API ? |
Same issue here. Looking at the doc there seems to be a way to make it work, for free, for a while, with limited no. of requests. https://developer.tesla.com/docs/fleet-api |
I tried to create a business account using valid business details but got the error at the end: Unable to Onboard, Contact your account manager.... |
@dan-cristian uncheck the first option (get personal data etc) and it will work. |
For the record I used https://github.com/fabianhu/tesla_api and manage to get everything I need. |
This works as long as there are no other products than battery and solar. A better way is to check if product has vin and vehicle_id.
|
I just tried to create a business account using valid UK business details (by tax id it wants a VAT number and not a UTR) but got the error at the end: Unable to Onboard, Contact your account manager. The only scope I checked was Powerwall Information, the first option get personal data was unchecked. Suggestions? |
DaveTBlake you can use the old API, you just need to replace def vehicle_list(self) function in the
|
As a suggestion try to enter browser console and check what messages you have there. |
I also have this problem. Any suggestions? |
@DeLN0 I know that for now the Owner API works for Powerwall settings, and I have modified TeslaPy to keep my script working. But the end of Owner API is coming so I'm looking to see if I can jump throught the hoops to move the FleetAPI
Neat idea. Console shows Not sure what to make of that. My guess is that my URLs are the problem, I own a domain but use free-parking and that doesn't have a certificate. I couldn't see how to get Localhost working either, which could be all I need. My next step is to look for some free storage I have point my domain at. All in a lot of effort just to get a script for one user working. |
In my case, if i go to https://developer.tesla.com on my iPhone this is what i get, even though my domain is fine and certicates are up to date: |
I managed to get developer access working yesterday following this tutorial. Edited to show author's blog instead of the medium.com version which is paywalled: |
Paywalled |
@israndy that tutorial by Shanka Kumarasamy is also just in his blog too (not behind the Medium paywall) https://shankarkumarasamy.blog/2023/10/29/tesla-developer-api-guide-account-setup-app-creation-registration-and-third-party-authentication-configuration-part-1/ |
This would be good to to have in teslapy as a PR. This change worked for me, thanks! |
That patch allows TeslaPy to continue to do 'read' sorts of functions. But, if I try to issue a command, I get
I think the old commands API now only works for pre refresh (2021) S & X? The rest of us have to use the Fleet API for sending commands to the car. |
@mshoe007 I have a 2020 X and a 2022 X, both works fine with new API's to read data and to run commands. so moving to the fleet API works for me on both cars |
@aviadoffer I gave the https://github.com/fabianhu/tesla_api a try but got stuck at the step of building the go language part. Are there any extensions to be made to the readme to make it clearer? I'm running on a Raspberry Pi 3 btw |
@JanJaapKo so I only did the simple step of importing the tesla_api_2024.py for the purpose of auth. placing the keys in TeslaKeys so in a high level it looks like this: from tesla_api import tesla_api_2024, TeslaAPI Then I added the function I needed to the tesla_api_2024, example: def tesla_start_charge(self, vin):
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({})
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.access_token}'
}
conn.request("POST", f"/api/1/vehicles/{vin}/command/charge_start", payload, headers)
res = conn.getresponse()
data = res.read() and def tesla_set_charge_amp(self, vin , amps):
conn = http.client.HTTPSConnection("fleet-api.prd.na.vn.cloud.tesla.com")
payload = json.dumps({
"charging_amps": f"{amps}"
})
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.access_token}'
}
conn.request("POST", f"/api/1/vehicles/{vin}/command/set_charging_amps", payload, headers)
res = conn.getresponse()
data = res.read() etc... |
Is your car newer than november 2023? Tesla says |
The build instructions are here: https://github.com/teslamotors/vehicle-command You need a 32-bit install of go for a Raspberry Pi 3. (I assume you're running a 32-bit OS on it). If you are running 64-bit linux, get the go1.21.6.linux-arm64.tar.gz file.
Note you need to permanently set your PATH to include $HOME/bin/go if you have not already |
@tdorssers Do you think the Owner API hence TeslaPy will still work in the future (regardless of what Tesla says) ? Are you planning to update TeslaPy to support the new Tesla Vehicle Command protocol? https://github.com/teslamotors/vehicle-command
Ty for your contributions btw! |
@tdorssers I manually changed the code to fetch the product list iso vehicle list, so it works again. However, when running a new install or upgrade with pip, the version stays at 2.8.0. Any ideas? Further, this issue seems to mix the broken owner api (which should be fixed with recent commits) and the move to the fleet API to be able to send commands, correct? |
@DeLN0 - "Do you think the Owner API hence TeslaPy will still work in the future (regardless of what Tesla says) ?" TL;DR: Yes with restrictions (no sending commands to 3/Y and 2021+ S/X) Tesla has explicitly said the Owner API will continue to be available for pre 2021 S & X as those vehicles do not support the FleetAPI. https://developer.tesla.com/docs/fleet-api#2023-11-17-vehicle-commands-endpoint-deprecation-timeline-action-required
Plus, for non-commands, the "REST API" (as Tesla calls it, the "Owner API" as we call it) is not going away for any vehicles. See the 2023-10-09 Announcement on the fleet-api page (above)
The RestAPI/OwnerAPI no longer supports the 'command' parts of the API for 3/y and 2021+ S/X. (with whatever exception "Fleet accounts" means) @DeLN0 : "Are you planning to update TeslaPy to support the new Tesla Vehicle Command protocol? It seems like you're hoping someone (possibly the owner of TeslaPy?) would set up a public proxy for the the Owner API and folks could have TeslaPy use it rather than Tesla's servers. That would work, except: Any proxy uses the tesla-control program to send commands to the vehicle (the proxy will use the old API for some other things).
Another minor wrinkle is that cars will only accept commands from developer apps that the owner of the vehicle has previously approved. That's not a big deal, as the owner of the proxy merely needs to supply a URL that user can click on which will send a request to Tesla to open the owner's Tesla App to approve access. It looks like https://tesla.com/_ak/DEVELOPER.COM where DEVELOPER.COM is replaced by the domain name the registered developer used to gain access to the FleetAPI. |
@JanJaapKo "I manually changed the code to fetch the product list iso vehicle list, so it works again. However, when running a new install or upgrade with pip, the version stays at 2.8.0. Any ideas?" I don't understand. pip install and 'new install' grab tdorssers last published release. Of course the version number does not change. If you have installed TeslaPy locally, you need to modify your local copy of the python TeslaPy package. Doing pip upgrade or a fresh install could destroy your local changes. After you make your local change to use the product list, if you want a different version number (which is a good plan), you should find the |
I wrote
It looks like at least one developer is going to do this. See alandtse/tesla#743 (comment)
If that happens, and TeslaPy supports alternative REST servers, then that may be one option to continue using TeslaPy |
FYI: This developer has forked the Tesla proxy code to create a proxy that does not require using the FleetAPI https://github.com/lotharbach/tesla-command-proxy/tree/owner-proxy @DeLN0 - it still requires someone to set up such a proxy with public access for use by TeslaPy. Or, you can run the proxy locally for yourself. |
@mshoe007 Thats great, ty for that! Waiting for Tesla to release their paid plans, just hoping prices don't go the way of Twitter API because that would be a bad sign for the open source community. |
Published new version on Pypi including vehicle endpoint fix. It does not include the ability to send commands. |
Yes I believe that the Owner API will still work in the future. But we need a Python implementation of the Tesla Vehicle Command Protocol otherwise we will be stuck using a proxy written in the Go language. |
Just updated and everything is working again. The commands I use in my script still work: Car is Model S 12/2022 Henry |
Commands are working for me also.
November 2023 Newly delivered vehicles* will only support the Tesla Vehicle Command protocol after this date I assume we are in this category 'Nov - Dec 2023 | REST API support will be deprecated on existing customer vehicles that have not used the REST API in the preceding 30 days' The writing is on the wall and we have to migrate to the new Fleet Api to ensure we are not left behind. |
I haven't looked into the fleet API. I know those like Tezlab, Teslafi etc have moved over. But for individuals, is there a free version? I dont want to pay (a third party or Tesla) for basic API queries about my car (like if its plugged in at night so I dont forget). |
It's free for now but with limits. |
I updated with the latest changes and it works, both reading and sending commands still works, so good news so far! |
have you managed to register? I've failed with "unable to onboard"
…On Wed, 31 Jan 2024 at 16:57, DeLN0 ***@***.***> wrote:
The writing is on the wall and we have to migrate to the new Fleet Api to
ensure we are not left behind.
I haven't looked into the fleet API. I know those like Tezlab, Teslafi etc
have moved over. But for individuals, is there a free version? I dont want
to pay (a third party or Tesla) for basic API queries about my car (like if
its plugged in at night so I dont forget).
It's free for now but with limits.
See https://developer.tesla.com/docs/fleet-api#membership-tiers
—
Reply to this email directly, view it on GitHub
<#156 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZMGBOBIFNBDCLDGUJLPVTYRJZZHAVCNFSM6AAAAABCGGSE7OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJZGUZDANBTHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@doubledrat I have failed to register too, just many "unable to onboard" when trying to register with my UK business no matter what I did with my website certification and DNS record, or with the scopes (I only want battery stuff but added vehicle just in case). Did get further by 'accidentally' entering as a US business, but then recieved an email rejection saying My other wonder is if the UK business version of the registration page is broken. Browser console shows error "Failed to load resource: the server responded with a status of 400 (Bad Request)". I am open to suggestions, is there is a way to get answers from Tesla? |
perhaps raise it here?
teslamotors/vehicle-command#148
…On Fri, 2 Feb 2024 at 12:43, Dave Blake ***@***.***> wrote:
have you managed to register? I've failed with "unable to onboard"
@doubledrat <https://github.com/doubledrat> I have failed to register
too, just many "unable to onboard" when trying to register with my UK
business no matter what I did with my website certification and DNS record,
or with the scopes (I only want battery stuff but added vehicle just in
case).
Did get further by 'accidentally' entering as a US business, but then
recieved an email rejection saying Invalid origin, redirect, or return
URI/URL. Update client details and resubmit. but I don't know if that is
upset by my UK account email and SSL combination or if something is still
wrong with my website.
My other wonder is if the UK business version of the registration page is
broken. Browser console shows error "Failed to load resource: the server
responded with a status of 400 (Bad Request)".
I am open to suggestions, is there is a way to get answers from Tesla?
—
Reply to this email directly, view it on GitHub
<#156 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADZMGBP2ULTIXSRHUA3KMWDYRTNPZAVCNFSM6AAAAABCGGSE7OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRTG4ZTCMBWGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yes, I've managed to register but i had to buy a new domain specifically for that.
If you want a key just for personal testing, you can use any website and business you want from the internet. But if you actually need to receive a callbak url, for that you have to own the domain. |
@DeLN0 really!?!?!? Don't I need to do something with code validation at the web site? All I want is to fetch data and control my powerwall, I don't care about cars or other people etc. I thought I had to jump through the business and third-party app hoop to be able to use the Fleet API. I know that the Owner API still works, but for how long, and using a published and offical API seems a better idea, but it is just for my own personal 'hobby' use. |
You don't need to do anything with code validation at the web site, Dave. |
I goofed around with the developer registration process and made this: tesla_api_example For the implementation of the command protocol, we can team up, as I myself would like to have a python-only implementation. @tdorssers Do you have plans? Meanwhile even the documentation is present, but I'm not feeling motivated enough to code it myself. |
@fabianhu I'm trying your example but I ran into the registration form. Do the account details need to be legit? In other words, do I need a valid VAT number connected to an actual business? And I notice that you disabled the issues, done that deliberately? Only improvements in the for of PR's allowed ;) ? |
Thank you Jan, I merged your improvements. The issues are open in the tesla_api repository. |
This only seems to be available to businesses, which is why I find this change to be so disappointing for the rest of us. Is there any possibility of getting developer access as an indie developer? |
Yes you can I googled for 'what does a VAT number look like', got a fake number and used my home adress. Worked fine. Check also the improved description at https://github.com/fabianhu/tesla_api_example |
I'm not a business. I signed up for it just as I posted - following that blog. The bogger didn't sign up as a business, either. I am in USA - I have no idea what the requirements are outside of USA. |
I found this app on the App Store: https://apps.apple.com/us/app/auth-app-for-tesla/id1552058613 and it says it can get API tokens using the Fleet API, once you have that can you swap these tokens into the existing TeslaPy scripts and keep using the scripts already written or did the end points change? |
I'm now getting an error : Endpoint is only available on fleetapi
I understand that this is due to the new API requirements, just wondering if there is a plan to update Teslapy project?
Thanks in advance!
The text was updated successfully, but these errors were encountered: