Code: Select all
setTimeout( function() {
function NodeNotifier(nodeID, value)
{
var pushstring = 'NID=' + nodeID + '&VAL=' + value;
debugPrint("NodeNotifier: " + pushstring);
http.request({ method:'GET', url:'127.0.0.1:8888/push&' + pushstring });
}
// ------------------------------------
debugPrint('Homeserver: Binding devices devices to NodeNotifier...');
// Demo lamp
try { zway.devices[4].instances[0].commandClasses[37].data.level.bind( function() { NodeNotifier('4', this.value); } ); } catch (e) { debugPrint('\nERROR: Failed to bind to zway.devices[4].instances[0].commandClasses[37].data.level!\n'); }
// ... other device bindings ...
}, 60*1000);
The first issue is the ugly hack using the setTimeout() function. If I don't use this, the zway instance including the devices may not yet be available during system startup.
I have not found a better solution yet to synchronize that. Does anyone have an idea for a better solution?
Coming to the topic of this message: Is it possible to "unbind" everything? If I update the custom binding file, I have to completely restart the z-way server as otherwise I would get redundant multiple bindings when reloading the CustomUserCode plugin.
In my eyes, the best thing would be being able to unbind anything I've previously bound to any event.
Is there a good way to do so?
Thanks in advance for your help!