Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeDevice - skipEventIfSameValue #517

Open
michapr opened this issue Jan 21, 2021 · 0 comments
Open

CodeDevice - skipEventIfSameValue #517

michapr opened this issue Jan 21, 2021 · 0 comments

Comments

@michapr
Copy link
Contributor

michapr commented Jan 21, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant