Re: [HowTo] Send status updates as UDP messages
Posted: 12 Sep 2015 19:56
I don't see how and why I should iterate. These bindings work perfectly for weeks from the moment they got started properly. To me it seems that the unpredicatble startup behaviour of modules is the core problem.
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:
* note: this is older code that worked well under previous versions for a long time. Here I do make system calls to a script that uses netcat to send UDP messages
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);