avic - ivativ · 2020-02-04 · introduce how to connect amazon services (including amazon alexa,...

49
AVIC AWS Application Note Version 0.5 AVIC 802.11 b/g/n + BT 4.1 LGA Wireless Module

Upload: others

Post on 11-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

AVIC AWS Application Note Version 0.5

AVIC 802.11 b/g/n + BT 4.1 LGA Wireless Module

Page 2: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 1 of 48

December 18, 2019

Table of Contents

Contents

1 Overview ........................................................................................ 4 1.1 AWS LED Control Demo Requirements ....................................................................................... 4 1.2 Application Scenerio ..................................................................................................................... 4

2 Amazon Alexa Custom Skill Setup ....................................................... 5 2.1 Introduction .................................................................................................................................... 5

3 Create Alexa Skill ................................................................................... 6 3.1 AWS Lambda .............................................................................................................................. 14

4 AWS IoT Thing Creation ...................................................................... 37 4.1 AWS Management Console ........................................................................................................ 37

Page 3: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 2 of 48

December 18, 2019

Table of Figures Figure 1: AWS IoT................................................................................................................................................... 4 Figure 2: Amazon Developer Account .................................................................................................................... 6 Figure 3: Alexa Skill Kit ........................................................................................................................................... 6 Figure 4: Start Alexa Skill ....................................................................................................................................... 7 Figure 5: Create Skill .............................................................................................................................................. 7 Figure 6: Create Custom Skill ................................................................................................................................. 8 Figure 7: Create Custom Skill ................................................................................................................................. 8 Figure 8: Add Slot Type .......................................................................................................................................... 9 Figure 9: Create Custom Slot Type ......................................................................................................................... 9 Figure 10: Slot Type Value.................................................................................................................................... 10 Figure 11: Skill Home ........................................................................................................................................... 10 Figure 12: Skill Invocation Name .......................................................................................................................... 11 Figure 13: Create Custom Intent .......................................................................................................................... 12 Figure 14: Sample Utterances .............................................................................................................................. 13 Figure 15: Endpoint .............................................................................................................................................. 13 Figure 16: AWS Lambda Sign In Page ................................................................................................................... 14 Figure 17: AWS Lambda Service ........................................................................................................................... 15 Figure 18: Create a function for Lambda .............................................................................................................. 15 Figure 19: Blueprints ............................................................................................................................................ 16 Figure 20: IAM Permissions .................................................................................................................................. 17 Figure 21: Create Policy ....................................................................................................................................... 17 Figure 22: JSON Script Entry ................................................................................................................................. 18 Figure 23: IAM Role Name ................................................................................................................................... 19 Figure 24: IAM Role Created ................................................................................................................................ 19 Figure 25: Skill ID ................................................................................................................................................. 20 Figure 26: Copy Skill ID......................................................................................................................................... 21 Figure 27: Configure Skill ID ................................................................................................................................. 21 Figure 28: Lambda Function Home Page .............................................................................................................. 22 Figure 29: Copy ARN link ...................................................................................................................................... 23 Figure 30: Node.js version.................................................................................................................................... 23 Figure 31: Configuration ...................................................................................................................................... 24 Figure 32: Code Editor .......................................................................................................................................... 25 Figure 33: Save Script ........................................................................................................................................... 31 Figure 34: Configure Event ................................................................................................................................... 31 Figure 35: Test Script ........................................................................................................................................... 32 Figure 36: Test Result ........................................................................................................................................... 33 Figure 37: Endpoint .............................................................................................................................................. 34 Figure 38: Endpoint Configuration ....................................................................................................................... 35 Figure 39: Testing................................................................................................................................................. 35 Figure 40: AWS IoT Home Page ............................................................................................................................ 37 Figure 41: AWS IoT Home Page ............................................................................................................................ 37 Figure 42: AWS IoT Getting Started ...................................................................................................................... 38 Figure 43: AWS IoT Create Policy ......................................................................................................................... 39 Figure 44: AWS IoT Create Policy Name ............................................................................................................... 39 Figure 45: AWS IoT Register Thing ....................................................................................................................... 40 Figure 46: AWS IoT Create Certificate .................................................................................................................. 41 Figure 47: AWS IoT Download Certificates ........................................................................................................... 41 Figure 48: AWS IoT Attach Policy ......................................................................................................................... 42

Page 4: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 3 of 48

December 18, 2019

Figure 49: AWS IoT Endpoint ............................................................................................................................... 42 Figure 50: AWS IoT Thing ..................................................................................................................................... 43 Figure 50: AWS IoT Thing Details ......................................................................................................................... 43 Figure 52: AWS IoT Shadow ................................................................................................................................. 45

Table of Tables

No table of figures entries found.

Page 5: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 4 of 48

December 18, 2019

1 Overview

Alexa is a Amazon's cloud voice service that allow developers to voice-control connected Amazon

services. An example application is Amazon Echo, which is a voice-control assistant. When users speak

to Amazon Echo, it analyzes the received voice and makes appropriate response. In this example, we

introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM)

