SmartThings Community

Ignore "turn on" if virtual switch was turned off less than 15 seconds ago

smartlighting
ifttt

(Marc Aronson) #1

Background
I have a smartthings controlled power outlet that controls lighting near a Wyzecam.

If the Wyzecam detects motion, I want to turn the lights on for 10 minutes so the WYZECAM can make a better recording at night. I was able to make this happen with the following steps:

  • Created a Virtual switch. Let’s call it VS1
  • Created a rule in the “Smart Lighting” app that turns on the power outlet if VS1 is turned on; turns off the power outlet if VS1 is turned off.
  • Created another rule in the “Smart Lighting” app that turns off VS1 if the “power allowance” exceeds 10 minutes.
  • Created a rule in IFTTT that turns on VS1 if the Wyzecam detects motion.

VS1 and the lights turn on as expected, but when the 10 minutes is over and the lights turn off, the WYZECAM treats the lights turning off as motion. This causes IFTTT to turn VS1 and the lights back on again. So that lights are caught in an infinite loop of turning on for 10 minutes; turning off for a few seconds; turning back on again for 10 minutes; turning off for a few seconds…

Is there a simple way to have Smartthings ignore the “turn VS1 on” request if VS1 has been off for less than 15 seconds? I realize this would not be a “perfect” solution, but it would be “good enough”.

I’m also open to other ideas for how to solve this. Thanks!

Marc


(Marc Aronson) #2

I solved it by developing a Webcore Piston. “Switch 4” is a virtual switch. Every time it is turned on, the landscaping lights are turned on for 15 minutes. If the landscape lights are already turned on, the timer is reset to 15 minutes. IFTTT is set to turn on “Switch 4” anytime it sees a motion event from my Wyze or Ring CAMs.

Marc


(Ron Talley) #3

Yep. SmartLighting is good for simple stuff. WebCoRE is great for most stuff.


(Kenneth Eriksen) #4

Hi Marc

A couple of thoughts…:
It seems that the Wyze IFTTT channel now also have a “Restart device” action… (never tried it though)
https://ifttt.com/wyzecam (click “Wyze triggers and actions” at the bottom of the page)

It would be worth trying to trigger that somehow just before your VS1 turns off… :thinking:
It would of course leave a gap in the motion detection, when the camera is restarting… :face_with_raised_eyebrow:

Or the dirty way…: You could trigger 3 virtual switches that is turned on when motion is detected:
VS1 - Lights on for 10 minutes (power allowance)
VS2 - When turned off: Disable motion detection via IFTTT after 9 minutes (power allowance)
VS3 - When turned off: Enable motion detection via IFTTT after 11 minutes (power allowance)

This is getting a bit more complex though… :crazy_face: