If you are like me, then you have been wondering how to allow IFTTT applets to only run at a certain time.
For example: turn on lights with a motion sensor, but only when it’s at night. It is possible to do this and I will show you how.
First, head over to the IFTTT Platform at this link: https://platform.ifttt.com/maker/get_started. Here you can create applets with extra functionality.
In this article, I will show you how to turn on a light bulb with a Wyze Sense motion sensor, but only between 8 pm and 5 am. Of course, you can change out the devices and times for whatever you are looking to do.
To get started, click on the New Applet button.
Type in the service you want to use. In my case, I’m going to use Wyze and then I will select the Motion Sensor detects motion.
Next, it will show you a section for selecting the device. You won’t be able to select the device until you activate this applet so just move on to the next part.
Click on Add action which you will search for the service just like the trigger part. For my example, I am going to use the Smart Life service to turn on an inexpensive bulb. The next dropdown I changed it to Turn on since I’m turning on the light when it detects motion.
After adding the action, you can now turn on the filter button. Click on Add filter code to open up the area where you will be able to add the code. This will make the applet only run between 8 pm and 5 am.
Paste in the code below and I will let you know what to modify.
var currentHour = Meta.currentUserTime.hour()
if (currentHour >= 20 || currentHour < 5 ) {
// Run the applet
} else {
// Skip the action
Smartlife.turnOn.skip()
}
There are only a few things you would need to change. First is the last line Smartlife.turnOn.skip() and you can find out what to replace it with on the right side under Actions.
Whatever service you are using will have a different name under Actions for you to copy and paste.
The other thing you may want to adjust is the time when you don’t want the applet to run. This is based on the 24-hour clock. 20 is 8 pm and 5 is 5 am, so if you wanted to have it run between 6 pm and 7 am you would change it to “if (currentHour >= 18 || currentHour < 7 ) {”
After you have adjusted the code, you will need to add the Applet title and description. Then click Save down at the bottom.
Once you have clicked Save you will see a link Enable it on IFTTT and click on that.
Change the slider to On. This will show the familiar screen of adding the devices to the Applet. Choose the devices and click Save.
Now it’s all set up! Enjoy your new automation that only runs at the time you want it to.
Could you show me in detail how to set up the Wyze sense with Merkury Smart Wi-Fi Plug running with geeni App? I want the motion sensor trigger the Wi-Fi Plug, so that I can plug in a Siren. Whenever a motion is detected by the motion sensor the Wi-Fi Plug will be on and supply the power to the Siren. I do not know how to set up. DO I need the IFTTT ?
Hi Ann, it doesn’t look like Merkury Smart devices work with IFTTT right now. Since it does work with Alexa then you should be able to get the Wyze Sense to work with it through that in the future. Right now Wyze Sense doesn’t connect to Google Assistant or Alexa so we will have to wait till that is available. There are plenty of inexpensive smart outlets that work with IFTTT though if you want it to work right away. https://amzn.to/2Lvp2rO https://amzn.to/2YeJaQs
Are you able to connect these sensors to any IFTTT recipe? Like are you able to connect one of the door sensors to a cookie jar so that when you lift the lid it sends an SMS message to a specific phone number?
Fabian yes you can connect to any IFTTT recipe. So you can get an SMS message if someone opens the cookie jar!
Is there any way for the action to trigger only if the motion has been clear for a certain time period? For example, lights turn off if motion has been clear for 10 minutes.
Hey Adrian it looks like there might be a few ways to do it in IFTTT which are listed here https://webapps.stackexchange.com/questions/33674/ifttt-can-you-specify-a-delay-for-an-action but I personally would hook up my IFTTT event to SmartThings using Virtual Switches or use webCoRE. Then handle the automation logic in SmartThings or webCoRE.
Please can you make me code for arlo cam when detects montion between 1:00 am to 6 : 00 am call my phone
Set the service to be Arlo and select detects motion. Then for the second service choose Phone Call. Here is the filter code you can use.
var currentHour = Meta.currentUserTime.hour()
if (currentHour >= 1 || currentHour < 6 ) { // Run the applet } else { // Skip the action PhoneCall.callMyPhone.skip() }
Thanks for the above instructions. My applet works properly if I want something activated between 11PM and 6AM using
if (currentHour >= 23 || currentHour = 1 || currentHour < 6 )
My action is triggered outside of that window. For instance, it is currently just past 11PM, but with the 1 and 6 entered in, the action is still being triggered. Am I doing something wrong?
Thanks!
Hello,
I followed same steps to create an applet in IFTTT app, but it does not work. I have this smart switch, which is IFTTT supported. Please let me know if i am missing something
https://www.amazon.com/gp/product/B07FXYSVR1/ref=ox_sc_act_title_4?smid=AJGW5GT73LCY0&psc=1
Hey Reed!
I was wondering if you could help me out. I have a Philips Hue smart bulb at the entrance hall in my house. I’ve discovered it with Alexa and I can control that light with that assistnat. I have also a Wyze motion sensor set on a wall at the entrance hall and was trying this IFTT recipe out. I want to come into the hall and have the light to turn on when the sensor detects motion. The thing is it sometimes turns on but most times it doesn’t.
The motion sensor does see I’m moving since the Wyze app says so, but the rest of the action does not take place. The light remains off. I was wondering why could this be?
I thought maybe another command could be stepping over this IFTT recipe? But I can’t determine what’s the problem. If you could help me out I’d be grateful. Thanks!
Hi Pablo. Sorry for the delay in getting back to you. First thing I would do is add another action to your IFTTT recipe like a notification to your phone or something. That way you can make sure that the motion is triggering the IFTTT action. If the motion sensor is triggering the IFTTT action but the light isn’t turning on then you can narrow it down to just the Hue light.
Do you have anything else connected to your Hue lights? Like SmartThings or any other hubs?
Thank you very much, you´re awesome!
IS there anyway to make the time values change to sunrise/sunset times? ie make this applet only run at night?
Hi Tyler, you can just put in the hour of sunset and sunrise where you live. If the sun sets at 7 pm and sunrise is at 6 am. Instead of “currentHour >= 20 || currentHour < 5" change it to "currentHour >= 19 || currentHour < 6" because 19 is 7pm.
Thanks Reed, although these change continuously. Is there no way to actually have sunset/sunrise according to your time zone?
Also, is there a way to trigger a timer? so that the light then turns off after e certain number of minutes?
I can’t seem to get any applet to run. I safe correctly and follow how to setup but can’t seem to get things to run. Is there a major setting that I could be missing?
Hi Glenn. One thing that could be happening is that you are testing it out during the day when the applet will only run at night if you used those times listed. You could try changing the time that the applet will run to include the time of day you are testing to see if that will fix it?
I want to learn how to program with iftt, your tutorial worked but i want to do it myself, not only this applet but many more
is there any way set a 5 sec timer before running the action
I really like the way you gave us screen shots and explanations. I set it up and it works every time with my Lutron Caseta light switch. The issue I is there is a 15-20 min. delay before it triggers. Can you give me some suggestions please? If I take the time delay out it works instantaneously.
Excellent, thank you very much!!!!
Hi Reed!
I need your help. I have two Lifx smart blubs in my living room and two in my bedroom . I want my living room lights to turn on when my Wyze door sensor is opened between the hours of 7pm to 3am at 50% brightness and have them stay on for 5 mins. I would also like my Wyze motion sensor in my bedroom to cut on my lights when motion detected between the hours of 7pm to 11pm at 30% brightness and stay on for 5 mins. I haven’t been able to figure right recipe to get this to work . If you could help me I’d really appreciate it . Thank you in advance!
Hi Rodrick!
I have looked at doing this myself just using IFTTT and I couldn’t find anything that seemed to work reliably. The best thing I was able to do is have all the automation logic be handled in SmartThings. It’s very easy to set up all of these automations you listed in SmartThings. You could also keep using your Wyze motion/contact sensors with your LIFX lights. You would just need to add Virtual Switches for your Wyze sensors. I did a video on this https://youtu.be/Ys5vQdr_1WA and once you add the Wyze sensors as individual virtual switches in SmartThings you can go crazy with all the automations you want with it. It’s just a one time set up so it’s not too much work. I wish I knew a better way to do it just in IFTTT but if you have any questions about using something like SmartThings just let me know!
Hey Reed! I’m a new subscriber to your channel. I love your videos!
I have the wyze sensor and I’m trying to use it with the govee light strip. I can’t figure out how to make it work! I want to have the strip lights come on under the bed when I get up in the night. Any help would be appreciated.
Hey Jason! Thanks for subscribing and I’m glad to hear you like the videos!
Right now Govee doesn’t work with IFTTT. It’s really annoying that they don’t. Since most Govee light strips work with Alexa there may be a way to do it in the future if Wyze Sense becomes compatible with Alexa.
I have some Govee lights plugged into the back of my TV and to automate them I have them plugged into a smart plug that is IFTTT compatible. The Govee lights change colors to start up which behind the TV look pretty cool. I don’t know if that would work for you under the bed though.
Hi Reed,
Your tutorial has set me in motion trying to solve a proble of my own but as yet, I can’t work it out – any pointers?
I have a smart life door switch and an ewelink controlled switch.
What I want to do is at 8:30pm check if the door is open and if so, activate the switch.
I can set the time as the trigger and the action id easy but the filter in the middle I just cant work out.
I found the java names by setting the door switch as the trigger and it shows these two pieces –
Trigger data
Smartlife.doorOpen.CreatedAt
Smartlife.doorOpen.DeviceName
The device name is “back garage” (in the app)
Can you point me in the right direction? None of the examples I can find have anything to do with checking the status of a sensor as a filter.
Thanks for any help you can provide
options unavailable? is this only for premium users now?
Hi Graham. I just went through it on a new user account to test it and everything seemed to work. Make sure to enable https://platform.ifttt.com and follow the steps in the article. If you are still running into issues then comment what is the URL you are on and what the error is and I can try to help.
“Note: Filter is a premium feature. While all users are encouraged to experiment with filter code for personal use, publishing an Applet with filter code requires a paid subscription.”
Is it for Private Applets too?
I cant publish my applet because I am not premium user. Do I need to subscribe?
Hi Carman. You can only make applets that are private to your account for the free tier. So you can use them but I think you need a premium account to publish applets to be public for others to use it.
Any Idea what’s wrong here?
“Could not update applet; please check your data.”
Trigger data
Wyzecam.motionSensorDetectsTrigger.TriggerTime
Wyzecam.motionSensorDetectsTrigger.MotionSensorName
Wyzecam.motionSensorDetectsTrigger.TriggerMessage
Actions
Magichue.poweron.skip()
Other
Meta.currentUserTime
Meta.triggerTime
CODE:
var currentHour = Meta.currentUserTime.hour()
if (currentHour >= 20 || currentHour < 5 ) {
// Run the applet
} else {
// Skip the action
Magichue.poweron.skip()
}
Got it working. It was in edit mode. Had to go back and delete and start from scratch.
Hi
I created a private applet and i’m getting “could not create applet. Please Check your data”
can’t find much on what could that mean
i wanted to turn on a wyze bulb when the wyze motion sensor detects motion
i added the filter and added what you stated making the changes
Trigger data
Wyzecam.motionSensorDetectsTrigger.TriggerTime
Wyzecam.motionSensorDetectsTrigger.MotionSensorName
Wyzecam.motionSensorDetectsTrigger.TriggerMessage
Actions
Wyzecam.lightTurnOn.skip()
Other
Meta.currentUserTime
Meta.triggerTime
Thanks a lot for the topic.
I’m using the Date & Time (Every Hour At) trigger; which gives the option to run at 00, 15, 30, or 45 past the hour. I’m using each one of these four in a private applet with the filter code shown below. I want to skip executing the action for all applets between 12 AM to 6 AM.
However, the filter code only works with the 00 applet. I can’t get it to work with the 15, 30 and 45 past the hour applets. Appreciate your help.
Trigger data
DateAndTime.everyHourAt.CheckTime
Actions
Ewelink.switches4Action.skip()
Other
Meta.currentUserTime
Meta.triggerTime
Filter Code
var currentHour = Meta.currentUserTime.hour()
if (currentHour >= 6 || currentHour <= 23 ) {
// Run the applet
} else {
// Skip the action
Ewelink.switches4Action.skip()
}
Brilliant!!!!
Thanks for the code.
I had problems when trying to enableing it to IFTTT but after trying it on the iphone safari app instead of doing it in my laptop, it worked.
Great post!
Can you help me write an Applet to make my Smart Life lights flash blue and white when my football team scores a goal?! I’d like to do this using BBC Sport, so the string would be as follows:
If BBC Sport Notifications show a goal for [insert team], Smart Life should flash [insert group] to blue and white
I just installed my first Smart Life switch and used your instructions to set up an Applet that turns lights on when my Ring doorbell detects motion at night. Thank you! Do you know of a way to have the lights turn off after a set period time (e.g. 10 minutes later) so the lights don’t remain on all night?
Hi,
Wayne Raisbeck (number 17) asked a question which is relevant to me too and I don’t see a reply from you.
Like Wayne, I have a (brilliant smart) door sensor and an ewelink switch. Both are IFTT compatible.
I use a location applet to trigger IFTT and want a filter based on the state of the door (gate) sensor – ie if the gate is closed then open the gate on approach. If the gate is open, leave it closed.
Hi, thanks a lot for the instructions, they work great!
Can you please tell me how to make the filter code work for all the actions I want to setup?
It seems it only works for the first one and all others run regardless of the time I specify.
This is my setup so far….
1 var currentHour = Meta.currentUserTime.hour()
2
3 if (currentHour >= 17 || currentHour < 4 ) {
4
5 // Run the applet
6
7 } else {
8
9 // Skip the action
10
11 Smartlife.activateScene.skip()
12
13 }
I have two actions that are:
Smartlife.activateScene.skip()
WemoSwitch.attributeSocketOnDiscrete.skip()
the second action doesn't take into account the time conditions and always runs.
How can I link both actions to take the time frame into account?
Thank you!!!
Hi reed. I just installed a Wyze Cam V2 on my front door, and im thinking of installing a a motion sensor. Is there any way to program the wyze cam so that it would open on an echo show 5 after triggering the sensor?
I want to use it for surveilance and kind o a doorbell.
Thanks
Thanks for this! I had created an applet for our Litter Robots and Roomba. Roomba goes over and tidies up after the Litter-Robot cycles. Sounds great until the Litter-Robot rolls at 6 am on a Saturday morning. The husband was not amused by my automation skilz.
Hi,
I have a wifi smart relay switch that I use with eWeLink to make a smart garage door opener. I want to have the garage open when I enter an area but only when the Wyze contact sensor on the door is open. Sometimes someone is in the garage, and I don’t want it to close when I drive into the area. I can do the IFTTT easily enough, but I don’t know how to add a a filter code to “skip” the action if the Wyze sensor is open. Any help would be appreciated, thank you.
Trying to set up a SmartThings multi-sensor for a “Dryer done” routine, where: motion is detected for more than 5 minutes, wait until no motion is detected, send alert (txt, blink lights, etc) On the surface, this should be pretty straight-forward, but I CANNOT seem to figure it out. SmartThings app and IFTTT are incapable of this action, so I turned to Platform, but I’m stuck on the polling for state change, and the necessary loop…
The answer is WebCoRE (of course !!). Got that set up, and LOVE just how sensical (read: easy) it is, for the basic stuff. Getting into the weeds with things like attribute: DeviceWatch-DeviceStatus. This is the “do I need to save current settings for a light, flash the light (on-off-on-off), restore the last state of light” scenario so that it comes back to where it was (day=off, night=on), or does it automatically go back to last state..?
I’d like to echo what a few other folks requested: A filter to turn off the bulb after a certain period of time (e.g., 15 mins.). Can you provide any guidance? Thanks!
hello REED, what im facing, trying to make a device smart life turning on when another turned on between certain time and time, in this example between 2 pm and 6 pm, the problem is the second device (after the filter code) is always turning on not taking in consideration the time.. tried alot, nothing works… need your help
var currentHour = Meta.currentUserTime.hour()
if (currentHour >= 14 || currentHour < 18 ) {
// Run the applet
} else {
// Skip the action
Smartlife.turnOn.skip()
}
Great Video Reed!
I was wondering, and I should preface that I’m not a coder so I apologize for if this sounds basic. But can you provide code that would then allow it to then turn off after a fixed number of minutes?
So the idea would be that using your above instruction the motion sensor would turn on the light, but then after say 10 minutes, shut off the light…
Thanks!
Hi I need help on scheduling an amplet in IFTTT, I have created an Amplet if any one turns on the light, the light will turn off at the same time, as my kids use the room light till late night. I am using pert switches. I have Created the Amplet and it works great, the only problem is I have to enable the Amplet every night at 12am and disable the Amplet every morning at 7 am
If anyone is struggling to access the Applet creation once logged in to platform . ifttt you then need to manually visit /dashboard in the url to be able to create Applets
I just want to clarify, so in order to get this to work you have to have a platform membership which costs a monthly premium, or can anyone use the platform to set it up this way?
Thanks.
+1 Joe – it appears IFTTT may have removed their FREE tier? and a developer plan is $199 per year. the /dashboard url doesn’t seem to work and I can’t seem to access the platform.
Are there any free or Open Source alternatives to IFTTT?
Hi,
How would you test if the light was already on. As I only want the triger to turn on if the light is not already on.
As I wiil activate a scene that turns on the light waits 5 minutes and then turns it off.
If the light was already on and the PIR activates it will then turn it off. When I don’t want it to.
Bummer – Looks like this option is no longer available! Anyone come up with another way to make this sort fo functionality?
Thank you very much, it worked perfectly to me with my Wyze contact sensors and my Bedside lamp from Xiaomi. Great job with the Youtube channel and website, we’ll keep ´´Reeding´´ you.
Ok, so i got it working right… but how do I make it turn back off?