Tesla API Access


#64

Thanks for letting me know. I didn’t notice until you posted. I lost my vehicle Id during the Tesla/Aws failure and it wasn’t scheduled to pull the new token for another couple days. I executed the piston and it ran flawlessly. Thanks again for letting me know and for putting the piston together.


#65

Greetings…
I’m not entirely sure if I’m doing something wrong with the first piston. It assigns the string @accessToken and datetime @tokenExpiration global variables, but does not assign the string @vehicleID.

Perhaps I’ve overlooked something?

I’ve entered my email and password in ONLY the two areas provided as per instructions, but when I TEST the piston, I get an error. :frowning:


#66

From your log, it looks like you’re using an out-of-date version of the piston—which is my fault, as I should have updated the top post after some recent changes. Try the piston included in this post here.

Thank you for the reminder to update the post.


#67

@bthrock

Thanks for the reply.
One thing I was thinking, I use TESLAFI.COM which generates its own token for car access. Does your piston generating its own token interfere with TeslaFI’s token? The reason I’m asking is I literally just got an email from them saying:

" TeslaFi.com was denied access using your token with Tesla.com and logging has been turned off.
This may be because your token has expired or you changed your password on Tesla.com. You can generate a new token in settings->account->Tesla API Token."


#68

That worked! :slight_smile:


#69

Yes. If you generate a token independently of TeslaFi you must provide it to them so that they can authenticate with the API.


#70

So what would you recommend? Use Teslafi token in WebCoRE, or use WebCoRE token in Teslafi?


#71

That’s really a toss-up depending on how you use either service. Whichever one is more critical is the one I would use to generate the token.


#72

Oh oh… something broke. :frowning:
Is there a way to fix this?

This is after half a dozen ON/OFF’s to understand how this works.

Screenshot%202020-10-29%20114443


#73

The URL is malformed. Not enough info there to explain why.


#74

Sorry for the late reply… it was something as simple as a typo on a variable. Your code is working great and I’m learning how to execute the various API commands.

I’m not sure if you will know this, but how often can we fetch updates from Tesla’s API? Can I do it every minute, or 2 or perhaps every 5? Will this cause issues with Tesla’s servers and come back at me somehow that you’re aware of?

This is what I’ve done so far with using SharpTools dashboards.


#75

I do not know the specifics for Tesla, but general courtesy is to only query APIs as much as necessary.
(since every query from every user has an impact on the entire system)


#76

I’ve never encountered any kind of limit, and I assure you I’ve hit the API pretty hard at times while testing pistons, etc., but I agree with @WCmore that it should be done only as necessary. I’ve seen times when limits on other APIs were imposed, or access was terminated or made a ‘premium’ feature because users were abusing their access.


#77

Would once every 5 minutes (for WebCoRE purposes) when parked at home keep me under their radar?


#78

Probably, although I would advise against waking your car up that often unless Sentry Mode is already active and keeping it awake.


#79

I would definitely add a condition that info refreshes would only occur when the car is plugged in at home when it’s parked inside my garage.


#80

Battery drain is just one aspect of it. Waking and restarting the car’s computer more often than necessary just seems unwise. But that’s me, and it’s probably not my place to comment anyway since I don’t know what you’re trying to accomplish.


#81

Hmmm… something to consider and re-think my end goal.