Z-Wave-Me / home-automation

Z-Way Home Automation engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeDevice - skipEventIfSameValue

michapr opened this issue · comments

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