Skip to content

Added resetAutoReleaseOnDetection property to sensors #169

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Kellojo
Copy link

@Kellojo Kellojo commented Oct 2, 2022

Solving #168

Copy link
Owner

@benzman81 benzman81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please correct the commented lines.

}

HttpWebHookSensorAccessory.prototype.setAutoReleaseTimeout = function () {
if (!this.autoRelease || !this.resetAutoReleaseOnDetection) return;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prevents autoreleases if not resetAutoReleaseOnDetection is set. The flag resetAutoReleaseOnDetection should be handled as optional.


HttpWebHookSensorAccessory.prototype.setAutoReleaseTimeout = function () {
if (!this.autoRelease || !this.resetAutoReleaseOnDetection) return;
clearTimeout(this[this.getTimeoutKey()]);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clearing and resetting timeout should only be done if resetAutoReleaseOnDetection is true. Otherwise it should always add the timeout as before, so nothing break.

HttpWebHookSensorAccessory.prototype.setAutoReleaseTimeout = function () {
if (!this.autoRelease || !this.resetAutoReleaseOnDetection) return;
clearTimeout(this[this.getTimeoutKey()]);
this[this.getTimeoutKey()] = setTimeout(this.resetToInitialState.bind(this), this.autoReleaseTime);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

@benzman81
Copy link
Owner

@Kellojo in case you did not see it, I requested some changes...

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

Successfully merging this pull request may close these issues.

2 participants