Skip to content

Commit 348e440

Browse files
authored
Wall panel detection (#305)
* Fix wall panel detection
1 parent 88b3bdf commit 348e440

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

components/ratgdo/secplus1.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ namespace ratgdo {
6565
void Secplus1::wall_panel_emulation(size_t index)
6666
{
6767
if (this->wall_panel_emulation_state_ == WallPanelEmulationState::WAITING) {
68-
ESP_LOG1(TAG, "Looking for security+ 1.0 wall panel...");
68+
ESP_LOGD(TAG, "Looking for security+ 1.0 wall panel...");
6969

7070
if (this->door_state != DoorState::UNKNOWN || this->light_state != LightState::UNKNOWN) {
7171
ESP_LOG1(TAG, "Wall panel detected");
7272
return;
7373
}
7474
if (millis() - this->wall_panel_emulation_start_ > 35000 && !this->wall_panel_starting_) {
75-
ESP_LOG1(TAG, "No wall panel detected. Switching to emulation mode.");
75+
ESP_LOGD(TAG, "No wall panel detected. Switching to emulation mode.");
7676
this->wall_panel_emulation_state_ = WallPanelEmulationState::RUNNING;
7777
}
7878
this->scheduler_->set_timeout(this->ratgdo_, "wall_panel_emulation", 2000, [=] {
@@ -293,7 +293,10 @@ namespace ratgdo {
293293

294294
void Secplus1::handle_command(const RxCommand& cmd)
295295
{
296-
if (cmd.req == CommandType::QUERY_DOOR_STATUS) {
296+
if (cmd.req == CommandType::TOGGLE_DOOR_RELEASE || cmd.resp == 0x31) {
297+
ESP_LOGD(TAG, "wall panel is starting");
298+
this->wall_panel_starting_ = true;
299+
} else if (cmd.req == CommandType::QUERY_DOOR_STATUS) {
297300

298301
DoorState door_state;
299302
auto val = cmd.resp & 0x7;
@@ -365,10 +368,6 @@ namespace ratgdo {
365368
} else if (cmd.req == CommandType::OBSTRUCTION) {
366369
ObstructionState obstruction_state = cmd.resp == 0 ? ObstructionState::CLEAR : ObstructionState::OBSTRUCTED;
367370
this->ratgdo_->received(obstruction_state);
368-
} else if (cmd.req == CommandType::TOGGLE_DOOR_RELEASE) {
369-
if (cmd.resp == 0x31) {
370-
this->wall_panel_starting_ = true;
371-
}
372371
} else if (cmd.req == CommandType::TOGGLE_LIGHT_PRESS) {
373372
// motion was detected, or the light toggle button was pressed
374373
// either way it's ok to trigger motion detection

0 commit comments

Comments
 (0)