📜 ⬆️ ⬇️

Home automation with ioBroker

Now, when new pieces of hardware to control light bulbs, air conditioners and other household utensils, appear almost daily, there is an urgent need to combine all this wealth into one network.
But the world, fortunately, does not sleep and diligently deals with this problem. There are free solutions of decent quality and paid (not a fact that good quality).
Like the world, I can not sleep too, and I also, like the whole world for many years in a row, and the last three years, especially hard, engaged in the integration of all kinds of equipment in a smart home.

In this article I want to highlight the automation of the house and how with the help of the Open Source project to cover (and not only) their comfortable home. Oh yeah, I almost forgot to say that all automation happens on JavaScript!

For all lovers of JS please under the cat


For a start, a little dry theory and demagoguery on the subject of a smart home.
Everyone understands this term as something different. Someone turns on the lights in the bathroom using a motion sensor and thinks the house is already smart, and for some the house from IronMan (JARVIS) is not smart enough, because this house was finally blown to pieces, which means that it did not able to protect himself from some people in helicopters .
But joking aside - all these people are right. Just the level of "mind" at home is also different, like IQ in humans. There are small “children” who know how to turn on the light bulb, but there are graduates of the university, “academics” who can not only turn on the light, but also turn it off :)
')
In the house you can isolate several areas of automation:
- most often it is light
- then heating
- monitoring habitat: temperature inside and outside, humidity
- security and alarm
- multimedia (TV, music)
- the role of shutters, windows, gates, doors, awnings
- Ventilation and air conditioning
- control the rest of home appliances
- logging and graphics
- notice

The list can be continued, but I would like to focus on the most used directions. For each field of automation there is its own system of devices, each with its own protocols, applications and control methods. At the moment there is no manufacturer capable of providing devices in each of the areas of automation. But there are some that have progressed particularly far: Samsung, Google, Apple.
At the same time, each manufacturer necessarily invents its own bike of interaction protocols and no one wants to yield to another. Although the interaction protocol from google Weave seems to be the most thoughtful.

There are also attempts to create a protocol regardless of the manufacturer. In this direction, IBM advanced the furthest from MQTT. But, unfortunately, there is no standardized channel about getting descriptions about devices, such as units of measurement, location / room, functional group (blinds or lights) and other meta information.

And what do I mean by smart home, or how was it said above, what level of automation suits me?
I experimented a lot and came to the conclusion that all these controls from the phone, voice control or temperature plotting are just toys.

This smart home should be invisible. It should only be noticeable when the smart home stops working.

A smart home should monitor people through sensors and adjust the habitat for them (no, of course it should not send this information to Google). To regulate temperature, thus saving heat on heating; include, when a person enters the room, the backlight without blinding him or covering the blinds on the windows if the TV is on and the window casts a glare on the image. Scripts - an infinite number. Especially intelligent houses should themselves recognize the sequences and dependencies of events and propose new rules for automation.

I know what I am saying. I hung up and a tablet near the front door and implemented voice control and built all possible and impossible schedules and I can open the apartment door with the phone, but this is all to show the guests once what my smart house is and hear “Wow” in response . My family and I almost never use it.

No, it is of course important, sometimes to look at the status of sensors in the house on the phone, while swimming in the Mediterranean Sea or to receive a notification with a photo that someone came into the house, although he should not, open the door to the postman and trace that he would not have taken half the house with him. And, in the end, to hear from friends that same “Wow” is also not the last argument. :) All this should be, at least in order to understand that it is actually not so important :)

