Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions components/ratgdo/ratgdo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,13 @@ namespace ratgdo {
// if the line is high and was last asleep more than 700ms ago, then there is an obstruction present
if (current_millis - last_asleep > 700) {
this->obstruction_state = ObstructionState::OBSTRUCTED;
#ifdef PROTOCOL_DRYCONTACT
if (*this->door_state == DoorState::CLOSING) {
this->received(DoorState::OPENING);
// If obstruction sensor is tripped during closing,
// assume the motor has reversed direction.
}
#endif
}
}
}
Expand Down Expand Up @@ -644,13 +651,23 @@ namespace ratgdo {
return;
}

#ifdef PROTOCOL_SECPLUSV2
// Most ROW Sec+ 2 openers don't actually have obstruction sensors,
// they ignore the discrete close command, but accept a toggle command.
if (this->flags_.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
this->door_action(DoorAction::CLOSE);
#endif

#ifdef PROTOCOL_DRYCONTACT
// Dry Contact protocol can't query state from GDO
// The protocol sets state via limit switch
#else
if (*this->closing_duration > 0) {
// query state in case we don't get a status message
set_timeout("door_query_state", (*this->closing_duration + 2) * 1000, [this]() {
Expand All @@ -660,6 +677,7 @@ namespace ratgdo {
}
});
}
#endif
}

void RATGDOComponent::door_stop()
Expand Down