and use Alexa to control LED on iVativ.

1.1 AWS LED Control Demo Requirements

1. iVativ WiFi Module Evaluation Kit x 1 2. AWS Account 3. AWD Developer Account

1.2 Application Scenerio

At first, we summarize the usage scenario in this example.

1. When a user says "Turn on the light" to the test device (which supports Amazon Alexa), Alexa analyzes the voice command according to the schema and sample utterances file (provided by user beforehand), and generates intent json.

2. Alexa submit the intent json to AWS Lambda. According to the intent, Lambda service then sends update message to AWS IoT Shadow service.

3. AWS IoT Shadow service updates shadow state according to the update message from Lambda service.

If iVativ EVK is online and has subscribed the shadow service, iVativ turns on the LED. Then Lambda generates the text and voice response message and send to Alexa.

4. Finally, the user can hear the voice message to indicate the LED has been successfully turned on.

Figure 1: AWS IoT

Page 6: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 5 of 48

December 18, 2019

2 Amazon Alexa Custom Skill Setup

In order to use Amazon Lambda to access other services, we need the AWS IAM service to manage

access permission. In following sections we will introduce each AWS services and required setup

procedure.

2.1 Introduction

Alexa Skills Kit (ASK) is a voice-driven service. It can be connected to cloud services and user can voice-

control the connected services and receive voice response. The voice analysis feature provided by Alexa

is ready-to-use, makes the developers can focus on the design of the cloud service and the user

interaction model.

Alexa provides two types of services:

Custom Skills: developers can custom design the required interaction model, including conversation

flow, analysis keyword, then send intent.

Smart Home Skills: Alternatively, developers can use the smart home models provided by Alexa, and

send intent. Taking the design flexibility into account, we use custom skills in this example.

Further description is provided in Amazon official document:

https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/understanding-the-

different-types-of-skills

The AVIC board provides an 14 pin JTAG connector at JP1. Pin 1 is closest to micro-USB connector.

Connect the yellow wire to pin 1

Connect the green wire to pin 3

Connect the orange wire to pin 5

Connect the black wire to pin 6

Connect the purple wire to pin 9

Connect the brown wire to pin 10

Move the jumper from J11 pins 2&3 to J11 pins1&2

While using the JTAG debugger, the board can be powered by a USB cable connected to J7 USB

connector.

Page 7: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 6 of 48

December 18, 2019

3 Create Alexa Skill

First, in Alexa webpage click Sign In. The account can be different with the Amazon AWS account

https://developer.amazon.com/alexa

Figure 2: Amazon Developer Account

Click Alex Skill kit > Get Started > Alex Skills Kit (Make Alexa smarter with our toolkit)

Figure 3: Alexa Skill Kit

Page 8: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 7 of 48

December 18, 2019

Go to Alexa Skill Kit page and click ”Start a Skill”

Figure 4: Start Alexa Skill

Click ”Create Skill” on the bottom

Figure 5: Create Skill

Page 9: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 8 of 48

December 18, 2019

Fill in ”iVativLightControll” in skill name field, Select default language “English(US)”, Choose a

model to add to your skill “Custom”, then click on “Create Skill” button.

Figure 6: Create Custom Skill

Choose a template “Start from scratch” then click on “Choose”.

Figure 7: Create Custom Skill

Go to next page, and click “add” on Slot Type on the left

Page 10: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 9 of 48

December 18, 2019

Figure 8: Add Slot Type

Go to Add Slot Type page, fill in “LED_STATE” in Create custom slot type field. Click “Create

custom slot type”. Go to next page, and click “add” on Slot Type on the left.

Figure 9: Create Custom Slot Type