It is best to automate the apartment in which the bachelor-technophile lives, who goes to work at the same time every day and has a constant number of holidays and weekends (Russia, unfortunately, does not fall under this criterion. Some New Year's holidays in May cost something :)).

Then comes a childless young family with a moderate love of technology. It is important that each of them be separated from the cell phone.

The most difficult case is a family with children (the bigger, the harder). Children just can not be automated. “So dad that I forgot the phone. I don’t need him in the yard. ” And all the scripts for recognizing the presence of people in the room and the alarm activation rules based on them are useless. (My case)

But let's get back to how to do it all at home and make your habitat more comfortable.

What is ioBroker?
It is an integration platform for the Internet of Things and serves as a central server for:

* By the way I will be grateful for the translation of the last term.

ioBroker is a system capable of connecting all salad protocols and devices among themselves.

Some construction company decided to build smart housing in Hamburg and they collected all possible devices in one apartment and offered to manage all this zoo eight phone applications (by the way, only apple). Here I should probably write: you can imagine, eight applications, Karl!
With ioBroker it would not be necessary.

ioBroker has a very modular structure. Each module runs in a separate process and when it falls, it just restarts and the whole system works further.

The difference between ioBroker and other automation systems is the web visualization module in the browser - vis. Half the time required for the development of the entire ioBroker was spent on its development.



Another advantage of ioBroker is the huge number of available npm packages - 286,000.

* Information taken from http://www.modulecounts.com/ .

Of course, the quality of packages is not always up to the mark, but as a rule for the same problem there are several different packages and the quantity in this case turns into quality. You just need to select the desired package. Thus, the connection of new protocols is only a matter of technology.
I thus implemented the connection OPC UA, Sonos, MQTT, Telegram, Pushover, Homematic, Z-Wave, Simatic and a large number of other systems.

Great emphasis is placed on the possibility of convenient configuration and configuration, and this eats up the lion's share of time, in contrast to FHEM and, for example, OpenHAB, where configuration occurs through configuration files.

Open Source Alternatives.

- OpenHAB is a popular Java automation platform. At the moment, there are up to 160 drivers or modules.

- FHEM is a common Perl automation system with a huge number of drivers - 340. That's just the system setup leaves much to be desired and the lack of a standardized meta-model makes it difficult to expand the system.

- MajorDomo is a fairly mature PHP automation platform. It is possible to find many articles about this system here on geektimes .

- Domoticz - a system written in C / C ++ with a very decent graphical interface. But due to the fact that C / C ++ is difficult to write quickly, then with a limited set of drivers / modules.

In general, many interesting home automation systems can be found here . Basically, the separation of systems occurs by programming languages ​​(Java, C / C ++, Python, Javascript, PHP, ...) and by hardware (Vera, Raspberry PI, Synology, Mediola, ...). They all deserve the right to exist, although some may be more and some less.

At the moment, the level of technical knowledge of people implementing the automation system is quite high and they do not faint from the words: Linux, console, apt-get. But when the question appeared on the forum: “I installed the system, but I cannot change the home folder to the ioBroker folder. Help!". It was a bell that non-computer science began to catch up with and that simple computer users could use the system.

All configuration interfaces have been translated into 3 languages, with the exception of German-specific drivers. Well, why would a Russian-speaking user have a driver supplying data on gasoline prices in Germany or warnings of bad weather from the German weather service? ..
Also without a driver remained for a purely Russian-speaking market, for example, the starline car alarm driver.

Documentation is also written as much as possible in 3 languages, but there is still a lot of work to do. Although over the past month there have been many good descriptions.

JavaScript is used to write the interface, service, and scripts. One of the widespread and popular programming languages. Now Python is gaining more popularity, but you can’t write a graphical shell for a browser on python. (Yes, I know about the existence of py2js , but have not yet seen anything worthwhile created by it)

A little about open source projects.
As a person participating in an open source project, I can say: I used to think that open source projects are being written by thousands of people from all over the world and that it is easy for them to write anything. Now I can say that behind each open source there is one (sometimes in especially large projects a group of people) and that only one percent of users are active from the community. Just for large projects, the number of users is millions and one percent of a million is ten thousand people. But the smaller projects have dozens or units of individuals. I can also say that one interested user can do more than ten disinterested programmers and it is important to simply gain a lot of users and the likelihood of a person capable of making a significant contribution becomes greater.

Opportunities
I can say that the possibilities ... are endless. Multiply the number of npm packages by the amount of iron and you will have a million possibilities to turn on the light bulb:
- via telegram
- voice
- rest API
- web visualization
- android application
- interface for phones and tablets (mobile)
- 340 drivers from FHEM
- MQTT

And the project is also actively developing and growing in 3 languages.

For those interested - google to help. And henceforth - I will try to describe not how the universe works, but how the communication between the modbus device and the nuclear power plant occurs.

Source: https://habr.com/ru/post/394961/


All Articles