CodeDevice - skipEventIfSameValue
michapr opened this issue · comments
Michael P. commented
I would like to recommend to change the function
CodeDevice.prototype.act = function ()
and replace
if ((!setterCode || this.config.updateOnAction === true) && selfValue !== null) {
vDev.set("metrics:level", selfValue);
}
with:
if ((!setterCode || this.config.updateOnAction === true) && selfValue !== null) {
if (this.config.skipEventIfSameValue !== true && selfValue !== vDev.get("metrics:level")) {
vDev.set("metrics:level", selfValue);
}
}
or similar (shorter version ;) )
skipEventIfSameValue is not working in every case - I get a loop in new MQTT app because the CodeDevice switch will be updated every time with same value and I get a new event in result...
Have changed it in local copy and it is working.
Maybe it make sense?
Thanks!
Michael