1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 03:12:20 +01:00

Fix equality check when setting current-based cover position (#5167)

This commit is contained in:
Stefan Rado
2023-08-21 02:35:13 +02:00
committed by GitHub
parent 0443310385
commit 2a48b810a4

View File

@@ -38,7 +38,7 @@ void CurrentBasedCover::control(const CoverCall &call) {
} }
if (call.get_position().has_value()) { if (call.get_position().has_value()) {
auto pos = *call.get_position(); auto pos = *call.get_position();
if (pos == this->position) { if (fabsf(this->position - pos) < 0.01) {
// already at target // already at target
} else { } else {
auto op = pos < this->position ? COVER_OPERATION_CLOSING : COVER_OPERATION_OPENING; auto op = pos < this->position ? COVER_OPERATION_CLOSING : COVER_OPERATION_OPENING;