Go to added Slot Types page, fill in “on” and “off” in Slot Values field and click “+”.

Page 11: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 10 of 48

December 18, 2019

Figure 10: Slot Type Value

Click on “Save Model”, go to previous Skill home page, click ”Invocation Name” of Skill builder

checklist on the right.

Figure 11: Skill Home

Page 12: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 11 of 48

December 18, 2019

Fill in ”iVativ controller” in ”Skill Invocation Name” field. This name lets Alexa recognize the

session to start. Generally, there are two ways to start Alexa session. The first one is to speak

complete content to make Alexa analyze the interaction model to decide which session to

launch.

The second one is to speak only Invocation Name to make Alexa start certain session. We fill in

“iVativ Controller” in this example.

Need to avoid Alexa keywords and the words that may cause misjudgment for Invocation Name.

Please refer to the detailed restrictions:

https://developer.amazon.com/zh/docs/custom-skills/choose-the-invocation-name-for-a-

custom-skill.html

Figure 12: Skill Invocation Name

Go back to Skill home page and click “Intents, Samples, and Slots” of Skill builder checklist.

In Add intent field, fill in ControlLed in Create custom intent field and click “Create custom

intent”.

Page 13: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 12 of 48

December 18, 2019

Figure 13: Create Custom Intent

Fill in Sample Utterances, this one means that when the user said something can trigger certain

intent.

ControlLed Turn {LedState} the light ControlLed Turn the light {LedState}

The format is intent name in the front and followed by space or tab, and then the users

sentence.

For example, user speaks of “Turn on the light” that would trigger ControlLed intent. Then

choose LED_STATE under Slot Type and click “Save Model”.

Page 14: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 13 of 48

December 18, 2019

Figure 14: Sample Utterances

Go back to Skill Home Page. The Endpoint option below needs to fill in the Endpoint with Alexa.

Figure 15: Endpoint

When users trigger Alexa intent, Alexa will transfer the intent to other services. Users can set up

its own server, or using Amazon AWS Lambda. The example will show how to set AWS Lambda.

Page 15: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 14 of 48

December 18, 2019

3.1 AWS Lambda

Amazon AWS Lambda is a computation service. The supported programming language includes Node.js,

Python, and java. Lambda allows users to configure the resources required by computation (such as

memory, computation time...). Open AWS Lambda in a new tab. https://aws.amazon.com/lambda/.

Click "Sign in to the Console".

Figure 16: AWS Lambda Sign In Page

Then, you will enter the Amazon Web Services page. Since currently the service connection of

Alexa and Lambda is only provided in us-east-1 region, click upper-right drop-down list to switch

region to "US East (N. Virginia)".

Find Service “Lambda”, then click "Lambda" in the services list.

Page 16: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 15 of 48

December 18, 2019

Figure 17: AWS Lambda Service

Click "Create a Function"

Figure 18: Create a function for Lambda

Page 17: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 16 of 48

December 18, 2019

Lambda has predefined a number of usage scenarios with sample code and default setting. To

connect Alexa and Lambda, fill in "Alexa" in the filter.

Figure 19: Blueprints

Then the blueprints related to Alexa are shown. "alexa-skills-kit-color-expert" and "alexa-skills-

kit-color-export-python" are similar blueprint, the difference is “alexa-skills-kit-color-expert”

using JavaScript and “alexa-skills-kit-color-export-python” using python, and choose “alexa-

skills-kit-color-expert” in the example and click “configure”.

Go to alexa-skills-kit-color-expert setting page, fill in “ControlLed” in name field to recognize this

Lambda function and choose “Create a custom role”.

The setting of "Role" is related to the permissions of Lambda. In order to prevent the Lambda

function from using the service that should not be used, we can set the permissions of the

Lambda function. This part of the service comes from AWS IAM, but we can set it directly here.

Select “AWS Service” and then “Lambda” then Click on “Next: Permissions”.

Page 18: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 17 of 48

December 18, 2019

Figure 20: IAM Permissions

Click on “Create Policy”

Figure 21: Create Policy

Page 19: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 18 of 48

December 18, 2019

Click on “JSON” tab and enter the following Json script

Figure 22: JSON Script Entry

{

"Version": "2012-10-17",

"Statement": [

{

"Effect": "Allow",

"Action": [

"logs:CreateLogGroup",

"logs:CreateLogStream",

"logs:PutLogEvents"

],

"Resource": "arn:aws:logs:*:*:*"

},

{

"Effect": "Allow",

"Action": [

"iot:*"

],

"Resource": "arn:aws:iot:*:*:*"

}

]

}

Click on “Review Policy” which is there on bottom side of the page.

Page 20: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 19 of 48

December 18, 2019

In the AWS IAM settings page that Lambda brought out, we set the “Role Name” to

“control_led”.

Figure 23: IAM Role Name

Click on “Create Policy”.

Figure 24: IAM Role Created

Page 21: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 20 of 48

December 18, 2019

Then Close the page and jump to the previous Lambda function setting page.

After setting a new Role and returning from AWS IAM, you can see that the fields for "Role" and

"Existing Role" already have values.

Then, at the bottom of the page, select “Enable” in the kill ID verification field, and there is also

the skill ID part. We will introduce how to get the Skill ID in the next chapter.

Then we have to go back to Alexa Skill's homepage. We can see that a set of words has

appeared below the Skill Name field. This is the SKILL ID we need. Clicking on it will

automatically copy and return to the previous step. SKILL ID field is filled in with SKILL ID

Figure 25: Skill ID

Click on View Skill ID, and then copy the Skill ID which appears in the pop-up window.

Page 22: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 21 of 48

December 18, 2019

Figure 26: Copy Skill ID

Go to Skill ID verification and then select “Enable” radio button.

Paste the copied Skill ID into Skill ID field.

Figure 27: Configure Skill ID

After the Kill ID is set, then pull the page to the bottom, and click “Create function”.

Go to the Function Home Page

Page 23: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 22 of 48

December 18, 2019

Figure 28: Lambda Function Home Page

Note that in the upper right corner of the Function Home Page there is a set of strings "

arn:aws:lambda:us-east-1:619183757185:function:ControlLed", which is the end point of this

Lambda function, which will be used to fill in Alexa Settings page

Page 24: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 23 of 48

December 18, 2019

Figure 29: Copy ARN link

Select "Edit code inline", "Node.js 4.3" and "index.handler" in the "Function code" field.

Figure 30: Node.js version

Page 25: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 24 of 48

December 18, 2019

Go to the bottom of the page, type "3" sec in the Timeout field, and select "No VPC" in the

Network field, then click the Save button in the upper right corner. Here we pause the AWS

Lambda settings, we will come back to edit the code.

Figure 31: Configuration

Open new tab and please refer to Section 4 of this document to set up AWS IoT Shadow. Note

that we should change region to us-east-1 due to the limitation of Alexa.

Pull up page to the code editor below

Page 26: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 25 of 48

December 18, 2019

Figure 32: Code Editor

Then copy following code into node.js editor in the above picture and modify the following code

according to the Alexa skill created previously.

/**

* This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit.

* The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well as

* testing instructions are located at http://amzn.to/1LzFrj6

*

* For additional samples, visit the Alexa Skills Kit Getting Started guide at

* http://amzn.to/1LGWsLG

*/

var AWS = require('aws-sdk');

AWS.config.region = "us-east-1";

var iotData = new AWS.IotData({endpoint: "a24vfh59tkddl2-ats.iot.us-east-1.amazonaws.com"});

// Route the incoming request based on type (LaunchRequest, IntentRequest, // etc.) The JSON body of the request is provided in the event parameter.

exports.handler = function (event, context) {

Page 27: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 26 of 48

December 18, 2019

try {

console.log("event.session.application.applicationId=" + event.session.application.applicationId);

/**

* Uncomment this if statement and populate with your skill's application ID to

* prevent someone else from configuring a skill that sends requests to this function.

*/

/*

if (event.session.application.applicationId !== "amzn1.echo-sdk-ams.app.[unique-value-here]") {

context.fail("Invalid Application ID");

}

*/

if (event.session.new) {

onSessionStarted({requestId: event.request.requestId}, event.session);

}

if (event.request.type === "LaunchRequest") {

onLaunch(event.request,

event.session,

function callback(sessionAttributes, speechletResponse) {

context.succeed(buildResponse(sessionAttributes, speechletResponse));

});

} else if (event.request.type === "IntentRequest") {

onIntent(event.request,

event.session,

function callback(sessionAttributes, speechletResponse) {

context.succeed(buildResponse(sessionAttributes, speechletResponse));

});

} else if (event.request.type === "SessionEndedRequest") {

onSessionEnded(event.request, event.session);

context.succeed();

}

} catch (e) {

context.fail("Exception: " + e);

}

};

/**

* Called when the session starts.

*/

Page 28: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 27 of 48

December 18, 2019

function onSessionStarted(sessionStartedRequest, session) {

console.log("onSessionStarted requestId=" + sessionStartedRequest.requestId +

", sessionId=" + session.sessionId);

}

/**

* Called when the user launches the skill without specifying what they want.

*/

function onLaunch(launchRequest, session, callback) {

console.log("onLaunch requestId=" + launchRequest.requestId +

", sessionId=" + session.sessionId);

// Dispatch to your skill's launch.

getWelcomeResponse(callback);

}

/**

* Called when the user specifies an intent for this skill.

*/

function onIntent(intentRequest, session, callback) {

console.log("onIntent requestId=" + intentRequest.requestId +

", sessionId=" + session.sessionId);

var intent = intentRequest.intent,

intentName = intentRequest.intent.name;

// Dispatch to your skill's intent handlers

if ("ControlLed" === intentName) {

setLightInSession(intent, session, callback);

} else if ("AMAZON.HelpIntent" === intentName) {

getWelcomeResponse(callback);

} else if ("AMAZON.StopIntent" === intentName || "AMAZON.CancelIntent" === intentName) {

handleSessionEndRequest(callback);

} else {

throw "Invalid intent";

}

}

/**

* Called when the user ends the session.

* Is not called when the skill returns shouldEndSession=true.

*/

function onSessionEnded(sessionEndedRequest, session) {

console.log("onSessionEnded requestId=" + sessionEndedRequest.requestId +

", sessionId=" + session.sessionId);

Page 29: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 28 of 48

December 18, 2019

// Add cleanup logic here

}

// --------------- Functions that control the skill's behavior -----------------------

function getWelcomeResponse(callback) {

// If we wanted to initialize the session to have some attributes we could add those here.

var sessionAttributes = {};

var cardTitle = "Welcome";

var speechOutput = "Welcome to the ivativ led Controller example. " +

"Please tell me next action by saying, turn on the light";

// If the user either does not reply to the welcome message or says something that is not

// understood, they will be prompted again with this text.

var repromptText = "Please tell me next action by saying, turn on the light";

var shouldEndSession = false;

callback(sessionAttributes,

buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));

}

function handleSessionEndRequest(callback) {

var cardTitle = "Session Ended";

var speechOutput = "Thank you for trying the iVativ Controller example. Have a nice day!";

// Setting this to true ends the session and exits the skill.

var shouldEndSession = true;

callback({}, buildSpeechletResponse(cardTitle, speechOutput, null, shouldEndSession));

}

/**

* Sets the led in the session and prepares the speech to reply to the user.

*/

function setLightInSession(intent, session, callback) {

var cardTitle = intent.name;

var lightStateRequest = intent.slots.LedState;

var repromptText = "";

var sessionAttributes = {};

var shouldEndSession = true;

var speechOutput = "";

Page 30: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 29 of 48

December 18, 2019

if (lightStateRequest) {

var lightState = lightStateRequest.value;

var paramsUpdate;

if (lightState === "on") {

paramsUpdate = {

"thingName" : "iVativ_led",

"payload" : '{"state": {"desired": {"led":1}}}'

};

} else {

paramsUpdate = {

"thingName" : "iVativ_led",

"payload" : '{"state": {"desired": {"led":0}}}'

};

}

//Update Device Shadow

iotData.updateThingShadow(paramsUpdate, function(err, data) {

if (err){

console.log(err, err.stack);

speechOutput = "fail to update thing shadow";

repromptText = "fail to update thing shadow";

callback(sessionAttributes,buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));

}

else {

console.log(data);

sessionAttributes = createLightStateAttributes(lightState);

speechOutput = "I now know you want to turn " + lightState + " the light";

repromptText = "I now know you want to turn " + lightState + " the light";

callback(sessionAttributes,buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));

}

});

} else {

speechOutput = "Please try again";

repromptText = "Please try again";

callback(sessionAttributes,buildSpeechletResponse(cardTitle, speechOutput, repromptText, shouldEndSession));

}

}

Page 31: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 30 of 48

December 18, 2019

function createLightStateAttributes(lightState) {

return {

lightState: lightState

};

}

// --------------- Helpers that build all of the responses -----------------------

function buildSpeechletResponse(title, output, repromptText, shouldEndSession) {

return {

outputSpeech: {

type: "PlainText",

text: output

},

card: {

type: "Simple",

title: "SessionSpeechlet - " + title,

content: "SessionSpeechlet - " + output

},

reprompt: {

outputSpeech: {

type: "PlainText",

text: repromptText

}

},

shouldEndSession: shouldEndSession

};

}

function buildResponse(sessionAttributes, speechletResponse) {

return {

version: "1.0",

sessionAttributes: sessionAttributes,

response: speechletResponse

};

}

Then confirm and click "Save".

Page 32: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 31 of 48

December 18, 2019

Figure 33: Save Script

Click on Save and Choose "Configure test event" to configure events for testing, then click on

Test

Figure 34: Configure Event

Pop up the window.

This part is to set the test event, this means we can simulate the event from Alexa, and the

information carried by the event, we fill in the content as follows, the modification related to

this example has intent name, slot name & value. Paste the following code into the code editor

and fill in the "testled" at the Event Name, then click on "Create".

Page 33: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 32 of 48

December 18, 2019

Figure 35: Test Script

{

"session": {

"new": false,

"sessionId": "session1234",

"attributes": {},

"user": {

"userId": null

},

"application": {

"applicationId": "amzn1.echo-sdk-ams.app.[unique-value-here]"

}

},

"version": "1.0",

"request": {

"intent": {

"slots": {

"LightState": {

"name": "LedState",

"value": "on"

}

},

"name": "ControlLed"

Page 34: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 33 of 48

December 18, 2019

},

"type": "IntentRequest",

"requestId": "request5678"

}

}

Go back to the previous page, select the light event you just created at the top, and click "Test”.

The result and log of the execution will appear below. In the Execution result, the message in

the output Speech of the response will be "I now know you want to turn on the light". This text

will be expected to allow Alexa to respond in a voice. Below is the log, if the writer is in trouble

and needs to add log, you can see the log during execution here.

Figure 36: Test Result

Go to the AWS IoT page, click thing iVativ, and in the information bar on the right, you will see

"Last update". There will be a recent update that represents AWS Lambda to AWS IoT.

Go back to the Amazon Alexa Skill homepage, this time we're going to set up the Endpoint, click

on the bottom right. 4. Endpoint.

Page 35: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 34 of 48

December 18, 2019

Figure 37: Endpoint

Then go to the Edit Endpoint page, select "AWS Lambda ARN" as Service Endpoint Type, and

paste the ARN string you just got, " arn:aws:lambda:us-east-

1:619183757185:function:ControlLed " Default region field, please fill in the corresponding

value according to the endpoint of the Lambda function you created (note that this endpoint is

not the REST API endpoint of the thing in the AWS IoT, but the content of the ARN in the upper

right corner of the Lumbda function), and Click on "Save Endpoint"

Page 36: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 35 of 48

December 18, 2019

Figure 38: Endpoint Configuration

In Test page, we can conduct some basic test.

Figure 39: Testing

Start the skill by typing "ivativ led controller" on the left. We can test the voice data received by

Alexa about how will it be pronounced. It uses SSML tags to let Alexa make a specific voice like

spelling hello, click on the play button to listen to the results of the voice.

Page 37: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 36 of 48

December 18, 2019

The text here is also the output Speech content of Lambda's return, so we can have more

flexibility in Lambda's return voice message.

We can fill in the voice message sent by the user, and let Alexa pretend to hear the message for

the corresponding processing, then enter "Turn on the led" to control the light on.

Page 38: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 37 of 48

December 18, 2019

4 AWS IoT Thing Creation

AWS IoT is a platform that enables you to connect devices to AWS Services and other devices, secure

data and interactions, process and act upon device data, and enable applications to interact with

