From 04de314a2842af91471f48b69036e863f8d9cd95 Mon Sep 17 00:00:00 2001 From: Djordje <6750655+DjordjeMandic@users.noreply.github.com> Date: Wed, 19 Feb 2025 01:11:12 +0100 Subject: [PATCH] [remote_base] NEC, binary sensor change improve --- esphome/components/remote_base/nec_protocol.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/esphome/components/remote_base/nec_protocol.cpp b/esphome/components/remote_base/nec_protocol.cpp index 256e350d0e..708fc5ffda 100644 --- a/esphome/components/remote_base/nec_protocol.cpp +++ b/esphome/components/remote_base/nec_protocol.cpp @@ -193,6 +193,8 @@ bool NECBinarySensor::matches(RemoteReceiveData src) { return false; } + bool last_waiting_state = this->waiting_for_repeat_code_; + switch (res.value().type) { case NECCodeType::FRAME_WITH_REPEATS: // Set waiting to true only if currently not waiting and this is our desired frame. @@ -209,6 +211,11 @@ bool NECBinarySensor::matches(RemoteReceiveData src) { break; } + if (last_waiting_state && !this->waiting_for_repeat_code_) { + this->publish_state(false); + this->cancel_timeout("repeat"); + } + return this->waiting_for_repeat_code_; }