Good evening!
I bring to your attention the project I have been working on for the last year and a half. This is a
software product (to be precise, .NET Windows Service), with which you can organize on your computer a control center of the "smart home". Although this is just my hobby (my main job is a .NET web developer), many people to whom I showed my project appreciated it. I am writing this article to try to interest you.

Prehistory
If you type in Google "smart home", you can see a bunch of sites, with the proposals "to install it turnkey." And although these solutions often look futuristic, they almost always solve problems sucked from the finger. Moreover, in most cases, the functionality of such smart homes is reduced to remote control of devices (for example, from a tablet).
')
In my opinion, a “smart home” is something that independently makes decisions on managing home devices based on information coming from outside (for example, from sensors) and pre-configured rules. In addition, I believe that the smart home should interact not only with devices, but also with Internet services (in principle, in recent times, it seems, almost everything has begun to count).It all started a couple of years ago with an
article on Habré on the Android application
on {x} . It allows you to hang a certain logic on various events in the phone. For example, it may send a text message to his wife when you leave work. “Automate your life” is written on their website. “This is the thing I have always dreamed of!” I thought then. "But I want this for my home, not for the phone."
Then there was almost a year of experiments and programming, as a result of which the
first version of the application appeared . There were a lot of flaws and there was almost no user interface, but, most importantly, she could do the same thing as on {x} - manage the house using scripts. Only the
nooLite power blocks and the D-Link DCS-932L IP camera were supported from iron.
Now
Last week I finished work on the
second version of the application . In the new version, the insides of the system were greatly reworked and the infrastructure for the user interface appeared. It was also written several modules that users could "out of the box" to use in everyday life: "scheduler-alarm clock" and "weather forecast".
Compared with the first version, the development took less time (about half a year), but the amount of work done was much more. This is partly due to the fact that, impressed with an
article from the blog of John Resig, I gave a
three-month “marathon” with daily writing code.
Plugins
The system consists of a "core" and modules (plug-ins). In essence, the kernel contains only the mechanism for connecting modules and the infrastructure for them (so that they can describe their API and events, as well as use the API and subscribe to each other’s events). Also in the kernel is the basic functionality like logging and access to the system database.
The rest of the functionality is implemented in plugins. Even things like scripts and the web interface are just plugins (if you turn them off, the system will continue to work normally, although some of its features will disappear). Technically, plugins are compiled DLLs written in C # or another .NET language.
Script Management
Scenario house management is the main purpose of the system. Scenarios are small programs that control home devices and interact with Internet services. Scripts are written in JavaScript (
do you still dislike JavaScript? ) Via the web interface and are executed on the server side. Inside the scripts, there is an API for home control that can be extended with plugins.

The system can be configured to run scripts automatically when certain events occur. An event is a sensor triggering, a signal from a timer, pressing a button, or, for example, receiving a message on Twitter. New events, like new API commands, can be added using plugins.

Web Based Management
In the first version of the interface almost was not. Needless to say, this made the system virtually inaccessible to most people? It was the development of the interface was the main task of the second version of the system.
The web interface of the system is a modular
one-page application based on
backbone.js and
marionette.js , the modules are loaded via
require.js . For layout,
Bootstrap is used, thanks to which everything looks neat and correctly displayed on small screens of mobile devices.

Plug-ins can describe their own UI in the form of js / css files located in DLL resources. When a plug-in is installed into the system, its UI is automatically embedded in the web-based home management interface (a new section is added). For example, this is how the interface of the weather forecast plugin looks like

Documentation
In my opinion, one of the features of my project that distinguishes it from other similar systems is the availability of detailed documentation in Russian.
See for yourself .
It took a lot of time and effort to write it (almost 3 months). It was very hard not to let the new functionality be programmed until the documentation for the already prepared one was written. But writing the documentation also had a positive side effect. I had to look at the project from the side of its user, due to which a large number of flaws were identified and corrected.
Another side effect - while working on the project, I learned something new about .NET and web development. Reading the documentation, you may also learn something new.
Instead of conclusion
I think smart home should automate people's routine tasks. But each person has his own habits and tasks that he would like to automate (as well as different “hardware”). If you implement the Wishlist of all people, you get a cumbersome inconvenient system, in which each specific person will not need 90% of the functionality. In addition, it can not be implemented without a large team of programmers in a short time. Instead of a ready-made giant system, I wanted to make a tool with which you can build your own small home automation system. Something like a designer, to which you can connect, for example, your own devices on the Arduino and at the same time not to engage in self-realization of the infrastructure and common functionality.
Try
installing the application and write your own plugins (this is
very simple ).
Write about the errors and send
pull requests . Add to our
VKontakte group to keep abreast of the project news. I will be very pleased if you like it!