Add timeout for motion detection

This commit is contained in:
Marius Muja 2023-11-08 15:12:02 -08:00
parent 0b7b8519ef
commit 4598647843
1 changed files with 3 additions and 0 deletions

View File

@ -240,6 +240,9 @@ namespace ratgdo {
} }
} else if (cmd == Command::MOTION) { } else if (cmd == Command::MOTION) {
this->motion_state = MotionState::DETECTED; this->motion_state = MotionState::DETECTED;
this->set_timeout("clear_motion", 3000, [=] {
this->motion_state = MotionState::CLEAR;
});
if (*this->light_state == LightState::OFF) { if (*this->light_state == LightState::OFF) {
this->send_command(Command::GET_STATUS); this->send_command(Command::GET_STATUS);
} }