diff --git a/CHANGELOG.md b/CHANGELOG.md index 925be337..faa3ed9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/converters/cover.ts b/src/converters/cover.ts index b0350968..aa64f46c 100644 --- a/src/converters/cover.ts +++ b/src/converters/cover.ts @@ -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; @@ -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;