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] 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) {