Use IFTTT to have ring doorbell motion turn on a smart switch between certain hours with a timer

If you scroll up some inetjnky posted a couple of screen shots of how they set trheirs up.

I made a virtual switch exactly the same as in their screen shot and even named it the same and its saved in my hubitat device list. In my apps list I have IFTTT with rules saying it can control the virtual switch and also have my lights listed and goole home and also alexa along with rule machine.

I will click on rule machine and make a new rule and name it. The condition will be set to the virtual switch saying it is true for detecting motion. When I select the actions for true tab it gives me different things to click on like switches and boolean set mode, send messages and other things. I went through everyone of them and cannot figure out how to have it goto IFTTT as the next course of action.

In IFTTT I have different things setup like when ring door detects motion then turn on my Tuya light switch at a certain time. I also have some others setup up for tuya light switch and hubitat like he also had in screen shots above.

So my question is how can I get hubitat to goto IFTTT when the condition is true? There is no option for IFTTT in any lof the conditions that I can pick from?

One other thing is that my tuja light switch is not detected in hubitat but is in alexa, google home and IFTTT so thats why I have IFTTT rule saying when ring detects motion between 8pm and 5am then turn on tuya light switch.

Another question is that if it starts with ifttt rule that I made how do I get that rule to know to goto hubitat so I can set a timer up and have hubitat go back to ifttt and have ifttt shut the tuya light switch off after 2 minutes?

The virtual switch from in the photo is just basic and looks to be for anything to use with it and doesnt have a spot saying if active open ifttt.

Rule machine won't talk to IFTTT directly. Rule machine will toggle the virtual switch off. The state of the virtual switch will then synchronize to IFTTT through the IFTTT integration assuming you shared that virtual switch to IFTTT (which I think you did from what you are describing.)

At this point IFTTT will know that the timer was over. You would just need one more IFTTT recipe to turn off the Smart Life switch when the HE virtual switch turns off.

There may be another more elegant way to do this but I'm not familiar with it because all of my devices are supported and in Hubitat.

so how would you do this then?

these are my apps on ifttt. So it starts with ifttt when ring detects motion turn on my smart swtich between certain hours. Now in theory the other ifttt app should send it to hubitat when it detects the switch is on which should turn the virtual switch on. So in rule machine i would say if it detecs the switch is on as action i set a 2 minute timer and if rule machine lets me have it do another action to shut the virtual switch off so then the ifttt side will see its off and shut the light off with the other app that i made? Kind of confusing for me since i am just learning it lol but how would you do it so it knows to shut the light off after 2 minutes?

Here is the hubitat rules i tried to create

how does this look or am i way off?

I don't know what you have in those recipes. Here would be the components.

  • "Virtual Switch - Doorbell Motion" shared to IFTTT
  • Smart life switch shared to IFTTT
  • Ring doorbell shared to IFTTT

Here is the logic.

  • IFTTT recipe where Ring doorbell motion triggers Smart Life bulb to turn on
  • IFTTT recipe where Ring doorbell motion triggers HE "Virtual Switch - Doorbell Motion" and because of the integration the virtual switch in HE turns on
  • HE Rule Machine rule to turn trigger on "Virtual Switch - Doorbell Motion" and turn off the "Virtual Switch - Doorbell Motion" switch after 2 minutes
  • IFTTT recipe where HE "Virtual Switch - Doorbell Motion" off triggers Smart Life bulb off

Three IFTTT recipes, one rule.

Now, let's simplify your rule. It can be a triggered rule or a non-triggered rule. If you keep the triggered rule you only need one condition; time between 8:00 pm and 6:00 am. You could also use sunset and sunrise.

Trigger:

  • Virtual Switch - Doorbell Motion on

Condition:

  • Time between 8:00 PM EDT and 6:00 AM EDT

Rule:

  • Time between 8:00 PM EDT and 6:00 AM EDT

Select Actions for True:

  • Delay 2 minutes
  • Off: Virtual Switch - Doorbell Motion

Nothing else is required. At this point I think you need to take some time to experiment to understand what happens when you do different things.

thanks for your reply and I changed the rules like you had them.

I made another ifttt rule saying if ring detecs motion then turn on the virtual switch. Will this rule conflict with my other rule that says if the smart life switch turns on then turn on the virtual switch in hubitat? The smart life switch is turned on by the other rule in ifttt saying if ring detecs motion then turn on the smart life switch.

They are both basically the same rule arent they?

Where A is the Ring doorbell, B is the Smart Life bulb and C is the HE switch.

A -> B
A -> C

instead of

A -> B -> C

You can choose which method. To me top makes more sense.

I use Hubconnect located here to share my Ring Doorbell and Floodlight Cameras with Hubitat from Smartthings:
https://community.hubitat.com/t/release-hubconnect-share-devices-across-multiple-hubs-even-smartthings/

I haven't seen anyone mention that above so I wanted to mention as a 3rd option.

