Disclaimer

Please, proceed carefully following the tips published in this blog, specially when Main Power is involved. I'm not responsible for any damages caused by what is written in this blog.
Thank you

Wednesday 20 September 2017

Home Automation System - It's time for OpenHAB 2




Ok, I played a lot with hardware device :), now it's time to get involved in the "software" area of my Home Automation Project. Who read my previous posts already knows that I chose OpenHAB v.2 as my Home Automation System software; it's already installed on my new Raspberry PI3, as described in a previous post:


For me this is a new "world" and so I will follow the official documentation (http://docs.openhab.org/introduction.html) and the community too (https://community.openhab.org/) where you can find a lot of useful infos.

In simple words (and based on what I understood), OpenHAB v.2 makes a link between the devices (real or virtual...), called "things", and logical entity, called "items". The items will be used to manage the "Home Automation System".


From www.openhab.org

To integrate the real or virtual devices (things) in OpenHAB v.2 you can use Bindings, which are objects that make OpenHAB v.2 able to communicate with external device (real devices or simple Webservice or data providers...)

"Items" integration inside the user interfaces will be done using "Sitemaps", while "Rules" permit to manage events and automation logics

All data which will transit over the OpenHAB v.2 Communication Bus can be stored through persistence engine called "Persistence"

I will try to explain all of these concepts as I move forward with my configuration.

So, my system is ready to be configured and used. This is my software configuration on Raspberry PI3

OpenHAB v 2.1
Broker MQTT mosquitto, with auth
Grafana
InfluxDB, as persistence engine of OpenHAB
Reverse proxy SSL with auth, using NGINX , to securely expose on internet OpenHAB Grafana.


The standard configuration (choosing the "standard package" at the end of the setup) of openHAB v.2 modules is the following one:

- BASIC UI: responsive UI for the standard user; it is built using Sitemaps

- PAPER UI: UI for configuration purpose, not completed yet (mmany configurations part will be done directly using configuration files)

- HABPANEL: user UI, optimized for tablet


There are lots of others modules; see the ADDONS section of PAPER UI.

To complete the overview, two words about native mobile App




Windows OpenHAB App, also for Windows 10, but it seems a bit "young".


Ok, it's time to let OpenHAB v.2 doing its stuff

Just to become familiar, I will try something easy; later I will try to integrate SONOFF with MQTT.

First of all, I follow all the beginner tutorial, just to become familiar with the environment and having no real device like LIFX lamp or KNX device, I decide to integrate speedtest and weather data, provided by external services.

For speedtest integration, I followed this great tutorial https://community.openhab.org/t/speedtest-cli-internet-up-downlink-measurement-integration/7611; so I learned as you can edit configuration files. A lot of OpenHAB areas are involved:

 - addons / bindings: to let OpenHAB v.2 exec shell commands
 - items: object creation as speedtest data storage "device"; 
 - sitemaps: user UI, linked to the items
 - rules: automation rule just to collect speedtest data automatically

In other words, OpenHAB v.2 will run speedtest-cli shell script (a textual interface for the speedtest service) at regular time interval (I set a 2 hours refresh), stored its result in item objects and then link these items to a user UI.

This is the result on a new sitemap (Basic UI)


For weather service integration, I chose OpenWeatherMap (already knows it)

So, I followed again the official documentation (http://docs.openhab.org/addons/bindings/weather1/readme.html) and reach the target was not so difficult. This is my final result:


For the files configuration, I used Eclipse SmartHome Designer (http://docs.openhab.org/configuration/editors.html#esh-designer), a graphical editor which provides some facility.

Well, with these test I verified OpenHAB v.2 is a working system. In short time my OpenHAB v.2 will be able to lights up my garden lamp (I hope...)...thanks to MQTT




No comments:

Post a Comment