Page 1 of 4

New Home Automation engine and New UI

Posted: 04 Mar 2014 03:18
by PoltoS
We would like to present here the new engine we are working on. It is a home automation engine and UI for it. Both are stored on github and are under GNU GPL. The project is still under development, but will soon enter mature state.

We suggest to wait till start of CeBIT before writing your own modules, since we might change some structure meanwhile.

UPD 30.04.2014: this description was updated to fit lates code on github.

What's new compared to old UIs?

No Z-Wave configuration at all
  • All Z-Wave configs will remain in the Blue UI (we will fork it and clean a bit soon).
Virtual devices
  • Virtual devices (also called widgets).
    Each virtual device represents Z-Wave device functionality and can have it's own name, position and number of tags.
    Virtual device can be based on Z-Wave devices (created automatically) and on any custom JavaScript code.
Modules and Rules
  • Automation scripts are provided as modules
    Module provide functionality - Rule (instance of module) applies module functionality to your devices according to defined parameters. Module can be instanciated many times with different parameters.
    Easy to combine together and extend, easy to copy to other users.
  • User notifications are possible from modules.
    System wide notifications. Modules can also trp them and deliver them to the user via other transports (SMS, E-mail).
  • Global events are generated on each virtual device change.
    Modules can emit and trap events.
    Events are used for inter-modules communications.
New API Available UI
  • New Web UI
    Native iOS APP
    Android App soon
Get latest updates

Code: Select all

rm -Rf automation
git clone automation
cd automation
git checkout develop
How to create your own virtual devices

Register device:

