AWS Alexa Smart Home Skill: introduction and startup – 1

Spread the love

I bought an Alexa device and since then I don’t want to press a button anymore and I want to turn all my devices into voice control. If my internet connection stop to work I don’t exist anymore.

Amazon AWS Smart Home Skill introduction
Amazon AWS Smart Home Skill introduction

But after I this disclaimer I’d like to start to help you to connect your custom device to your personal AWS account.For this part I will refer to an old existing tutorial given but not updated from Amazon.

First we must understand wicth parts we are going to examine in this project.

Alexa Smart Home Skill position
Alexa Smart Home Skill position

We’re going to create our own Alexa SmartHome Skill to interact with Alexa, then store the information on DynamoDB.

I have created a specific tutorial for DynamoDB, if you want you can start from that tutorial “DynamoDB with JavaScript SDK v2 and v3”.

You must know that a Smart Home Skill is different from a Skill, the main difference is that it is not necessary to open the Skill to work, you can directly execute the command (like “Alexa turn on the light”) but as you can understand you have some limitations, the first is that you can only use a set of commands specified by an interface.

  • BrightnessController
  • ColorController
  • ColorTemperatureController
  • InventoryLevelSensor
  • InventoryUsageSensor
  • PercentageController
  • PowerController
  • PowerLevelController
  • SceneController
  • TemperatureSensor
  • ThermostatController
  • TimeHoldController

And some generic controller

  • ModeController
  • RangeController
  • ToggleController

There are other 2 set of interface, but we don’t read about that now.

To work a skill need a back end, the back end is a lambda function, that you can see It like a REST service but with custom element and funciton. We are going to develop that lambda in AWS JavaScript Framework 3.

Prerequisites

You must create the accounts.

Code and resources

First create a folder, for me I create

alexa-skill-manage-relay-nodejs

Get the setup-template.txt file from

https://github.com/xreef/alexa-skill-manage-relay-nodejs/raw/main/setup-template.txt

and rename in setup.txt.

The file should contain:

[Login with Amazon Client ID]
amzn1.application-oa2-client.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[Login with Amazon Client Secret]
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[Alexa Skill Application ID]
amzn1.ask.skill.XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

[AWS Lambda ARN]
arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:skill-sample-language-smarthome-switch

[Redirect URLs]
https://pitangui.amazon.com/api/skill/link/XXXXXXXXXXXXXX
https://layla.amazon.com/api/skill/link/XXXXXXXXXXXXXX
https://alexa.amazon.co.jp/api/skill/link/XXXXXXXXXXXXXX

[DynamoDB table]
XXXXXXX

[Device end point]
XXXXXXXX

Install Optional Tools

The use of these tools is optional as they are useful, but not required.

NodeJS

You can directly write code on AWS, but It’s better if you download NodeJS.

Git

Git 2.0 or greater is required only if you want to clone the source code locally. At a command line, you can verify if git is installed by running the command:

git --version

If it is not properly installed or is not a version greater than 2.0, visit https://git-scm.com/downloads to download and install a version for your platform.

Alexa Skills Kit Command Line Interface (ASK CLI)

This ASK CLI can be used to create, deploy, and maintain a Alexa skills. If you have the ASK CLI installed already you can can verify its version by running the command:

ask --version

For the purposes of this sample, the ask version should be 1.3.1 or greater.

Get the Source Code via Git

If you have git installed on your workstation, you can use the following instructions to pull the source code into your working directory.

  1. From the command-line, navigate into the working directory on your desktop: alexa-skill-manage-relay-nodejs
  2. Run the following command to pull the source code to a working directory:
git clone https://github.com/xreef/alexa-skill-manage-relay-nodejs.git

Get the Source Code via Download

If you do not have git installed, download and unzip the zipped contents of the sample from https://github.com/xreef/alexa-skill-manage-relay-nodejs/archive/master.zip into your desktop working directory: alexa-skill-manage-relay-nodejs.

Thanks

  1. AWS Alexa Smart Home Skill: introduction and startup
  2. AWS Alexa Smart Home Skill: create the skill manage the security
  3. AWS Alexa Smart Home Skill: create lambda and manage security
  4. AWS Alexa Smart Home Skill: configure lambda for the skill
  5. AWS Alexa Smart Home Skill: setup the DynamoDB database
  6. AWS Alexa Smart Home Skill: load sample code and test Lambda
  7. AWS Alexa Smart Home Skill: test your skill in dev and manage log

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *