Add timeout for motion detection (#104)

This commit is contained in:
Marius Muja 2023-11-08 21:08:58 -08:00 committed by GitHub
parent 0b7b8519ef
commit a1dbdbe751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

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