Awesome
AshsSDK
An Alexa Smart Home Skill SDK made for controlling any network controlled devices using payload V3 (Entertainment Devices)
Requirements
- A AWS account
- A Amazon Developer account
- An Alexa-enabled device such as Amazon Echo or Amazon Echo Dot
- A Bridge running Python 2.7 and Pip (I used a Raspberry Pi, but another computer running linux will work too)
- I recomend using screen to run python headless
How to
- AWS IAM Setup
Create an AWS Role in IAM called mqtt_handler with access to Lambda.
-
AWS IOT Device Setup
-
Lambda Virtual
device
Create an AWS IOT Thing
Download these as lambda.cert.pem, lambda.public.key, lambda.private.key
- Client Device
Create an AWS IOT Thing
Download these as client.cert.pem, client.public.key, client.private.key
- Get MQTT Server Hostname
- Go to Settings
- Note down the Endpoint
- It should look like: xxxxxxxxxxxxxx.iot.us-east-1.amazonaws.com
Note: Make sure to download your public and private keys to some place secure. You will not be able to re-download these.
- Bridge Set Up
Clone this repo and install dependencies
git clone https://github.com/thehappydinoa/AshsSDK
cd AshsSDK/
pip install -r client/requirements.txt
Copy lambda.cert.pem
and lambda.private.key
in to the folder named lambda
Copy client.cert.pem
and client.private.key
in to the folder named client
cd ..
python fileGenerator.py
- Upload
mqtt-handler.zip
to lambda
Create function
Click Create New Function
Create from Scratch
Skip adding a trigger until after the you create an Alexa Skill
Configure Function
- Name the function
Alexa-MQTT-Skill
- the runtime to
Python 2.7
- Set Code entry type to
Upload a .ZIP file
- Set Handler to
mqtt-handler.lambda_handler
- Set Role to Existing Role
mqtt_handler
Copy ARN
Should look like arn:aws:lambda:us-east-1:xxxxxxxxxxx:function:Alexa-MQTT-Skill
- Create Alexa Skill
Create or login to an Amazon Developer account.
In the Alexa Developer Console Select Alexa Skills Kit
- Set Skill Type to
Smart Home Skill API
- Set Name to
Alexa-MQTT-Skill
- Set Payload Version to
v3 (audio-visual devices)
Copy the ID:
Should look like amzn1.ask.skill.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Go Back to the Lambda Dashboard
Add Alexa Smart Home
as the Lambda Function Trigger
Paste in the ID
You Now should be able to interact with your Skill
Try saying Alexa, Turn on Device1