Connect home automation with the Watson IoT platform

Share this post:

Ever thought about connecting your house to cognitive system using Internet of Things? I gave it a try! Here’s a brief overview of how I made it work.

Within our house, we have different protocols – specifically EIB for the house appliances, MiLight for controlling the color of the lighting, a specific data logger for the solar panels, Sonos for audio, and some IP cameras.

Getting started

My first goal for this experiment was to connect with the EIB bus. The following diagram illustrates how that connection was made:

BlueHome diagram
(click to enlarge diagram)

Setting up the home side

On the home side, the EIB bus can be reached through an EIB/IP router. To build the connection, I used a small ARM-based Linux box. On that box, I downloaded, compiled, and installed the EIBnetmux server and the MQTT client. The next step was to connect the two of them, so I wrote a small program in C (source on GitHub) that does the following:

  • Reads a configuration file containing:
    • MQTT credentials
    • EIB credentials
    • A list of devices (EIB addresses and the corresponding device names and parameters to be used)
  • Sets up a connection to the EIBnetmux server
  • Sets up a connection to the MQTT client
  • Subscribes to the MQTT Bluemix service
  • Listens to the EIB bus and, for each event, writes a message to the MQTT client
  • Analyzes and creates an event on the EIB bus for each message received through MQTT

The small Linux box serves as a gateway device, so the connection with the Watson service requires a one-time setup for the gateway itself. Thereafter, the devices are automatically added by the IoT platform at their first published event.

Setting up the IoT backend

On the back end, I used Bluemix to create a Node.js application and then attached the Watson IoT Platform. On the IoT platform, I created the gateway device and used the credentials on the house side. Here is a screenshot of the populated devices in the IoT platform:

IoT list devices

Once I got the connection to work, I was able to see the data coming into the NoSQL database. I used the Watson IoT boards’ functionality to get a glimpse of the data coming in live. In the image below, the standard Usage Overview board shows the number of devices and the data usage of the system.

IoT usage overview

On a second board, I added the live temperatures coming from the outdoor temperature measurement and from the water heater system measurement. I also added status indicators for the lights on the right-hand side.

IoT board

The nice thing about using MQTT is that you can return messages without having to expose the gateway to the internet. As the MQTT client at the gateway subscribes to the MQTT server, it receives all messages published by the IoT platform. I experimented with the service by using Node.js to write an MQTT message that is received by the gateway and contains an instruction to write to the EIB bus. By doing this, I am able to control, for example, the lights remotely without any opening in the DMZ at home.

IoT Bluemix NodeRed

So, what’s next? Maybe I’ll connect the solar plant and start doing some trend analysis on the data. Stay tuned!

More How-tos stories
April 23, 2019

Announcing the Deprecation of the Watson Machine Learning JSON Token Authentication Service

We’d like to inform you about the deprecation of the Watson Machine Learning JSON Token Authentication service. This method of authentication will be retired on May 30, 2019.

Continue reading

April 2, 2019

Data Refinery and Profiling Changes in Watson Studio and Watson Knowledge Catalog

We'd like to announce data refinery and profiling changes related to Watson Studio and Watson Knowledge Catalog that will take effect on May 17, 2019.

Continue reading

March 26, 2019

Announcement for the IBM Watson Discovery Community

Starting April 2, 2019, we will be upgrading the infrastructure of the IBM Watson Discovery service to improve reliability and quality of results.

Continue reading