Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Alexa Skills Projects

You're reading from  Alexa Skills Projects

Product type Book
Published in Jun 2018
Publisher Packt
ISBN-13 9781788997256
Pages 250 pages
Edition 1st Edition
Languages
Author (1):
Madhur Bhargava Madhur Bhargava
Profile icon Madhur Bhargava

Chapter 6. Home Automation with Alexa

"Communication must be HOT. That's Honest, Open, and Two-Way."

– Dan Oswald

As we progress through this book, the skills we create are evolving too. We started with a simple Hello World Skill and went on to create an SMS sender, a trivia game, a skill that talks about cryptocurrencies, and in this chapter, we will be working on Ambience Manager, which can tell us the ambience parameters, such as the temperature and humidity, of our homes.

We will be designing this skill by covering the following topics:

  • Introduction to Home Automation and Ambient Sensors
  • Designing the Ambience Manager Skill
  • Developing the Mobile App
  • Developing the Ambience Manager Skill

This chapter will be covering a lot of ground since our Ambience Manager Skill will be communicating with an ambient sensor, hence it will also involve the details regarding the ambient sensor as well as a mobile app, which will help us in uploading the temperature data to the cloud.

Introduction to Home Automation and Ambient Sensors


For introductory purposes, home automation is a concept whereby a user can control standard home fixtures such as lights, music systems, televisions, and even climate, using an array of intelligent sensors rather than the traditional flipping of switches for each individual fixture. Home automation intends to keep the physical interaction of the user with the actual hardware as minimal as possible. In the recent present and the not-so-distant past, the concept of home automation was built on top of mobile operating systems (mostly Android or iOS), where the user was able to control the whole house using just a mobile device or a tablet rather than interacting with the switches of each individual device present in the house.

With the advent of Interactive Voice Assistants, the concept of home automation has transcended to the level where a user can control a home with just their voice. The actual concept of home automation is very broad and...

Designing the Ambience Manager Skill


Our Ambience Manager Skill will have at least five moving parts, including a User that interacts with Amazon Echo, which in turns communicates with the AWS Lambda, which in turn fetches the temperature information from the Firebase cloud. The temperature information will be pushed to the Firebase cloud via the Mobile Device, which reads it from the Ambient Sensor. The flow of information is shown in the following diagram:

Figure 6.2: Data flow in Ambience Manager Skill

The ambient sensor will communicate the ambient parameters, that is, temperature and humidity, to a mobile app over BLE.

This will eventually upload the ambient parameters to the Firebase backend.

Note

Firebase is a real-time database by Google. To learn more about Firebase, visit https://firebase...

Developing the Mobile App


We will be creating an Android app that will communicate with the ambient sensor over BLE.

If you do not know much about developing Android apps and BLE, don't worry, you can simply download the source code from the link provided toward the end of this section. Alternatively, you can check out the Android Developer website regarding the development of Android apps.

Note

If you are interested in exploring Android, navigate to https://developer.android.com/ to find more information on Android app development.

The following are the prerequisites for this section:

  • Android:
    • Latest Android Studio
    • An up-to-date Android device (preferably a Samsung Galaxy S8, since it has support for Bluetooth 5, otherwise any device with an API Level of 23 (Android M) is fine)
    • Basic familiarity with Java, Android, Android Studio, and BLE
  • Hardware:
    • Texas Instruments CC2650 STK SensorTag

We'll begin by creating an empty project. Please choose a name for it.

For the purpose of consistency, and since...

Developing the Ambience Manager Skill


As always, we will be making use of the Alexa Skills Kit (ASK) Console to configure the Ambience Manager Skill:

  1. Navigate to https://developer.amazon.com/alexa, and click on the Sign In button located in the top-right corner of the screen:

Figure 6.17: Alexa Skills portal

  1. After signing in, click on the Alexa Skills Kit menu item on the top-left, and from the menu, select Get Started Alexa Skills Kit:

Figure 6.18: Alexa Skills Portal – signing in

  1. On the screen that appears next, click on the Start a Skill button, located in the center of the screen:

Figure 6.19: Alexa Skills Portal – starting a skill

  1. This should land you on the ASK Console:

Figure 6.20: Alexa Skills Portal – ASK Console

Click on the Create Skill button located at the bottom of the screen.

  1. The next screen is the Create a new skill screen, which will require a SkillName to proceed further:

Figure 6.21: Naming the skill

Please name the skill Ambience Manager and click on the Next button.

  1. The next page...

Summary


We hope you enjoyed creating the Ambience Manager Skill. This skill had a lot of moving parts that were not Alexa-specific, such as Firebase, the ambient sensor, and the mobile app. We also covered the One-Shot Launch, and skill debugging via CloudWatch.

As with the previous skills, the Ambience Manager Skill still has room for improvement, such as handling humidity data and the introduction of additional intents.

We have left the improvements as an exercise for the user to hone the skill even further.

We also hope that you are now a little more confident with your knowledge regarding Alexa skills and can't wait to see what you create next.

In the last chapter, we will explore the future of Voice-Based Assistants.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Alexa Skills Projects
Published in: Jun 2018 Publisher: Packt ISBN-13: 9781788997256
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}