Light turn after motion clear (unless motion detected again!)

I know this is fairly common, but there are many ways and I can’t really understand the solutions people are suggesting. I just want a quick sanity check. My situation/solution:

I have a wyze motion sensor that detects motion, then will give the command “motion cleared” after 45 seconds. I’m trying to make my logic block delay turning off the light unless the motion sensor turns true again. Before, I had the true condition turning on the light, and put a delay on the false condition when IFTTT sends the “motion cleared” signal coming from the wyze sensor. But it looks like once the false action is received, after the delay, it will execute regardless if the sensor turned true within that delay period.

My latest solution: I have IFTTT turn on the light directly when motion is detected, and now use the “motion cleared” signal as a true condition with the delay on it (as opposed to putting the delay on the logic block).

My hope is that while the condition itself has received a “motion cleared” true signal, but the actual triggering of the logic block is delayed, the condition’s delay will be reset if the variable changes back to false (motion detected). Is this the case?

Sorry for the lengthy post. I’m absolutely loving this app btw! :raised_hands:t3::grin:


So I actually just saw someone had posted this on a thread a year ago. I didn’t click on it at first because I thought it was an ad :sweat_smile:. It’s lengthy (but very creative!) way to accomplish the retriggering of the “off delay” if motion is detected again. I like this a lot, and it sounds like a fun project :upside_down_face:. But… is it overkill? I know you can send events to IFTTT to ping your logic block again, but when I tried it my lights began to trigger sporadically. I’ve posted the link I found below in case it helps anyone else! text


Welcome Pipeerspakz I used that a lot for my motion sensors! It has now been superseded by Apilio, I now use this for my motion sensors. It works well


Welcome @pipersparkz!!

The use case that @Drivingforce is liking is the newest version of @jrmckins amazing article ( ) , using the latest features we released :slight_smile: Have a look at that one :point_down: and let us know if you have any questions:


Oh interesting, so there is no false (motion cleared) action being sent from IFTTT in this method. So even if the boolean never gets set to false, when IFTTT reads motion and pings the variable the timeout timer will be reset?

It hasn’t been working with the false action being sent, but maybe it’s because it sends that false to the logicblock and ques the negative part of the action chain…

1 Like

Yes, there is no “false”, because many PIR sensors just don’t have one event that does that: they only have the “true” event, when they detect something. By adding a timeout to that condition, you are effectively resetting the information you got from the sensor by saying that you only consider it to be valid for those 5 minutes.

It’s like a reset of your sensor, even if your sensor doesn’t have this capability, you can add this to your logic with Apilio :slight_smile:

1 Like

Amazing! It works like a charm lol. I should’ve posted for help a week ago. I actually read that article earlier, but for some reason it took a while to click for me. Thank you so much!

Please keep it up guys, y’all are awesome!! :pray:t2:


Hey y’all I have one more question… I’ve subbed the “it’s dark outside” function for a “I’m in the kitchen” condition and added it to my logic block. So if it is false, that means I’m in the kitchen and do nothing. But if the logic block as already been triggered and I make the other condition false, will it still cut off the lights? Or will it stop the logic block? Do I need to press this button BEFORE the motion sensor detects motion?

1 Like

So the lights keep turning off even though my “I’m in the kitchen” variable is false. Is this because when my motion sensor detects motion it’s triggering the logic block regardless? Here’s a screenshot of the actions:

1 Like

Having a quick look so i have straight in my head I may be stating the obvious
When you are not in the kitchen you want a light to come on
But when you are in the kitchen you want it to go off. I assume you want to to go back on when you leave the kitchen.
Do you have just the one motion sensor. Where is that located?

1 Like

Ugh sorry I know I set it up confusingly. My goal is to basically “deactivate” the logic block while I’m in the kitchen so the light doesn’t turn off. For some reason the lights will still go off when I’m still in the kitchen (probably due to the interaction between my motion sensor and IFTTT). So I created a Boolean condition that must be true in order for it to turn off after 10 minutes (e.g. I’m just walking into the kitchen, getting water, walking out). When I’m in the kitchen cooking for an hour I want it to just stay on, so I switch the Boolean to false, so that the logic block isn’t allowed to activate.

The motion sensor is on the wall above my stove facing the center of the kitchen and entryway. So I’m constantly in front of it (which may be the issue as well)

Got you I already have the same set up.

what you need is a Boolean value called Kitchenmotion
a condition called ktchenmotion based on boolean value kitchenmotion required state true.
Trigger condition is set and time out and delay setting 10 minutes

On the logiblock true will turn on the light and will stay on so long as the motion sensor detects you once with in the 10 minutes (resets the countdown timer)
After 10 minutes the logi block will go to false turning of the light
hope that makes sense

1 Like

That’s what I had before, but it still was shutting off. Im wondering if it was just my motion detector not going off because i kept standing in front of it for long periods of time. But wait… did you say set BOTH the timeout and delay to 10 minutes? Right now I just have the timeout set for 10 minutes.

P.S. I have IFTTT sending the actual command to turn on the light to reduce the delay. But then I let Apilio turn it off (smart life switch :wink: ). IFTTT still sends a separate command to the “motiondetected” boolean though.

EDIT: Damn… I’m reading through the event log and it looks like its working perfectly. What seems to be happening is either my motion sensor and/or IFTTT isn’t sending out a “motion detected” signal often enough. It’s like I have to walk away for a second in order for it to trigger again. Probably nothing I can do about that huh? :confused:

No nothing that can be done, if my family is sitting for dinner and being quite for a change my lights go off after 10 minutes. So pays to have something moving :smile:

1 Like

hahaha yea ok no worries. Maybe I could get another motion sensor and point it perpendicularly to catch the X-Z motion as well as the X-Y motion and point them both to the boolean? These things are pretty cheap, may be worth an experiment. I’ll let you know how it goes if i end up doing that!

Also… Big ups to the Apilio team for adding all this functionality. I’ve been watching the timeline of you guys and it’s pretty impressive how many features you’ve been able to create just from shear necessity. Very impressive as I know these things are much more difficult to add/create than they seem. Bravo! :clap:


Hi @pipersparkz,
intersting discussion going on and thanks a lot for the feedback :blush:
I guess the “issue” here is that the Wyze motion sensor already has built in the timeout functionality. So (just a guess) as long as you are moving in front of the sensor it will not send another “motion detected” event again. You have to leave the room, the sensor clears the movement and only then will send a new motion detected event again.
To debug, it might help to have an IFTTT applet just to send you notifications on the events directly so you understand how the Wyze sensor works. And maybe there are configuration options in the sensor to change the behaviour?
Once you get the hang on how the sensor works I’m sure we are able to find a solution for the Logicblock :slight_smile:

1 Like

So to tack onto this discussion… I think I will make some sort of secondary program to use when I’m spending time in the kitchen. I would make some sort of loop that pings my “motiondetected” boolean every 5 minutes until I choose to turn it off (using a button connected to a boolean in apilio). Is this overkill?

Previously I tried to use the same methodology as “its_dark_outside” condition, but if the logicblock gets triggered before I turn this variable off (meaning i’m in the kitchen so treat it like it’s NOT dark outside), then it runs anyway.

So my workaround is just to brute force it (which I am a fan of lol) and just keep sending true commands through a separate loop. What do y’all think?

Now you lost me :smile:
The basic problem is that you are moving too little so that the PIR doesn’t sense your presence, right?
Do you own a voice assistant? With that or a physical switch you could change a Boolean variable and add logic so that if it is set, the automatic-turn-off-Logicblock is not doing anything for an hour or so.

1 Like

I should participate more often if only to see my blog post called “amazing” :slight_smile:


Good to see you, Jim! :smiley: And thanks again for that great article :slight_smile: I think you will love that new timeout feature, let us know if you give it a go!!