devices even when they are offline.(from https://aws.amazon.com/iot/how-it-works/) The service

architecture of AWS IoT:

Figure 40: AWS IoT Home Page

4.1 AWS Management Console

First, create an account and sign up for AWS IoT service: https://aws.amazon.com/

Log in to the Amazon Management Console and click "IoT Core"

Figure 41: AWS IoT Home Page

Page 39: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 38 of 48

December 18, 2019

Then you will enter the home page of AWS IoT. To offer the best service quality, Amazon offers

servers in different regions for users to choose from. Click the region dropdown menu at the

upper-right:

Figure 42: AWS IoT Getting Started

Choose a nearby region.

In the next welcome screen, click “Get started” to get to the main dashboard. Then, click on

Secure, then on Policies. In there, click on the “Create a policy”.

Page 40: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 39 of 48

December 18, 2019

Figure 43: AWS IoT Create Policy

Type in a name for your policy, and then ensure that the following policy statements are

configured: Action: iot:* Resource ARN: *

Effect: Allow

The policy settings should look like in the following figure. Then, click on "Create".

Figure 44: AWS IoT Create Policy Name

Page 41: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 40 of 48

December 18, 2019

Next, click on “Manage” then “Things” to access the things hub. Click on “Show me later” to

dismiss the intro message. Then, click on “Register a thing”, then “Create a single thing” to

create your ivativ_led thing, as shown in following figure.

Figure 45: AWS IoT Register Thing

In the next menu (Following figure), type in a name for your thing, and then click on next. Then,

click on “Create Certificate” to create the certificate pair to be associated with your thing. Note

down the name of your thing, as it will be needed in later setup steps.

Page 42: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 41 of 48

December 18, 2019

Figure 46: AWS IoT Create Certificate

Download the certificate file, the public and private key, as well as the root CA for AWS IoT (the

Verisign Class 3 root CA certificate). Then, click on Activate, and then finally on “Attach a Policy”.

Figure 47: AWS IoT Download Certificates

Select the policy that you just created, and then click “Register Thing”. At this point, your thing

should be fully setup on the cloud, ready for use the ivativ_led thing on AWS IoT.

Page 43: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 42 of 48

December 18, 2019

Figure 48: AWS IoT Attach Policy

Before leaving AWS IoT, click on “Test”, then after your PC connects to AWS using the in-

browser MQTT client, dismiss the green message box in the upper right. Then click on the

“Connected as iotconsole-…” message, then on “view endpoint”. In the pane that pops up, copy

the URL in the Endpoint text box, and note it for use later (Example: a24vfh59tkddl2-ats.iot.us-

east-1.amazonaws.com )

Figure 49: AWS IoT Endpoint

Page 44: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 43 of 48

December 18, 2019

Choose Secure-> Certificate and select the certificate and then click, then "Attach policy" in the

"Actions" dropdown menu.

"Attach thing" in the "Actions" dropdown menu.

"Activate" in the "Actions" dropdown menu.

Go back to the filed on the left, choose ”Manage->Things”.

Figure 50: AWS IoT Thing

Click “ivativ_led” thing we created

Figure 51: AWS IoT Thing Details

Page 45: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 44 of 48

December 18, 2019

Enter iVativ thing page, choose “Interact” on the left. Find out the information of Rest API

Endpoint to set Amazon Alexa:-- REST API endpoint: In the value “https:// a24vfh59tkddl2-

ats.iot.us-east-1.amazonaws.com/things/ivativ_led/shadow”, the part “a24vfh59tkddl2-

ats.iot.us-east-1.amazonaws.com” is the MQTT Broker server address.

-- MQTT topic:The value "$aws/things/ivativ_led/shadow/update" represents the MQTT topic

we will use in the AWS IoT Shadow service (if we use MQTT only, without AWS IoT Shadow

service, then we can specify other topic name). It is recommended to use

"$aws/things/ivativ_led/shadow/update" here.

Program the thing hardware flash with iVativ AWS_demo.bin, Refer MIST Programmers

reference manual for flash programming.

Copy certificates to Linux PC , /target/tools/linux/

Note down IP address of the linux PC with is connect to local Access Point (use ifconfig)

Start certificate service ./certs -s

Power ON iVativ MIST EVK

Connect EVK “USB-UART” port and PC with micro USB connector cable

Open Windows device manager->Ports(COM & LPT), and identify the COM number of the iVativ

board Virtual COM.

Open Putty, and enter COM port number and baudrate 115200, then connect to board

Issue the following commands

1. wmiconfig --p ivativ123$<CR><LF> 2. wmiconfig --wpa 2 TKIP TKIP<CR><LF> ( Here user can change the options refer API Guide) 3. wmiconfig --connect iVativ<CR><LF> 4. wmiconfig --ipdhcp<CR><LF> 5. wmiconfig --ip_dns_client start<CR><LF>

6. getcert mist.cert.bin 192.168.1.27 -s testcert<CR><LF> (here 192.168.1.27 is Linux PC IP) Note: here mist.cert.bin is certificates parsed by SharkSSLParseCert.exe in windows.

Use the certificates downloaded from Amazon AWS.

7. wmiconfig --ssl_start client<CR><LF> 8. wmiconfig --ssl_config client 1 protocol TLS1.2 time 1 alert 1<CR><LF> 9. wmiconfig --ssl_add_cert client 1 certificate testcert<CR><LF> 10. wmiconfig --aws shadow a24vfh59tkddl2-ats.iot.us-east-1.amazonaws.com 8883

ivativ_led testcert<CR><LF>

ivativ_led thing will publish its current status using topic:

"$aws/things/ivativ_led/shadow/update", with payload in AWS IoT Shadow JSON format

(ref. http://docs.aws.amazon.com/iot/latest/developerguide/thing-shadow-document-

syntax.html).

Page 46: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 45 of 48

December 18, 2019

In this example, ivativ_led has only one attribute, that is led (as we created in AWS IoT Console).

In the payload we publish "led" state 1 to light the led.

Now, check the thing information of "iVativ" shown in the page we add iVativ thing after click

the “Shadow”. The information of iVativ thing is updated and the “Last update” shows the last

few minutes.

You should see the published message in "Shadow”

Figure 52: AWS IoT Shadow

Now we try to turn off the led. Click “Edit”.Then you can see a "Shadow state" text field with

default content. Modify the content.

{ "desired": { "led": 0 } }

It means that we want to change the status of “led” to 0, and click “Save”

Page 47: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 46 of 48

December 18, 2019

5 Demo with AWS Console and Google Home App

This demo is intended to monitor the Temperature and Humidity values, also control the Light on the

cloud applications such as Smart Things and Google Home.

The board will connect to a fixed WiFi Access Point. Configure the AP with the following details:

SSID: iVativAP

Password: ivativ1234

Security: WPA2 Personal TKIP+AES

5.1 Demo with Smart Things Android Application

The “Smart Things” App is available in the SDK with the extension .apk and the user can also download

the App at the following link:

https://1drv.ms/u/s!At0TJXng2Gt6gpgJNKeao9WFLqttmQ?e=W3hU7T

Install the APK and accept any permission required. After the installation, open the App and Login with

the credentials (Mobile, Password).

Mobile: 8420000009

Password: Passwxyz

After App-login, user can control the LED/Light on the EVK and also monitor the Temperature and

Humidity Values which will be updated every second.

Page 48: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 47 of 48

December 18, 2019

5.2 Demo with Google Home Android Application

From Google Home application, we can control EVK’s LED status and monitor the Temperature and the

Humidity on the EVK.

5.2.1 Device Access from Google Home or Google Voice Assistant

1. Install the Google Home App 2. Select/Login with a Google Account in the Google Home App 3. Need to share the Gmail account to enable for testing (I only can do this) 4. Login to action console with the same gmail account: https://console.actions.google.com and

select My Smart Thing project. 5. After that, select Build Your Action and click on Test Actions in Simulator. 6. Then, Click on the Start Testing button on the left panel. 7. Open Google Home App and select Get Started/Add Device 8. Select Setup a device / Have Something already setup? 9. Select skill [test] Smart Home Skill 10. Login with this details:

Mobile: +918000000009

Password: Passwxyz

Page 49: AVIC - Ivativ · 2020-02-04 · introduce how to connect Amazon services (including Amazon Alexa, AWS Lambda, AWS IoT, AWS IAM) and use Alexa to control LED on iVativ. 1.1 AWS LED

App Note

6141 Running Springs Rd

San Jose, CA 95135

www.ivativ.com

Email: [email protected]

Ph: (408) 893 7812

Page 48 of 48

December 18, 2019

11. Click login and you will see a device name Light on the Google Home Screen. 12. Give the following voice/type commands to control the EVK:

Say “Ok Google, What is the temperature in Bedroom”., to which it replies with the temperature and Light status.

Say “Ok Google, What is the Humidity in Bedroom”., to which it replies with the Humidity and Light status.

Say “Ok Google, Switch OFF the light” or “Ok Google, Switch ON the Light” to control the LED on the EVK.