Code: Select all

        vDev = this.controller.devices.create(vDevId, {
            deviceType: "deviceType",
            metrics: {
                level: "level",
                icon: "icon from lib or url"
                title: "Default title"
        }, function (command, ...) {
                // handles actions with the widget
Device type can be any, but the UI currently handles only:
  • sensroBinary
Each type requires it's own list of metrics and handles them specifically.

Unregister device:

Code: Select all

Find by Id, filter and map:

Code: Select all

    vdevId =;
    vDev = this.controller.devices.get(vdevId);
    vDevList = this.controller.devices.filter(function(x) { return x.get("deviceType") === "switchBinary"; }); // filter by type
    vDevTypes = { return x.get("deviceType"); }); // return types
Get/Set metrics:

Code: Select all

    vDev.set("metrics:...", ...); // metric can be level, title, icon and some other device specific like scale
Catch device updates:

Code: Select all

    vDev.on('change:metrics:...", function (vDev) { ... });
Execute command on virtual device:

Code: Select all


NB! API changed

Device creation/deletion changes. Calls listed below should be changed to new equivalent.

Code: Select all

this.controller.findVirtualDeviceById(vdevId);   ----->   this.controller.devices.get(vdevId);

vDev.getMetricValue("....");   ----->   vDev.get("metrics:...");

vDev.setMetricValue("....", "...");   ----->   vDev.set("metrics:...", ...);

controller.on('device.metricUpdated', function (vdevId, name, value) { .... });   ----->   vDev.on('change:metrics:...", function (vDev) { ... });
Make sure to update your modules!


Code: Select all

    controller.addNotification("....severity....", "....message....", "....origin...."); // severity is error, info, debug; origin describes which part of the system it is about: core, module, device, battery.
    controller.on("notification.pushs.push", function({timestamp, severity, message, type}) {....}); // catch notification
Module folder name should be same as module name (JavaScript object, DemoModule in the example below).

index.js file should containt the code, any additional file can be executed using executeFile(). module.json contains module descrtiption and configuration UI builder.

Minimal module:

Code: Select all

function DemoModule (id, controller) {, id, controller);


inherits(DemoModule, AutomationModule);

_module = DemoModule;

DemoModule.prototype.init = function (config) {, config);


DemoModule.prototype.stop = function () {;

Module should use stop method to release all resources aquired in init function.


Code: Select all

    "autoload": false, // allows to autoload singleton modules on start
    "singleton": false, // if the module is allowed to be loaded only once
    "userView": true, // should it be visible in the configurtor UI?
    "defaults": {
        "title": "Demo module", // default title
        "description": "Long description of Demo module", // default long description
        .... // some parameters
    "schema": {
        .... // some parameters, see other modules for more details // Alpaca is used for UI renderinf
    "options": {
        .... // some parameters, see other modules for more details
Glabal namespace
Module params can refer to glabal lists shared by different modules. This allows to use in module configuraion lists of devices, scenes, ... and other objects that depends on configuration of other modules.

Bind to event:

Code: Select all

    controller.on("....", function(....eventObject....) {});
Unbind from event:

Code: Select all"....", function(....eventObject....) {});
What's next?

More information will be added soon. See modules provided with the system to understatand modules system.

Re: New Home Automation engine and New UI

Posted: 06 Mar 2014 17:26
by etrust

wow clients are waiting for actions and notifications. When are you "planing" to release it?

Re: New Home Automation engine and New UI

Posted: 07 Mar 2014 21:40
by vwirus
It looks very promissing. That's what we were waiting for however... it looks like it's not working. UI won't allow to use this module. There is nothing I can do beside creating new rooms there. I'm using lastes firmware (1.5). Is it final there?

Re: New Home Automation engine and New UI

Posted: 08 Mar 2014 11:10
by pz1
If I understood correctly (viewtopic.php?f=3422&t=20271#p49883) it is NOT the final version

Re: New Home Automation engine and New UI

Posted: 08 Mar 2014 13:07
by PoltoS
It is not final, we will release this next week during CeBIT exhibition. This will be first stable code with automation.

But still we will ontinue to improve it more and more.

Re: New Home Automation engine and New UI

Posted: 08 Mar 2014 22:55
by vwirus
I found very interesting restfull API
would it be also any update for that? It looks like it not have full functionality? am I right?

Re: New Home Automation engine and New UI

Posted: 09 Mar 2014 14:54
by peec2
I really like the new UI. Good job. I have been following the development on GitHub, i'm a JS developer myself with, so i'm familiar with some of the stack you are using such as Backbone etc.. Great project.

I'm going to play around with the API etc. now, forked the repo just now .Going to create a new feature branch to try to create a module that can connect to a web stream to see the camera as a "Widget" :)

Re: New Home Automation engine and New UI

Posted: 09 Mar 2014 15:27
by peec2
I have one question regarding modules / widgets.

So this is my idea: I have a video stream service running with RTMP and Nginx. I want to have a widget that just has a div tag in it that i can use jwplayer to initialize the stream in that specific div tag. Check the screenshot attachment.

Standalone i could forexample create a simple html page:

Code: Select all

<!doctype html>
        <script type="text/javascript" src="/jwplayer/jwplayer.js"></script>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
        file: "rtmp://",

However i see that you have two main divs in the app:

Code: Select all

<div class="main-container">
    <div id="main-region" class="main wrapper clearfix">
        <section id="devices-container" class="widgets"></section><!-- .devices-container -->
        <section id="widgets-container" class="widgets"></section><!-- .widgets -->
    </div> <!-- #main -->
</div> <!-- #main-container -->
I see that the devices are listed in the devices-container using the "WidgetsView" backbone view. Buy i see nothing is connected to the widgets-container. I belive this might be upcomming functionality to have custom widget templates?

Re: New Home Automation engine and New UI

Posted: 09 Mar 2014 21:15
by PoltoS
In fact this is a legacy stuff. Should be cleaned.

Now widgets and devices are same = virtual device.

As for your wish, this is to be in Applications tab in future - not implemented yet. The difference between widget (virt device) and application is that the former is typed and has a unified form for all platforms, while applications will be platform dependant. Means, you can not use your aproach on all platforms (in fact you can, but via broswer embedding).

I think we can easily and fastly add a widget for video streaming and add PTZ buttons for it. We are still thinking on the best design for this.

Re: New Home Automation engine and New UI

Posted: 12 Mar 2014 01:15
by etrust
Hi PoltoS,

we have two questions:

1) When is the official release date for that exaclty? We want to wait for the official release to test.

2) Which version is this exactly?