teslalexa
v0.1.1
Published
Control a Tesla from Alexa
Downloads
7
Readme
Teslalexa
Control your Tesla from Alexa. Uses the Tesla JSON API.
Prerequisites
- NodeJS (4.3 or higher)
- An AWS (Amazon Web Services) account
- An Amazon Developer account
- awscli installed and configured
Install
Yes, I know this is huge. I'm looking to automate this more in the future. PRs to help are appreciated!
- Go to the Releases tab and download the zip or tar.gz of the latest release.
- Unzip to somewhere and open up a terminal console in that location.
- Run
npm install
to obtain any dependencies. - In AWS, create a function in Lambda:
- Choose the Blank Function blueprint.
- Select Alexa Skills Kit as your trigger.
- Name the function TeslaControl and make sure the Runtime is Node 4.3.
- Leave the code section alone.
- Set the following Environment Variables: - TESLA_EMAIL - Your tesla.com email address - TESLA_PASS - Your tesla.com password - TESLA_VIN - The VIN of the vehicle you want to control - TESLA_CLIENT_ID - You can get these two here - TESLA_CLIENT_SECRET
- Under Role, Create a new role from a template. Name it TeslaControl and choose the Simple Microservice permission.
- Create the function and grab the ARN from the top right of the screen.
- Head over to the IAM section of the AWS Console and go to Roles.
- Select the TeslaControl role and click on the policy that starts with
AWSLambdaMicroserviceExecutionRole-
. - Edit the policy and change the Action section it so it reads:
"Action": [
"dynamodb:*"
]
- Validate the policy to be sure it's right and Save it.
- In the Amazon Developers Console, create a new Alexa skill:
- The Skill Type is Custom Interaction Model, you can name it whatever you want, and the Invocation Name should be "my car" ("my Tesla" will also work. I wouldn't recommend "my Model S")
- In the Interaction Model tab, copy the contents of
intents.json
into the Intent Schema, andutterances.txt
into the Sample Utterances box. - Create two Custom Slot Types:
- LOCK_UNLOCK
lock unlock
- START_STOPstart stop
- On the Configuration tab, choose the AWS Lambda ARN as Service Endpoint Type, region of North America, and enter the ARN from the AWS Lamda function you created.
- On the Test tab, it should be enabled for testing on your account.
- Grab the ID at the top of the page (starts with
amzn1.ask.skill
). - Head back to the AWS Lambda function you created and add a new APP_ID environment variable with the Skill ID you just copied.
- Back in the terminal console, run
npm run lambda
to publish the code to your Lambda function. - Back in the Amazon Developer Console, you should be able to test with an utterance of "Tell my car to log in" and get back some code that says something about being logged in.
- Also run "Tell my car to get vehicle" to make sure it can find your vehicle.