Now that Alexa knows how to talk to the 3P cloud using LWA as the oAuth provider, we can functionally test our smart home skill.
The first thing we need to do is enable the Smart Home Skill.
1. Sign in to the Alexa app (available on Android, IOS or the web at https://alexa.amazon.com) with the same credentials as your developer account.
2. Tap on Skills on the left navigation bar
3. Tap on “Your Skills” in the upper right corner
4. Tap on DEV SKILLS and find your skill
5. Tap on your skill name, then click the ENABLE button
6. You will be prompted to login LWA and allow access, this is part of account linking
If you are unable to complete account linking, make sure you are using valid credentials for the device cloud. Otherwise, it is likely there is an issue with account-linking information you provided in the developer console.
You have now successfully enabled your Smart Home Skill.
1. Tap the DISCOVER DEVICES button in the Alexa app.
If the skill does not discover devices, check the logs for your Lambda function to see if it received a discover directive from Alexa. See “Review the Skill Logs on CloudWatch” below.
2. You should see a new device in the list after discovery, “Sample Switch”.
If you have an Amazon Echo or other Alexa-enabled device associated to your Amazon developer account, you can give that device the command “Alexa, turn on sample switch” and Alexa should respond with an earcon or “Ok,” indicating that the switch was activated. If you do not have a device, you can use the testing simulator in the Alexa developer console. Login to the console, select your skill, then click the “Test” tab. Ensure the option for “Skill testing is enabled it” dropdown is set to Development.
There are two other ways to verify your sample switch is responding correctly:
Review the DynamoDB Table
The DynamoDB table you created in Step 3 will store the state of your device. Browse to https://console.aws.amazon.com/dynamodb/home?region=us-east-1#tables:selected=SampleSmartHome;tab=items to open your “SampleSmartHome“ table, and verify there is an entry for your device. It should show an ItemId of sample-switch-1 and a powerStateValue of ON.
Review the Skill Logs on CloudWatch
AWS Lambda logs events, errors, and debugging information via CloudWatch Logs. Those logs are useful for investigating what information is sent back and forth to the Lambda function.
2. Click the latest Log Stream and review the Messages.
3. Note the values recorded in the logs. The inbound handler request and context values are from Alexa. The outbound handler response value is from the Lambda function.
Congratulations, you should now have a working sample!
To avoid ongoing charges for resources you created to complete this Cake Time tutorial, you should delete the following resources. Note: The links for each resource assume you have used the “N. Virginia” (us-east-1) region for the tutorial. If you chose a different region, please update your region accordingly.