1
0
mirror of https://github.com/esphome/esphome.git synced 2025-03-15 15:18:16 +00:00

[remote_base] NEC, binary sensor change improve

This commit is contained in:
Djordje 2025-02-19 01:11:12 +01:00
parent da8ba7c95a
commit 04de314a28

View File

@ -193,6 +193,8 @@ bool NECBinarySensor::matches(RemoteReceiveData src) {
return false; return false;
} }
bool last_waiting_state = this->waiting_for_repeat_code_;
switch (res.value().type) { switch (res.value().type) {
case NECCodeType::FRAME_WITH_REPEATS: case NECCodeType::FRAME_WITH_REPEATS:
// Set waiting to true only if currently not waiting and this is our desired frame. // 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; break;
} }
if (last_waiting_state && !this->waiting_for_repeat_code_) {
this->publish_state(false);
this->cancel_timeout("repeat");
}
return this->waiting_for_repeat_code_; return this->waiting_for_repeat_code_;
} }