Skip to content

Latest commit

 

History

History
139 lines (81 loc) · 5.41 KB

lab3.md

File metadata and controls

139 lines (81 loc) · 5.41 KB

alt text

Lab 3 : Command and Control Alexa enabled IoT device(s)

In this lab, you will learn how to perform command and control on Alexa enabled IoT devices. You will create a custom skill and a lambda function that will interact with the device state (shadow) in AWS IoT Core. At the end of this lab, you will be able to turn the device led on / off using voice commands.

You will build step 1b of this architecture :

alt text

A. Configure Lambda functions for interacting with Alexa skills

Please login to the AWS Lambda Console and select Applications (on the left pane) -> reinventavsmqtt* application.

alt text

  1. Under Resources section, please select the Lambda function with Logical ID "DeviceShadowLambda"

    alt text

  2. Click the Select a test event dropdown (top right corner) -> Choose Configure test events.

    alt text

    • A window will appear, keep everything default, put the Event name as test , click Create button
    • This will configure the test event and bring you back to the lambda console
  3. Click on Test (top right corner) , check if the Execution Result is a success

    • If it fails, check the logs to identify the problem. Ask support staff for help if you need.

If step 3 is a success, proceed to validate if the shadow is updated for the thing.

Please navigate to the AWS IoT Console and select Manage (on the left pane) -> Things
  1. On the right pane , you will see the NxP device

    alt text

  2. Please click on it and choose Shadow (on the left). You will see the status of the device here :

    alt text

Please navigate back to the AWS Lambda Console and select Applications (on the left pane) -> reinventavsmqtt* application.
  1. Under Resources section, please select the Lambda function with Logical ID "AlexaSkillProcessorLambda"

    • Check "Alexa Skills Kit" is added as a trigger
    • Copy the ARN of this lambda from the top left corner and paste it in a local notepad.

    alt text

    We will use this when configuring the Alexa endpoint later in this lab.

B. Create Alexa skill

Log into the Alexa developer console with your Amazon Developer account.

  1. Create Skill

    alt text

    Click Create Skill on the right-hand side of the console. A new page displays.

    • Skill name - nursery
    • Default language - English (US)
    • Choose a model to add to your skill - Custom
    • Choose a method to host your skill's backend resources - Provision your own
    • Click on Create Skill button on the top right corner.
  2. Choose a template

    Choose "Start from scratch" and click on "Choose" button on the top right corner.

    alt text

  3. Create Interaction Schema

    • Open the Skill Schema definition json file.
    • On the left pane, click on "JSON Editor" option from the "Interaction Model" section.
    • Copy the contents of the skill.json file and click on "Save Model".

    alt text

  4. Configure the Endpoint

    • On the left Pane, click on "Endpoint" section.
    • Choose "AWS Lambda ARN" option.
    • Paste the "AlexaSkillProcessorLambda" lambda ARN copied in Section A - step 6.
    • Click on "Save Endpoints".

    alt text

  5. Build Model

    • Click on the "Invocation" option from the "Interaction Model" section.
    • Click "Save Model".
    • Click "Build Model".

    alt text

C. Test the custom Alexa skill

  1. Test the Skill from the Simulator

    • Navigate to the "Test" section on the header.

    • When there is a pop-up asking for Microphone access, please select "Allow".

    • Change the "Test is disabled for this skill" to "development".

      alt text

    • On the left pane, try the below commands.

      • "Ask re invent crib status"
        • this should return the state of the shadow of your nxp device.
      • "Ask re invent set crib speed LOW"
        • this should update the desired state of the crib speed to "LOW".
  2. Test the skill from the NxP Hardware now

    • Unmute the microphone on the kit (press SW1) if muted

      • red led on the board indicates the microphone is muted

      alt text

    • Try the below commands

      • say "Alexa open re invent"

      • "crib status"

        • this should return the state of the shadow of your nxp device.
      • say "Alexa open re invent"

      • "set crib speed HIGH"

        • this should update the desired state of the crib speed to "HIGH".

Congratulations! You now have configured your hardware device to interact with custom Alexa skills. You have also used IoT shadow to change the status of your device using voice commands.

See you in lab4.