My ‘camera turns lights on then off’ automation

68 views
Skip to first unread message

GR-ant

unread,
Jul 21, 2019, 6:58:38 AM7/21/19
to Apilio
I used Stringify with my Arlo camera and Lifx bulb for some time, and it was ok.... I used a string that turned on my light, only at night, when motion was detected and then turned it off again after a 5 minute timer. Problem was, when I entered the area and stayed there for longer than 5 minutes, the lights would still turn off after the initial 5 minute activation despite Arlo detecting motion reguarly within the 5 minute window. I would then have to wave my hand around to turn on the light again.

Apilio is so much better for my requirements. I was able to turn my lights on when my camera detected motion, then before turning the lights off, I created a condition that no further motion had been detected in the previous 5 minutes must be true. This is how I achieved this in case others use cameras and lights together:

First I created a ‘night_time’ variable. Using the sunset/sunrise applet in IFTTT I set it to true at sunset and false at sunrise.

Next I created a ‘motion_detected’ variable and used an IFTTT applet to set true when Arlo detected motion.

Next I created a ‘night_time’ condition and set it to true.

Next I created a ‘no_motion_detected’ condition using the ‘motion_detected’ variable set to true and time stamp unmodified since 285 seconds(didn’t seem to work when set to 299).

Next I created a ‘motion_detection’ logicblock that uses the ‘night_time’ condition. The logic block is triggered by an Arlo motion detected IFTTT applet. The logicblock then triggers an IFTTT turn on bulb applet immediately, then waits 300 seconds and runs a ‘check_if_motion’ IFTTT applet that in turn triggers a ‘turn_lights_off’ logicblock.

Next I created a ‘turn_lights_off’ logicblock with the condition ‘no_motion_detected’ to true. This logicblock triggers an IFTTT applet to turn off the lights if the condition of no motion condition is true.

The result of this is that so long as my Arlo camera detects further motion within 285 sec of the initial detection, the lights will remain on. Only the final motion event will result in the lights turning off.

*note; I actually now run my bulb in an ‘early evening’ and ‘late evening’ scene all night every night so rather than turn off and on, my automation is now configured to turn on my bulbs 100% bright white and then return to the scene based on the time of night.

Hope this helps others.

jrmckins

unread,
Jul 21, 2019, 9:03:11 AM7/21/19
to Apilio
That's a nice improvement over this: https://iused2besmart.wordpress.com/2019/07/02/using-ifttt-and-apilio/

My next addition will be something like "if the light is already on when motion is detected, do nothing". 

Philipp

unread,
Jul 21, 2019, 3:32:44 PM7/21/19
to Apilio
Very clever idea. Thanks!

Ben

unread,
Jul 29, 2019, 2:52:58 PM7/29/19
to Apilio
This looks like a great solution! I am having difficulty getting it to work for me though. First, it seems the time stamp does not change on the motion_detected variable it just continues to increase. If I set the unmodified since past the value then it at least evaluates positive. 
I also am struggling a bit grasping the `check_if_motion’ IFTTT applet Is this a maker event - webhook recipe in IFTTT?

Thanks for the help!

GR-ant

unread,
Jul 29, 2019, 5:40:56 PM7/29/19
to Apilio
My IFTTT applet is simply a ‘if arlo detects motion then make a web request’. Does the time stamp update if you manually load the web address? There may be something wrong with the address you input into IFTTT.

Yes the ‘check_if_motion’ is simply a ‘if maker event then web request’ IFTTT applet. This was needed to move from one logicblock to the next.

bda...@gmail.com

unread,
Jul 29, 2019, 6:15:54 PM7/29/19
to Apilio
So I am very new to this and still learning. The timestamp updates when the variable value is changed. I had nothing that was changing this variable between true and false and visa versa. The variable was always "true" This did not work well when I had a condition for it to be true in the logic block then another action to set it to false when the all actions were performed. I am pretty sure I am over complicating this.... 

I have tried using the address to set the variable itself to true in IFTTT and the Evaluation Trigger from the logic block. Which should I be using and how should the variable value be changed?


Ben

unread,
Jul 30, 2019, 8:20:51 PM7/30/19
to Apilio
I think what I am missing here from the original post is how to set the motion_detected variable back to false. Security cameras seem to all have a detect motion event but no finished detecting motion trigger event. How do you know when the camera motion detection is over and then how to set the  motion_detected variable back to false?

GR-ant

unread,
Jul 30, 2019, 8:37:06 PM7/30/19
to Apilio
Ben, condition relies on the timestamp. There is no need to change back to false. You could probably even use the false link.. Everytime the true website is called my timestamp is updated. Can you confirm that your ifttt applet is in fact working to update the timestamp?

Ben

unread,
Jul 30, 2019, 9:02:52 PM7/30/19
to Apilio
Ahh, that was the missing piece and I failed to go far enough to test. Yes, the timestamp changes every single time it is set to true from the IFTTT applet. I was using the logicblock evaluation and shouldn't of been.

Thanks for the help!!
Message has been deleted

mehmet...@gmail.com

unread,
Aug 6, 2019, 7:56:40 PM8/6/19
to Apilio
Hello,
I'm working on a routine that I can sue this "if the lights are on (or off) logic"
I can probably create a variable to go off, but how do I setup the value.  lights can be switched on and off during the day by mistake.  I have two leviton switches that control the front porch and the back yard. 

If there a utility to call the status of the switch, or do I use Leviton's when turned on / off events and come back to apilio to create two IFTTT actions 1 to update the porch_on variable to on and one to (delayed) turn off the lights in 2 mins?  Then in two minutes my action will call another apilio logicblock and that will call two IFTTT actions: update the leviton status to off and turn off (or use leviton's when switch off ....

Is this an overkill?

Philipp

unread,
Aug 19, 2019, 8:45:59 AM8/19/19
to Apilio
Hi Mehmet,

calling a service and ask for the status of a device is not possible with most API (sadly). You probably have to stick to the push version, where the switch updates some state information every time it changes.
Reply all
Reply to author
Forward
0 new messages