Binding to value change fires multiple times / bug ?
Posted: 18 Sep 2015 10:40
Hello!
I Activated app "Load custom JavaScript file" and wrote very simple js file with code that binds to sensor value change like this:
zway.devices[6].instances[3].SensorMultilevel.data[1].val.bind(function () {
var val = this.value;
http.request({
url : "http://myserver/temperature_log/?sensor=mysensor&value=" + val,
method : "GET"
});
});
Everything works fine, except that value change is triggered multiple times. I noticed, that when I saved and activated App for the first time, on next value change it triggered only once as supposed to. However, when I Activated and deactivated the app again, it began to trigger twice. When activated and deactivated one more time, it began to fire 3 times and so on. Basically each time I hit deactivate and activate, it just adds one time to stack.
Is this intended behavior?
Best regards
I Activated app "Load custom JavaScript file" and wrote very simple js file with code that binds to sensor value change like this:
zway.devices[6].instances[3].SensorMultilevel.data[1].val.bind(function () {
var val = this.value;
http.request({
url : "http://myserver/temperature_log/?sensor=mysensor&value=" + val,
method : "GET"
});
});
Everything works fine, except that value change is triggered multiple times. I noticed, that when I saved and activated App for the first time, on next value change it triggered only once as supposed to. However, when I Activated and deactivated the app again, it began to trigger twice. When activated and deactivated one more time, it began to fire 3 times and so on. Basically each time I hit deactivate and activate, it just adds one time to stack.
Is this intended behavior?
Best regards