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

Fix cover not updating correctly #292

Merged
merged 2 commits into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Since version 1.0.0, we try to follow the [Semantic Versioning](https://semver.o
### Fixed

- Removed unnecessary code from climate service.
- Polling mechanism for `cover` improved. In past releases the plugin could stop requesting updates too early. (see [#292](https://github.com/itavero/homebridge-z2m/pull/292))

## [1.6.0] - 2021-08-24

Expand Down
6 changes: 3 additions & 3 deletions src/converters/cover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ class CoverHandler implements ServiceHandler {
if (this.positionExpose.property in state) {
const latestPosition = state[this.positionExpose.property] as number;

// Received an update: Reset flag
this.waitingForUpdate = false;

// Ignore "first" update?
const doIgnoreIfEqual = this.ignoreNextUpdateIfEqualToTarget;
this.ignoreNextUpdateIfEqualToTarget = false;
Expand All @@ -143,6 +140,9 @@ class CoverHandler implements ServiceHandler {
return;
}

// Received an update: Reset flag
this.waitingForUpdate = false;

// If we cannot retrieve the position or we were not expecting an update,
// always assume the state is "stopped".
let didStop = true;
Expand Down