Mario Kadastik
Active Member
You have to add the toien as argument to teslams.all call in addition to username and password, it seems this addition wasn’t added to all examples, streaming for one didn’t, but look teslacmd.js or others for syntax
You can install our site as a web app on your iOS device by utilizing the Add to Home Screen feature in Safari. Please see this thread for more details on this.
Note: This feature may not be available in some browsers.
If you find a solution let me know.
Also note there's a pull request for the fix for the hjesper's teslams code, though it still isn't working for me. But that could be something on my side.
Help!
I have written my own mini-app that uses the “unofficial” Tesla api. It’s been working more or less continuously for the past year or so. However about 7 days ago it suddenly started to give me a permanent “503” error response when I try to do the initial login. So far I have been unable to find out why.
Any ideas anybody?
(I haven’t changed my login credentials lately).
Thanks for any suggestions as to what I can try next to solve this issue.
I have tried using this:Try adding a Use-Agent header
Hjesper teslams works fine for me. I modified some stuff in the streaming file to handle the napping/sleeping of the car. I guess when he implemented it, teslaservers would have responded in a different way.
What is your version? Just something you did privately or something you have on a repo somewhere?I ll check my version vs hjespers one
Help!
I have written my own mini-app that uses the “unofficial” Tesla api. It’s been working more or less continuously for the past year or so. However about 7 days ago it suddenly started to give me a permanent “503” error response when I try to do the initial login. So far I have been unable to find out why.
Any ideas anybody?
(I haven’t changed my login credentials lately).
Thanks for any suggestions as to what I can try next to solve this issue.
That’s sounds more like an SDK error. I don’t think that error is coming from Tesla API.I have tried using this:
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
.....but I then receive the following error:
The 'User-Agent' header must be modified using the appropriate property or method.
Parameter name: name
Any suggestions?
With the pull request changes that were recently submitted I was able to get it working. Thanks.
What is your version? Just something you did privately or something you have on a repo somewhere?
Thanks
Is there an endpoint that contains current kWh capacity? I want to pull data before and after a drive and see kWh used... This figure is available from trip computer (kWh used)
Yeah I can calculate that by (range delta) / 310 × 78 . This is a decent approximation for the Model 3 assuming 78 kWh available pack and 310 rated milage.. . But the range can be affected by temperature so since it is exposed in the GUI I was hoping it was available in the API for more accurate measurementsyes I did some modification saved locally dont have a repo.
the napping wasnt handled correctly when I downloaded the code (around 6 month ago), i.e. the car would not get out of napping if you stopped, lets say for 5-10min, and drove again.
also there isnt a handling to quit tesla_poll when the car is actually sleeping.
I dont know if this is now fixed, havent checked any recent code version, altough i thought there wasnt any code amendment for the past 2 years.
my guess is that teslaservers now respond differently than they did when hjspers implemented streaming.js
attaching my modified version of it (changed extension otherwise wouldnt let me upload a *.js file).
I didnt want to waste too much time on this so just fixed napping/sleeping, i m pretty sure many things could be rewritten.
there isn't any data telling us the capacity in kwh but there is the ideal and rated battery range in miles(estimated). you would need to convert the estimated miles with rated wh/miles to get khw. not sure how accurate that is though.
Yeah I can calculate that by (range delta) / 310 × 78 . This is a decent approximation for the Model 3 assuming 78 kWh available pack and 310 rated milage.. . But the range can be affected by temperature so since it is exposed in the GUI I was hoping it was available in the API for more accurate measurements
Not remaining, rather consumed since last chargein model 3 you have remaining capacity exposed in the GUI??
So I've noticed the streaming tokens returned by the APIs lately are sometimes invalid. This is easily observable by sniffing the official app's network traffic and every so often the tokens returned are invalid such that attempting to summon or access telemetry (location screen) will repeatedly fail with 401 unauthorized "can't validate password".
I'm still trying to safely conclude what the root issue is, but after extensive testing all signs point to the conclusion that this is a relatively new issue introduced on Tesla's server-side in the past few months. If this is the case then it sucks as the best you can do now is cache all your streaming tokens and hope one works eventually. Would love to be wrong on this one!
Dim request = TryCast(System.Net.WebRequest.Create("https://owner-api.teslamotors.com/oauth/token"), System.Net.HttpWebRequest)
request.Method = "POST"
request.ContentLength = 0
Dim responseContent As String
Using response = TryCast(request.GetResponse(), System.Net.HttpWebResponse)
Using reader = New System.IO.StreamReader(response.GetResponseStream())
responseContent = reader.ReadToEnd()
End Using
End Using
Keep in mind that you can't access the CANBus in the Model 3 without taking apart your dash and tapping the CAN wires. The diagnostic port is not user accessable at the moment. This might also be true for MCU2 on the S.X.in model 3 you have remaining capacity exposed in the GUI??...try the get_charge_state endpoint from teslams.js maybe for model 3 it returns more info than for model S...the capacity and remaining capacity can be retrieven from the CAN Bus...Very cheap CAN BUS reader...
To test the websocket service, you can use this curl command :
Code:curl --user 'USERNAME:TOKEN' -i -N --header "Sec-WebSocket-Key: SGVsbG8sIHevcmxkIQ==" -H "Sec-WebSocket-Version: 13" -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: streaming.vn.teslamotors.com" -H "Origin: https://streaming.vn.teslamotors.com" https://streaming.vn.teslamotors.com/connect/VEHICLE_ID
Change the USERNAME, TOKEN and VEHICLE_ID to match your info.
Note that you ONLY get this information now at very low frequency :
It seem to have happen to model 3 only at first, and it seem to be rolling out to model S and X as well now !Code:{"latitude":45.377188,"longitude":-73.60919,"msg_type":"vehicle_data:location"}
I hope it just an error on tesla part, but I feel that tesla is looking to lower their 3g data usage so the good streaming data day might be over !!! I wish we could have had some headup from Tesla about this, giving time to give a solution or inform user of site like mine, teslalog.com.
It appears I am using all the correct variables but getting the "{"error":"vehicle not found (404)"}" error. I've tried on several different models and used my access token and the first vehicle token. Is there an issue currently? I tried Model S with 2018.34.1 & Model X with 2018.28.5 and model 3 just to try but same error. I'd love to get this working. Any ideas on what could be going wrong?