Man’s desire to be a part of the social ecosystem has led to the invention of many communication and information sharing tools. This trend is now morphing to include use cases where we interact with non-living things, as well. Let’s look at one such application where we can communicate with our things through chat, just like way we would Whatsapp our family and friends.
Note: This post was originally published in the IBM Bluemix blog.
Home automation is a ubiquitous application. We talk to our appliances, and they obey our orders. That is so cool! But let’s take it a step further. We’ll want to make it a bit more seamless so that we talk to our home in a natural conversation. But how do we do it? Machines talk in binary code which is cumbersome for humans. In this blog article, we will show you how to build a home automation app. So follow along and check out the demonstration provided later in this article to help you understand how to build a virtual assistant for your home.
IBM Watson Conversation service allows developers to build natural language interfaces that can interact with machines and virtual agents. This enables us to retain our most natural way of communication while the conversation service does the heavy lifting at the backend to translate our messages so that the machines can understand.
Watson Conversation service provides a drag and drop dialog builder. This dialog builder is the key to designing dialogs that are intuitive for human users and, at the same time, can be deciphered by machines.
A typical human-to-machine conversation is very different from human-to-human conversation. Machines do not usually engage in a conversation flow like we humans do. They take commands and respond with an action. The Watson Conversation service allows us to build specific dialogs that convey commands and actions between humans and machines. The image below illustrates how this is achieved via intents and entities:
As you can see above, the Watson Conversation service breaks down each human message into an intent and an entity. The intent specifies the command to be executed, and the entity specifies the particular machine or device that should execute the command.
In the home automation scenario, this boils down to sending commands to the lights and appliances to either turn on or turn off. So imagine you have an Internet gateway at home which also hosts a virtual agent that is accessible through Whatsapp. If you hook up that gateway to your home automation system, then you can chat with the virtual agent to control your appliances (see the example illustration below).
Let’s go ahead and build this home automation virtual agent. We have already unraveled the complexity of deciphering the conversation thanks to IBM Watson. Now comes the next challenge, that is, building the virtual agent.
Contrary to the usual practice of building a virtual agent using a server-based application, we can have an agent up and running on the fly with the help of PubNub BLOCKS. PubNub BLOCKS is a serverless computing module which can be programmed easily and with no infrastructure overhead. With BLOCKS, this is how the system architecture of our home automation virtual agent will look (see below).
Now we have a system deployed using PubNub BLOCKS as a virtual agent. It performs three responsibilities:
Once built and deployed, we could command our virtual agent and control our home, somewhat like the example below.
We are going to build this exact replica of the simulated home automation demo. For your reference, the source code of this demo is available here in GitHub.
Here are the components of the demo:
To power this virtual agent, we rely on two backend cloud services.
Refer to the README file to setup your conversation service and PubNub BLOCKs service.
For building this app, you will need to create a Bluemix and PubNub account. Visit the IBM Bluemix signup page and PubNub service page to create your respective accounts. Both of the services offer a free tier account to play around with their offerings.
There is no limit to the the kind of dialogs that you can build with the Watson Conversation service. However, to keep things simple and to show you the most basic novelty of this concept, let’s define the most common commands that we usually perform upon our home appliances.[Turn on bedroom]
Here, Turn on is the intent and bedroom is the entity. When we issue this command, we are instructing the virtual agent (PubNub BLOCK) to switch on the bedroom light. Below is an illustrated example of how the messages flow across the system components to make this work.
In a similar way, we can send control commands affecting other rooms for turning on / off the lights:
We have also defined an “is” intent used for monitoring purposes. This helps us to query the present state of the room light.[is bedroom on]
The virtual agent’s JSON response for this command is:
This way, we can clearly decipher the chat commands and instruct the home gateway to either perform an action or report the status on a specific device/appliance inside the home.
All these intents and entities are predefined in the Watson Conversation service workspace instance that we have created for this app. So in case, we want to extend its capability, we can easily do so by adding more intents and entities.
Now that we have a virtual agent that can understand our desires to turn on or turn off the lights in our home, what more can we do? As it turns out, with Watson Conversation service’s dialog builder, we can build more complex dialogs and program our agent to perform more tasks.
So here is a challenge for you. How about dimming the lights of your home?
You can write a “dim on” and “dim off” intent for the individual rooms or you may choose to define a “dim all” intent that affects all the lights, as shown above.
With the Watson Conversation service, the cognitive computing wave has reached a new level. From mere number crunching and predictions based on data, we have moved on to the realm of natural language interaction with machines. One can imagine all those device control dashboards with countless buttons and widgets, getting replaced by a plain and simple chat interface. And, along with PubNub BLOCKS, developers can create rich and intuitive experiences for the users just like this home automation virtual agent.
So buckle up and give it a shot. Follow the docs and learn to build the dialog for Watson Conversation service to add those new intents for dimming the lights. And, please do share your experience with us!
Shyam is the Creator-in-Chief at RadioStudio. He is a technology buff and is passionate about bringing forth emerging technologies to showcase their true potential to the world. Shyam guides the team at RadioStudio, a bunch of technoholiks, to imagine, conceptualize and build ideas around emerging trends in information and communication technologies.
Applying AI in Food Industry To Streamline Supply Chain Workflow
Kitchen Inventory Management with Smart Jar
IoT Intelligent Transportation Systems with Twilio Sync
Intelligent Vertical Search with Watson Discovery
This Alexa Powered Dictionary Bot Can Expedite Your Vocabulary Buildup
Realtime Customer Feedback Analysis with IBM Watson Natural Language Classifier
Please log in again. The login page will open in a new window. After logging in you can close it and return to this page.