Tesla API Access


#56

I’m not seeing the null issue here, but I have a guess as why it might be happening. Do you or have you had multiple cars in your account at any time?

Either way, it might be helpful if you logged the full $response after the GET request to TeslaApiURL and forwarded it to me by PM. For security, you can mask or replace any private data if you want to, just don’t change the structure of the JSON.


#57

Only ever one car. I’ve tried to adjust things in the expression but it always gives me a null followed the the number.

Let me try and get the full response now from Webcore


#58

I have never done anything with an API before but I have been trying to figure out a way to get Alexa to control my climate! Would I be able to use this piston to do that?


#59

You can control climate with the API, however, the pistons posted here aren’t currently working and I am currently attempting to determine the reason and come up with a solution, but I don’t have a time frame on that just yet.


#60

Hi @bthrock, I imported your code but nothing happens when I hit the test button. The variables don’t populate and the last execute time doesn’t change. Did I do something wrong? I imported the file three times and the only thing I changed was the username and password field.

Any assistance is appreciated.

Thanks in advance!


#61

Known issue, as yet unresolved. See Web Requests are not working, can't access API's etc?


#62

Thanks for letting me know @bthrock. I seriously thought I broke something :smiley:


#63

If you haven’t noted already, the Tesla API access is working again.


#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)