📜 ⬆️ ⬇️

MajorDoMo project news (home automation platform)

About two months have passed since the first introductory article on the MajorDoMo project was published on Habré and I have news.

image

Literally this week, an update was released in the form of version 0.1.8b, including a large number of minor edits and several rather interesting innovations that I would like to introduce you to.

Scenes
')
The interface for working with Smart Home through the menu system has been and remains quite convenient. Especially if you have to work on a small smartphone screen. However, if we have a larger screen, then why not use it more effectively. After thinking for a while, I came to the concept of creating scenes.

So what is the scene. The scene is, first of all, a large space with a background image that should set the context. As a background, it is logical to use the plan of the area (room), but the background may be a photo (of the facade) or just a neutral image (wallpaper). Scene, by the way, can be any number and it is easy to switch between them.

Further, on the scene, you can add elements that define the dynamics of the scene. Elements are of two types - image or html-block. In the first case, you need to specify the coordinates of the location, and in the second more information about the width / height of the block. The behavior of an element is determined by a set of states, for each of which the appearance of the element and the display condition associated with the values ​​of environment variables are specified.

But as they say, it's better to see once what happens:





You can read more about scenes on the project site, but for the time being I’ll limit myself to the general conclusion - using the scene mechanism, you can create visually attractive and dynamic interfaces that reflect the real state of various systems and mechanisms, as well as allow you to control these mechanisms. The interface of the scenes looks great when launched both on the big screen of the TV and on the screen of tablets of all stripes.

Over time, I hope, a graphics library will be assembled for various elements, and a widget mechanism will be developed for simple placement of elements that are complex in code / structure.

Visual programming

The following innovation concerns the configuration and programming of scripts. Some time ago on Habré there was a small article about Google’s Visual Blockly programming project. Having learned about such a wonderful project, I could not calm down until I figured out how to tie this thing to MajorDoMo. After all, in fact, there are many people for whom writing scripts in any language programming is an obstacle, although there are no problems with logical thinking. That's why I decided that the visual programming in the project to be.

After downloading the latest version of Blockly with google code, I looked at how it works - after that I liked it even more. As it turned out, there are no problems with adding your own "cubes", as well as with writing your own converter from the visual environment into the program code. Blockly “out of the box” supports conversion to JavaScript, so I took this converter as a basis and converted it into a PHP code generator, which is used in MajorDoMo for scripting.

This is what a simple script looks like:

image

Now you can play in the "cubes" to collect quite complex scenarios. Those who lack standard “cubes” can always switch to the operation mode directly with the code, or they can connect special “cubes” to insert blocks of code into the flowchart.

I even tried to Russify the flowcharts, but so far I have refused from this - somehow it looks quite unusual, although I can come back to this sometime. Here is an example of a flowchart in Russian:

image

miscellanea

In addition to the above, you can also note the following changes:



The information on the project site is also updated - there are articles describing the use cases of the system, equipment reviews, new versions of the firmware code for the controllers.

In general, the project is developing - a community is being formed, interesting ideas and various hardware solutions are being discussed at the forum. The plans for the future come with a project to a wider international community with its rich traditions in this area.

Taking this opportunity, I want to thank all the project participants who, to the extent possible, contribute to its development - install the system at home, find errors, suggest ideas, tell about interesting equipment.

I traditionally invite you to the project website: smartliving.ru .

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


All Articles