From 60881341d8b6e7633244152d42646a5fa6f0afc5 Mon Sep 17 00:00:00 2001 From: Beat <66485277+Beat-YT@users.noreply.github.com> Date: Wed, 11 Dec 2024 17:07:55 -0500 Subject: [PATCH 1/2] Fix door close without obstruction sensor With the old code, the door would not close the door when stopped, if you don't have the obstruction sensor connect (e.g door stopped) --- components/ratgdo/ratgdo.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 90cb713..7ecb03e 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -462,9 +462,13 @@ namespace ratgdo { if (this->obstruction_sensor_detected_) { this->door_action(DoorAction::CLOSE); - } else if (*this->door_state == DoorState::OPEN) { - ESP_LOGD(TAG, "No obstruction sensors detected. Close using TOGGLE."); - this->door_action(DoorAction::TOGGLE); + } else { + if (*this->door_state == DoorState::OPEN || *this->door_state == DoorState::STOPPED) { + ESP_LOGD(TAG, "No obstruction sensors detected. Close using TOGGLE."); + this->door_action(DoorAction::TOGGLE); + } else { + this->door_action(DoorAction::CLOSE); + } } if (*this->closing_duration > 0) { From 21d490cb77ebf5f52f084a43fa47119438101caa Mon Sep 17 00:00:00 2001 From: Beat <66485277+Beat-YT@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:47:50 -0500 Subject: [PATCH 2/2] Update ratgdo.cpp --- components/ratgdo/ratgdo.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index 7ecb03e..e7b74fd 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -460,15 +460,11 @@ namespace ratgdo { return; } - if (this->obstruction_sensor_detected_) { - this->door_action(DoorAction::CLOSE); + if (!this->obstruction_sensor_detected_ && (*this->door_state == DoorState::OPEN || *this->door_state == DoorState::STOPPED)) { + ESP_LOGD(TAG, "No obstruction sensors detected. Close using TOGGLE."); + this->door_action(DoorAction::TOGGLE); } else { - if (*this->door_state == DoorState::OPEN || *this->door_state == DoorState::STOPPED) { - ESP_LOGD(TAG, "No obstruction sensors detected. Close using TOGGLE."); - this->door_action(DoorAction::TOGGLE); - } else { - this->door_action(DoorAction::CLOSE); - } + this->door_action(DoorAction::CLOSE); } if (*this->closing_duration > 0) {