From 392ed64375a07435ee78c5b011ac6c1ec2683aa5 Mon Sep 17 00:00:00 2001 From: Guillermo Ruffino Date: Sun, 28 Mar 2021 22:35:39 -0300 Subject: [PATCH] fix servo not reattaching with same target (#1649) --- esphome/components/servo/servo.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/components/servo/servo.cpp b/esphome/components/servo/servo.cpp index 6935c34653..57baf4aecf 100644 --- a/esphome/components/servo/servo.cpp +++ b/esphome/components/servo/servo.cpp @@ -52,6 +52,8 @@ void Servo::loop() { void Servo::write(float value) { value = clamp(value, -1.0f, 1.0f); + if (this->target_value_ == value) + this->internal_write(value); this->target_value_ = value; this->source_value_ = this->current_value_; this->state_ = STATE_ATTACHED;