Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Model S Amazon Echo Integration

This site may earn commission on affiliate links.
I apologize if this is painfully obvious to most or all, but just to be sure this is my understanding of how the security stuff works.
  • All of the calls to the Tesla API that read data or take action on your car require an OAUTH token.
  • The email/password requirement is really just needed to acquire an OAUTH token. After you have the token you no longer need the email/password until...
  • The tokens expire after 90 days or when your MyTesla password is changed.
Given the above you really just need an OAUTH token. But how do you do that securely in a cloud environment where many people may be using the Skill? And how do you deal with the case when tokens expire. When playing around at home I just store a token in a file called token.txt and I just read that whenever I hit the Tesla server as I figure that makes more sense then getting a new token every time you run somehting.

The User Linking from Alexa seems the way to go but it isn't clear that we can do this without Tesla's approval. Does somebody want to look into that.

The only thing I would also mention is that every time you restart your python service (whether you do it on Cloud 9, locally, or elsewhere) and are not providing your token to the service, as it is written today, you are creating a new token. I don't know if Tesla has a limit on how many can be outstanding on a car/account.
 
That is very true and if you hit the server too much you can get locked out, but I don't know what defines "too much". One way I tried to mitigate the risk of getting locked out is to hard code my token into the teslajson.py file.

By the way this could also refer to just any data request, but in that instance I believe too many is hitting the server thousands of times per day which is unlikely with this Skill, but it has happened for other stuff like Allen Wong's Tesla Remote S app.
 
Has anyone done anything in this area? I just got a few Echo Dots and would love to be able to do a few simple things, like asking Alexa if my car is plugged in, asking the charge status, start charging and turn on climate.
I'll look on the Internet as the owner of the video posted it somewhere. I received an Amazon Echo for Christmas :- P so I'll post the info
 
is there a functional skill available yet?
There are many functional skills, however you have to run them on your own server or your own cloud instance as none of them support the account linking that would be required to do authentication directly from Tesla's servers. So currently you have to hard code either an OAuth token or user/pass into an environment variable or into the code of the program to access your car.

There is a js one linked to above and then there is this Python version :GitHub - mekolowich/nikola-tesla-alexa: Nikola: An Alexa Skill (and Python intent handler) for Monitoring and Managing a Connected Tesla Automobile
 
  • Like
Reactions: faughtz
Actually there are a few things out there now including Nikola which I helped put on. The problem that we are all having with this is authentication.

Which sadly is not that hard if we just had someone serving up a webhost. Not that difficult to make the request to Tesla's server for the Alexa service if you can serve up a webpage asking for the Tesla credentials. The problem there is is securing the webhost and trust by the user that the credentials are not saved.
 
Which sadly is not that hard if we just had someone serving up a webhost. Not that difficult to make the request to Tesla's server for the Alexa service if you can serve up a webpage asking for the Tesla credentials. The problem there is is securing the webhost and trust by the user that the credentials are not saved.

I have deployed and am hosting an account linking site that works with Alexa. I use this for my side loaded skill so that I don't have to put user/pass or token in an ENV variable. I would much prefer that Tesla host and make available such a linking site (for the trust reasons you cite) and so I could potentially publish my skill. That said I've considered making the site available to others if there was both interest and Tesla approval to do so.

upload_2017-1-17_21-48-34.png
 
  • Love
Reactions: Cyclone
I have deployed and am hosting an account linking site that works with Alexa. I use this for my side loaded skill so that I don't have to put user/pass or token in an ENV variable. I would much prefer that Tesla host and make available such a linking site (for the trust reasons you cite) and so I could potentially publish my skill. That said I've considered making the site available to others if there was both interest and Tesla approval to do so.

View attachment 211087

Yeah. It isn't a hard process, but when you start serving up a secure host for credentials, then there is a whole another suite of things to manage just for that service. I agree that I wish Tesla would provide such a service directly since most of the pieces they would need are already in place.
 
Some significant updates to the alexa-tesla skill. Supported intents now include:

  • Start/Stop charge
  • Get/Set the charge limit
  • Lock/Unlock doors
  • Start/stop climate system
  • Set climate temperature
  • Beep the horn
  • Flash the lights
  • Get the odometer reading
  • Get the current battery-level/range
  • Check if vehicle is plugged in
  • Check the charge time remaining
  • List the vehicles attached to your account
  • Enable/disable valet mode [NEW!]
  • Reset the valet pin [NEW!]
  • Get the climate settings [NEW!]
 
Hi all, I know I'm late to the game here, but I thought it worth a post all the same.

I wrote an Alexa Skill at the end of last year, and finally got round to polishing it up, integrating the security for logins and all that, and published it around February. It's called My Valet and is currently the top rated skill in the skills stores for each country where Alexa sold.

It's had great feedback via the UK Tesla Owners Group where I've been talking about it since I wrote it, but I figured I should be a bit more active on here too! It's written in C# and hosted on one of my own servers. From a user perspective you just need to enable it and link your account (I don't persist either your credentials or the security token), and from a developer perspective I have published the source code at https://school-talk.net/TeslaAlexaSource.zip if anyone wants to have a look at it.

(The only things removed from the source code are the Tesla secret key and the code for authenticating Alexa requests have genuinely come form Amazon, as both those things are not mine to share!)
 
  • Helpful
Reactions: scottf200