Using IFTTT to control virtual switch to turn on lights based on motion from Ring camera


#1

Unlike the Ring doorbell, the Ring Stick Up Cam apparently cannot be integrated with ST. I can, however, use IFTTT to turn on a virtual switch in ST when the Ring cam detects motion. I would like to do this to turn on lights, which is no problem. However, I want the lights to stay on as long as motion is still detected. After a certain period, say, five minutes, the lights will shut off, so long as motion wasn’t detected again during the five minute period. I am able to do this with my front porch light using motion from the Ring doorbell because the doorbell is integrated with ST and I can using it directly as a motion sensor, and in WC I can do things like “if motion stays inactive for five minutes.” I can’t quite figure out how to do that with a simple switch, though. I think what would be ideal would be if there was a way to set a five minute timer every time the virtual switch is turned on, and when the timer counts down to zero the lights shut off. Every time motion is detected again and the switch turns on (the piston would shut the switch off a few seconds after it turns on, so each new motion event would turn the switch from off to on again), the timer would be reset to five minutes, so the lights would not shut off until there has been no motion for the full five minutes. Is there any way to do something like this? If not, does anyone have any other suggestions on how to make this work?


#2

With only HALF of a sensor in play, the logic is a bit convoluted…
(you’d be better off with a real sensor here)
but here is what I am thinking:

Stick sees motion > IFTTT > Turn on SimSwitchA

Then, in webCoRE you can use two mini-blocks:

IF SimSwitchA changes to on
Then 
    Turn on Lights
    Set variable lastRan to $now
    Turn off SimSwitchA
END IF

Every 5 minutes
do
   IF Lights are on
      and
      ($now - lastRan) is greater than 5 minutes
      Then
         Turn off lights
   END IF
END EVERY

To be honest, I do not like this clunkiness, but you are kind of limiting yourself with that device.


#3

I am trying to remember…

If IFTTT can send a TOGGLE command, I can re-write this piston much more efficiently:

Stick sees motion > IFTTT > TOGGLE SimSwitchA

Then, in webCoRE you can use two mini-blocks:

IF SimSwitchA changes 
Then 
    Turn on Lights
END IF

IF SimSwitchA STAY on for 5 min
Then
    Turn off lights
END IF

IF SimSwitchA STAY off for 5 min
Then
    Turn off lights
END IF

Note: I have never tested a double inverted STAY like this.


#4

Thanks! Your first example looks like it just might work. I’ll have to play around with it and see what I can come up with. And I agree, a real sensor would be better. I’ve had this camera for a few years and only now tried to integrate it into ST, never imagining there’d be an issue since the doorbell works just fine. Just trying to use what I already have, but now that I am aware of the limitation, I wouldn’t buy one for this purpose.

I did not see any way for IFTTT to turn off the switch when motion stops, so I don’t think your second example would work, if I am understanding you correctly. However, if I built in to the piston a command to turn “SimSwitchA” off a few seconds after it turns on, and IFTTT turns it on every time there is motion, then “If SimSwitchA STAYS off…” should work for my purpose, right? I’ll have to play with that.


#5

IF the service IFTTT can send a TOGGLE command, then the second example is 100% better…

My logic is, the first (clunky) example runs every 5 min all day every day. (bleh)

The second example is so much more efficient, and only runs once 5 minutes after any action.

Seriously, if IFTTT can send a toggle, I would go with the 2nd example.
(I apologize, but I forget if it is capable of this)


By the way, Toggle means, if the SimSwitch is on, it turns it off. If the SimSwitch is off, it turns it on. Either action will restart the 5 minute timer. Once those toggles stop coming in, after 5 minutes, the real action takes place. :sunglasses: (lights off)


#6

I gotchu. I see that now. Unfortunately it only supports discreet ON and OFF commands, from what I can see.

This works pretty well to accomplish what I want:

Now sensor sensitivity of this particular device and latency due to multiple cloud integrations is a whole other story. :rofl:


#7

Nice… I normally do not recommend using a command which matches a trigger in the same piston… but in this case, it just might work!


#8

While I recently added an IFTTT trigger for my SkyBell HD doorbell to turn out our front lights, the logic won’t do what you wish. I have a Philips Hue outdoor sensor above the garage that does the heavy lifting in that piston. The doorbell is an effort to trigger when someone is walking out the front door, as opposed to approaching the house. Once I am a few steps out the door, the Hue does the rest.

I will have to play around this weekend to see what exactly happens if I ONLY trigger via the doorbell/IFTTT - like opening the door to grab a package or such. Thankfully my wife knows that I am crazy, so waving my hand in front of the doorbell and then looking at my phone is a normal Friday night.