Page 2 of 4

Re: New Home Automation engine and New UI

Posted: 12 Mar 2014 23:53
by PoltoS
We are currently on CeBIT and the release version is under massive tests. Since we are submitting to Z-Wave+ certification, we need to check more than five new command classes (some are really big!). Unfortunatelly this takes time. We hope we can release it next week. We wish to release a good product, so please wait a bit more.

Re: New Home Automation engine and New UI

Posted: 13 Mar 2014 00:21
by Pipistrello77
Hi PoltoS!

Flirts of all... Good Job! I'm testing your development (and HomeGenie too) and there are some things i would like to do... But i dont know How!

I want to connect a chance in the status of a device with an action in other device. For instance: switch off once light when switch on another light.
How can i do this?

Thanks!

Re: New Home Automation engine and New UI

Posted: 13 Mar 2014 01:31
by PoltoS
We are making a module for this. This will be in the release

Re: New Home Automation engine and New UI

Posted: 28 Mar 2014 22:15
by Pipistrello77
Hi PoltoS!
do we have some news about the release of automation UI?

regards!

Re: New Home Automation engine and New UI

Posted: 29 Mar 2014 23:31
by aivs
From a trustworthy source, I learned what commands can be send to virtual devices:

// send level to dimmer
deviceDimmer.performCommand("exact", 99);

// turn on switch
//deviceSwitch.performCommand("on");

What command should I use to open/close the lock?
What command should I use to set the thermostat mode and temperature?

Its my module in /opt/z-way-server/automation/modules/SensorBinaryReaction to turn light with motion sensor
index.js

Code: Select all

// ----------------------------------------------------------------------------
// --- Class definition, inheritance and setup
// ----------------------------------------------------------------------------
function SensorBinaryReaction (id, controller) {
    // Call superconstructor first (AutomationModule)
    SensorBinaryReaction.super_.call(this, id, controller);
};

inherits(SensorBinaryReaction, AutomationModule);
_module = SensorBinaryReaction;

// ----------------------------------------------------------------------------
// --- Module instance initialized
// ----------------------------------------------------------------------------
SensorBinaryReaction.prototype.init = function (config) {
    // Call superclass' init (this will process config argument and so on)
    SensorBinaryReaction.super_.prototype.init.call(this, config);
    
    // Virtual device name you can find on http://localhost:8083/ZAutomation/api/v1/devices
    var deviceSensorID = this.config.deviceSensorID; // "ZWayVDev_2:0:48:1"
    var deviceSensor = this.controller.findVirtualDeviceById(deviceSensorID);

    var deviceDimmerID = this.config.deviceDimmerID; // "ZWayVDev_5:0:38"
    var deviceDimmer = this.controller.findVirtualDeviceById(deviceDimmerID);

    var deviceSwitchID = this.config.deviceSwitchID; // "ZWayVDev_4:0:37"
    var deviceSwitch = this.controller.findVirtualDeviceById(deviceSwitchID);

    var hourMorning = this.config.hourMorning;
    var hourEvening = this.config.hourEvening;

    // handler - it is a name of your function
    this.handler = function () {
        var date = new Date();
        var hourNow = date.getHours();

    	console.log("SensorBinaryReaction",deviceSensorID,"=",deviceSensor.getMetricValue("level"));
        console.log("SensorBinaryReaction",deviceDimmerID,"=",deviceDimmer.getMetricValue("level"));
    	console.log("SensorBinaryReaction",deviceSwitchID,"=",deviceSwitch.getMetricValue("level"));
        console.log("hourMorning =",hourMorning, "hourEvening =",hourEvening, "hourNow =",hourNow);
    	// turn ON switch if sensor state is true
    	if (deviceSensor.getMetricValue("level") == true) {
    		console.log ("Sensor triggired");
            // Between 0 and 7 hours, light at 20%
            if (hourNow >= hourEvening && hourNow < hourMorning) {
                console.log("hourEvening =",hourEvening);
                deviceDimmer.performCommand("exact", 20);
                deviceDimmer.performCommand("on");
            }
            // An another time, light at 99%
            else {
                console.log("hourMorning =",hourMorning);
                deviceDimmer.performCommand("exact", 99);
                deviceDimmer.performCommand("on");

                // turn on switch
                //deviceSwitch.performCommand("on");
            }
    	}
    	
    };

   // Setup metric update event listener
   // device.metricUpdated is a reserved zway word
    this.controller.on('device.metricUpdated', this.handler);
};

