From a1dbdbe75147e949d86b74936dd563807b5a1095 Mon Sep 17 00:00:00 2001 From: Marius Muja Date: Wed, 8 Nov 2023 21:08:58 -0800 Subject: [PATCH] Add timeout for motion detection (#104) --- components/ratgdo/ratgdo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/ratgdo/ratgdo.cpp b/components/ratgdo/ratgdo.cpp index cd48835..b6ad370 100644 --- a/components/ratgdo/ratgdo.cpp +++ b/components/ratgdo/ratgdo.cpp @@ -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); }