From 4598647843945e51852a307a65cb19cc757cce61 Mon Sep 17 00:00:00 2001 From: Marius Muja Date: Wed, 8 Nov 2023 15:12:02 -0800 Subject: [PATCH] Add timeout for motion detection --- 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); }