SensorBinaryReaction.prototype.stop = function () {
    SensorBinaryReaction.super_.prototype.stop.call(this);

    if (this.handler)
        this.controller.off('device.metricUpdated', this.handler);
};
module.json

Code: Select all

{
    "autoload": true,
    "singleton": false,
    "defaults": {
	"deviceSensorID": "ZWayVDev_2:0:48:1",
	"deviceSwitchID": "ZWayVDev_4:0:37", 
	"deviceDimmerID": "ZWayVDev_5:0:38",
	"hourMorning": 7,
	"hourEvening": 0
    }
}

Re: New Home Automation engine and New UI

Posted: 31 Mar 2014 02:30
by Pipistrello77
Thanks Aivs.
I think i could use your code (reviewed) to address my problem (turn off a light when i turn on a diferent light).
I have just test BindDevices automation module and works fine but it is not covering my needs (because only binds the exact status between devices)

Re: New Home Automation engine and New UI

Posted: 31 Mar 2014 22:09
by PoltoS
@Pipistrello77 what are your needs? We are willing to improve this module to fit common requirements.

Re: New Home Automation engine and New UI

Posted: 31 Mar 2014 23:33
by Pipistrello77
hi PoltoS! Thanks for your interest!
As i could see, the new module called "BindDevices" build a complete "conection" between two devices, so if you turn on -for instance- ligh 1 (event source), ligh2 (actor) will turn on at the same time. And, with no more configuration... if you turn off ligh1, light2 will turn off inmediately.

I need can to choose separate this two ways of bindings (for instance, only bind "turn on" events, but not "turn off", so if i turn on ligh1, ligh2 will turn on... but if i turn off ligh1... will NOT turn off ligh2.
If i want to bind "turn off" events i would like to set a new binding between devices.

Furthermore, i would like to choose what "event" will be the trigger (turn on, turn off, a specific device from a door sensor ("open", "close", etc...) or other kind of devices (tipically sensors, meters, etc... that could trigger other actions in different devices). And the same for the "action" to be perfomed by the actor... turn on, turn off, etc...

For instance, in my case i would like to turn off roof lights in my living room when i turn on a little light in a corner table in the living room (when i'm watching one of my favourite tv series :-))

In the future, if we develop "virtual devices" from an application, a local service in the machine, DLNA service, etc, etc... we could bind "events" in any virtual device with other. For instance, if i detect a "play" state in my DLNA player i could turn off the lights to make a good ambient :-)
Yes, i'm very lazy.

Re: New Home Automation engine and New UI

Posted: 05 Apr 2014 12:22
by Eric
Hi PoltoS,

I'm having some trouble getting LightScene to work with dimmers. First I had to make the change below to make performCommand send what the virtual device expects. But then another problem I find is that I cannot set a dimmer to 0, somewhere along the line 0 seems to be interpreted as null/undefined and it disappears. When I edit the module settings again the value is gone and there is a warning that it should be between 0 and 99.

Code: Select all

diff --git a/modules/LightScene/index.js b/modules/LightScene/index.js
index cdf54a5..dc0c3ef 100644
--- a/modules/LightScene/index.js
+++ b/modules/LightScene/index.js
@@ -40,7 +40,7 @@ LightScene.prototype.init = function (config) {
         self.config.dimmers.forEach(function(devState) {
             var vDev = self.controller.findVirtualDeviceById(devState.device);
             if (vDev) {
-                vDev.performCommand("exact", devState.state);
+                vDev.performCommand("exact", {"level": devState.status});
             }
         });
         self.config.scenes.forEach(function(scene) {

Re: New Home Automation engine and New UI

Posted: 10 Apr 2014 19:42
by pz1
PoltoS wrote:We are currently on CeBIT and the release version is under massive tests. Since we are submitting to Z-Wave+ certification, we need to check more than five new command classes (some are really big!). Unfortunatelly this takes time. We hope we can release it next week. We wish to release a good product, so please wait a bit more.
Any update on this?