Tuesday, December 20, 2016

Home Automation (6): IoT Cloud Integration

As part of my learning voyage, I have decided to give a close look to Samsung Artik Cloud and its capabilities.

My Home Automation System collects every 30 sec. readings from devices in each of the rooms, with several kinds of information, received through MQTT from the Gateway.

In the Gateway I have set-up a process that collects all these information, aggregates, and every 10 min. send the value (for now only temperature) to Artik Cloud, again using MQTT.
(The rate is limited because I'm using a free account on Artik, with a maximum rate, per device, of 1 msg every 10 min.).

This is the snapshot of the charts, taken today. Each chart shows the variation in time of the temperature, for each room.



And this is the NodeRED flow that integrates with the Artik Cloud



The flow is started every 30 sec., read the values of temperatures of four rooms (T1, .. T4), calling a REST API,  join in a single message and sends the message to Artik using MQTT.

(updated 30/12/2016)

Friday, December 16, 2016

API.AI

Talking about Bots, an important building block is a "Natural Language Processor".
And here, Machine Learning comes into the play.

One interesting Cloud service is the one provided by:

Thursday, December 15, 2016

Android, Things

Google has announced the new name for its OS dedicated to IoT: Android Things (past name was Brillo)

Almost Human: talking with your IoT

NewImage
Fig. 1
For every system User Oriented, the User Interface is one of the most important building block, and you need to carefully think about it.
In the past, the most used type of UI was a Web UI. Today, we tend to prefer a Mobile App, since our SmartPhone is (almost) always with us.
But we should be honest, a UI where we have to push buttons, move sliders, check boxes, is not the way we would love to work and live.

The dream, one of the dreams of AI, is to be able to use Natural Language to interact with a System, better through voice.
But this is still not so easy, everyone of us have at least one time laughed at the mistakes that SIRI does, sometime (or more often than that).

Surely, this can be, will be the future, but think about it: there are still moments when you can’t or don’t want to use voice (for example, don’t want to be heard by someone else).

Here comes ChatBot: chat were you’re interacting with a “Robot”.
If you want to understand better what a ChatBot is , maybe you can resort to Wikipedia. I don’t pretend to teach you this.

But, working on my Concept Prototype of IoT, my HomeAuto system, I decided that I wanted to explore how to use a ChatBot as interface.
I discovered that with Telegram you can easily set-up a Bot and, more important, Telegram has an Open API. This makes it easy to develop the System-User Interface.

More details: i don’t want to write code, or better, I prefer to write as little code as possible. Therefore I decided to find out if there are modules for NodeRED useful to simplify the interaction with a TelegramBot.
Yes, there are.
Therefore, the building blocks are:
  • A Cloud Service, with an Open API, that enables you to create a Bot, enable to interact through API with the Bot and provides you a Mobile Apps; Telegram is Ok;
  • A Middleware that enables you to visually develop flows to interact with your Things: NodeRED;
  • A module for NodeRED that simplify the creation of flows capable to interact with the Bot: here I have found 

All this pieces, in my Home, runs on a Raspberry PI 3.
It works!
  • I can ask, using the Telegram App: “Show me T2” (Temperature in Room 2) 
  • I have developed a flow that checks the readings from a GAS sensor in the kitchen and, if the reading is above a certain threshold, it sends me an alert on Telegram (can be also a Voice Message)
  • … I’ll do more in the next week
 In the fig. 1, at the beginning of the post, you have seen an example of the conversation with the Bot.
 This is a snapshot of the NodeRED flow that implements the conversation above
NewImage
Not complicated, really.

You can see in the picture “Telegram Receiver” and other nodes taken from node-red-chatbot. 
Nice. Obviously the implementation of a “Language Interpreter” is the most difficult part. In my prototype, where I have used RiveScript, sentences recognized are very few and simple.

If you want to implement some serious thing, you need a NLP service: Natural Language Processing.
See you soon.

Monday, December 5, 2016

Home Automation (5): integrate Philips Hue


Lighting my House: at the end I have decided to adopt Philips Hue.
It has not been an easy decision. Hue is not cheap.
Another decision point has been the choice of the protocol for communication with the light’s bulbs.
I think toady, in Home and Building Automation, there are two possible and reasonable choices:
  • Zigbee (ZLL)
  • ZWave
ZWave is for example the protocol used by Fibaro System. It seems to me a little more open than Hue.
Zigbee Light Link (ZLL) is a protocol based on Zigbee.
As far as I have seen:
  1. ZLL is becoming more and more common;
  2. ZLL devices are cheaper than ZWave;
  3. In addition, Hue seems to me easier to set-up and integrate.
But Philips has worked with ZLL in such a way that other devices (for example lights from Ikea) don’t integrate. The protocol permits this.
Anyway, at the end I have decided to go with Philips Hue, thinking that it was the easier and most effective choice.