source of a bind() information push
Posted: 03 Nov 2013 21:16
I have a number of devices that sent out temperature updates/sets - that I'd like to run some code on (a PID controller and a calendar based override).
What is the proper way to get the zDeviceID et.al. ? The naive code below is obviously not working ?
Thanks,
Dw.
PS: Also wondering if there is a way to trigger z-way to reload a *.js file (and give line numbers for errors) on the fly.
// File: /opt/z-way-server/automation/test.js
//
for(var i =2; i < 10; i++) {
console.log("registering "+i);
zway.devices.instances[0].ThermostatSetPoint.data[1].val.bind(function () {
console.log("Device ?? got set to " + this);
});
zway.devices.instances[0].SensorMultilevel.data[1].val.bind(function (somearg) {
console.log("Device "+somearg+" read value " + this);
});
}
// Does not yet exit this early?
// zway.dataUpdate.bind(function(a,b,c,d) { console.log("Some dataUpate "+a+"/"+b+"/"+c+"/"+d+" = "+this); });
What is the proper way to get the zDeviceID et.al. ? The naive code below is obviously not working ?
Thanks,
Dw.
PS: Also wondering if there is a way to trigger z-way to reload a *.js file (and give line numbers for errors) on the fly.
// File: /opt/z-way-server/automation/test.js
//
for(var i =2; i < 10; i++) {
console.log("registering "+i);
zway.devices.instances[0].ThermostatSetPoint.data[1].val.bind(function () {
console.log("Device ?? got set to " + this);
});
zway.devices.instances[0].SensorMultilevel.data[1].val.bind(function (somearg) {
console.log("Device "+somearg+" read value " + this);
});
}
// Does not yet exit this early?
// zway.dataUpdate.bind(function(a,b,c,d) { console.log("Some dataUpate "+a+"/"+b+"/"+c+"/"+d+" = "+this); });