It'll report both button presses and motion with Hubitat without any issues and the Floodlight Camera driver reports motion and allows you to turn on/off the light although the Floodlight Camera driver is not available till next version most likely. To setup you would have to have a Smartthings hub setup with the Ring Integration on Smartthings then connect with HubConnect.

I really hated using IFTTT since it is so slow for me, it would take 5-6 seconds for button presses to turn on the virtual switch and I'm not a fan of having a ton of virtual switches when you can have a native integration. The response time is instant with HubConnect and you can get motion events too without needing 2 different virtual switches.

I use the motion events to turn on outside lights I have connected via multiple Lutron Caseta Switches when motion is detected for my Ring Doorbell or Floodlight Cameras. Alexa is an option too as mentioned above but you are needing multiple virtual switches still in that case.

Screenshots to show what it looks like.

I use the SmartThings to Hubitat integration as well for the camera's motion sensors. I don't think the OP has a SmartThings hub though.

thanks for the help I got it to kind of work.

Its weird, if I choose 5pm edt or earlier the state is true and it turns on but if i pick any time after 5pm edt the state is always false and cannot be changed for some reason. I will try for 8pm and see if it works tonight hopefully it does but i am doubtful on it since it says false.

The true/false indicates what the rule or condition evaluates to presently. If you are using current time after a given time since it is after 5pm EST it evalulates to true. If you picked 6pm EST it would evaluate to false since it's not 6pm EST yet.

ahh got ya so that is how it works, thanks for all the help :slight_smile:
I look forwards to doing more with this in the future with setting up timers for watering the garden and stuff but first need to find the stuff to buy for it lol

Not to add confusion to what has come before on this thread, but...

I use Homebridge for a few things not natively supported by Hubitat device drivers, and a Hubitat Virtual Device as the "proxy" for the events of interest, linking the two via iOS Home app automations. In this case, I use a Ring Doorbell plugin (see GitHub - homespun/homebridge-platform-ring-video-doorbell: A Ring Video Doorbell platform plugin for Homebridge) to access the Ring Doorbell (or Spotlight Cam) motion events.

Probably more of a part count than desired for the above, but in my case all of the parts are already spun up for other duties.

took a look at it and it looks like you need to know some javascript with it and I really dont know much of that lol

This is what I did. Not the best as I could improve it some still (like restarting the action if there is new motion while light is still on) but it works.

Setup a virtual switch and have ring motion turn that on and use that as your trigger. This way turning on the switch at the wall doesn't kick off the rule.

Note: The global variable IftttFrontDoorMotion is checking false and used to make sure motion wasn't just kicked off because the light turned off. It was getting stuck in a loop where the light would turn off and Ring would send another motion alert and turn it right back on. On trigger this will set the value of it to True and then at exit set it back to false after a 15 second delay so the next real motion can trigger it again.

thanks for the reply

here is my set up now and it turns on in ifyyy and then hubitat takes over and will shut it off but the only issue it whether its 1 minute, 5 minutes or more it shut off in 10 seconds and not sure why.

What's the rule look like you use to turn on the actual light? Turn on enable rule logging on both the light turn on rule and this one and get the logging of the rules actions and post it. The rule logging will probably show you where your logic is breaking down.

thank you for the reply, I got it working now since the virtual switch was set to auto off which was screwing it up for some reason. IFTTT was also taking to long to turn the light on so I have alexa turn it on between certain hours and then have IFTTT turn the switch off after 1 minute and it works great now.

I connected hubitat to alexa in the alexa app and it added amazon echo skill to my hubitat and all my switches were enabled as well. The funny thing is that for some reason when I tell alexa to turn on the virtual switch well she wont turn it on which I am not certain as to why. So thats why I have alexa turning on the switch and only that at certain hours and then have the same rule in ifttt with ring when it detects motion to turn on the virtual switch and then everything else works fine and gets all shut off.

For the life of me though I cannot figure out why Alexa is giving Hubitat the silent treatment

Make sure you are using the Alexa skill app. It's the newer one. The really should flag the other in some way that it is the less preferable one.

I just noticed that my switch didnt turn off last night and I am not sure where it screwed up since it just says failed in the ifttt app.

Is there a way to have another rule in hubitat to always check to see if the virtual switch is on and if it is then check to see if there is remaining time in the countdown timer that shuts it off and if there isnt time left then to try and shut the virtual switch off and keep checking until it is turned off?

Also maybe get it to send a notification to my phone saying it failed to shut off so I see it and manually shut it off if needed?

That night IFTTT/Hubitat was bugging out for me too.

Yes just create a trigger with a delay to turn it off. You can also go into the virtual device and set it to auto turn off on its own. That's what I do.

Here is the current rule I"m using that will turn the switch on only at night and isn't already already on. It also will keep the light on if there is new motion. The Virtual switch is set to auto turn off 500ms and the global variable is there to track that IFTTT turned it on. Because this is a rule it should be more reliable about turning off your device and virtual switch,