Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register
  • We just completed a significant update, but we still have some fixes and adjustments to make, so please bear with us for the time being. Cheers!

Model S Amazon Echo Integration

Cyclone

Cyclonic Member ((.oO))
Jan 12, 2015
5,056
1,141
Charlotte, NC
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.
 

wayner

Active Member
Oct 29, 2014
3,804
1,382
Toronto
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.
 

CuriousG

Active Member
Dec 1, 2015
1,532
1,495
Elk Grove, CA
Sorry about that. The files between my home PC an github got out of sync. I have fixed it now, but I imagine you did that in your own Amazon Ask screen.
Not a problem. Yes I fixed it on that screen otherwise it would not let you bypass the screen. I was just pointing it out so you could fix it and that the next person doesn't run into the same issue.
 

CuriousG

Active Member
Dec 1, 2015
1,532
1,495
Elk Grove, CA
I've noticed that if you have the program running it will not allow your car to sleep. First time getting the program to run resulted in some additional text that didn't happen until the car woke up.
 

Gremlin

Member
Jun 3, 2014
256
71
Washington, DC
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
 

wayner

Active Member
Oct 29, 2014
3,804
1,382
Toronto
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.
 

wayner

Active Member
Oct 29, 2014
3,804
1,382
Toronto
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

Cyclone

Cyclonic Member ((.oO))
Jan 12, 2015
5,056
1,141
Charlotte, NC
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.
 

ACDriveMotor

Member
Aug 11, 2013
890
24
Seattle, WA
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

Cyclone

Cyclonic Member ((.oO))
Jan 12, 2015
5,056
1,141
Charlotte, NC
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.
 

ACDriveMotor

Member
Aug 11, 2013
890
24
Seattle, WA
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!]
 

mottster

New Member
Nov 5, 2015
2
2
Colchester, Essex, England
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

simonog

Member
Jan 9, 2014
433
61
United Kingdom
As a user of this I can confirm it is really useful - it implements a voice interface to the car. One of the most frequent commands use when my wife has driven the car is "Alexa ask Tesla if the car is plugged in" - it saves a visit to the garage to check!
 
  • Funny
Reactions: scottf200

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top