Anyhow it is at yet unclear to me how I should iterate the bindings. Does it have to go forever, or is there a stop criterion
As said before, I did elaborate on the code for individual devices I got from PoltoS:
Code: Select all
this.bindFunc1 = function(zwayName)
{
if (zwayName != "zway") return; // you want to bind to default zway instance
global.ZWave[zwayName].zway.devices[2].instances[0].SwitchBinary.data.level.bind(function()
{
var status = (this.value) ? "on" : "off";
system("/opt/z-way-server/automation/storage/status.sh", "ZWay_2," + status ) ;
} );
};
global.controller.on("ZWave.register", this.bindFunc1);
// UserCode module have not stop destructor, so this is commented...
// global.controller.off("ZWave.register", this.bindFunc1);