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

Steps to add a virtual switch:

  • On the left nav (it will be under the hamburger [three-bar-menu] on mobile) click on devices e.g. http://[your-hub-ip]/device/list
  • At the very top of the list there is a button "Add Virtual Device". Click.
  • For the values you can chose whatever you want as long as for type you choose "Virtual Switch". Click "Save Device"

A short explanation of what each value is:

  • "Device Name" - This field is meant to hold the device's name.
  • "Device Label" - This field is meant to hold the device's label. The way I differentiate this from "Device Name" is that if I was setting up a Hue Bulb for example device name would contain "Hue Bulb" but "Device Label" would contain a name that makes sense for where it is such as "Master Bedroom Lamp". "Device Label" is what you see everywhere in HE for configuration and in integrations.
  • "Zigbee Id" - If it is a zigbee device it would have the unique identifier for the device. With a virtual switch leave it blank.
  • "Device Network Id" - The unique identifier to identify this device in hubitat. Z-Wave devices put their node id here. LAN devices often have their IP (in hex) or their MAC address here (all caps no separators). For LAN devices that is how HE identifies which device to send responses/requests to. For virtual devices it doesn't matter what you put. I typically put "VS000" where "VS" stands for what it is e.g. virtual switch and the rest is an incrementing number.
  • "Type" is the type of device it uses i.e. which driver it uses.

This is probably all documented somewhere if somebody wants to find it and provide an official link.

Virtual switches by themselves do nothing. You can turn them on and off and nothing happens. They are either controlled externally by IFTTT for example or you control them with RM or do actions with RM when they are controlled. Once you set one up it should start to make sense.

will try this way if I cannot get other to work

How can I select my smart switch when it is a smart life switch and hubitat doesnt support it? I can add it in google home and alexa and ifttt but not hubitat so how would I go about having hubitat control the switch when it isnt listed at all?

I was able to add and create the switch in alexa app and also on hubitat. I can do most of the stuff in your pictures except select the switch that turns the outside lights on and off. I can see it in alexa app and google home app and ifttt but not hubitat. They are smart life switches so how do I go about being able to have hubitat control them and then add them to the conditions?

Is this possible to do or should I buy a new smart switch that works with hubitat?

Here’s a good article I found on the SmartThings forum that would benefit you to read. Just substitute SmartThings for Hubitat. The virtual switch is going to be the switch for those devices.

At this point you would select the virtual switch in HE. Then on the IFTTT side you would need a rule to control your Smart Life switch.

You will always be using IFTTT to sync the HE virtual switch to the Smart Life switch if that makes sense.

I don't know much about Smart Life (or Magic Home) devices but if they are compatible with the Magic Home app they could have an integration already. @adamkempenich, are the Smart Life devices the same as the Magic Home devices? When I google it I see them mentioned together all the time.

1 Like

SmartLife switches use a different protocol, unfortunately.

But... I’ve been working with a friend, and we’ve gotten a lot of work done for local-control and reverse engineering them. I pushed that project aside, but I’m pretty sure I can get it working locally. I know for a fact it can be done, because I have several smart outlets under control by HE currently :slight_smile:

Someone else has a public Tuya/SmartLife cloud driver in the meantime, though. See CWWilson’s thread for more on that:

1 Like

thanks adam and I looked through it and read it but wasnt really sure which part to use for the driver lol but will continue to research it

thanks for the reply codahq, on the ifttt side the one i made says if ring motion is detected then turn on smart life switch between hours of 8pm and 6am. The only issue is how do I make it go back to hubitat and do the timer and then have it shut the switch off after the time is expired? I can also have alexa turn the smart life switch on as well but not sure how to get hubitat to have a timer shut the switch off since it doesnt see the switch

The simplest way from where you are is to have a virtual switch in Hubitat shared to IFTTT. Change your IFTTT recipe to turn on the Smart Life switch AND the Hubitat switch. Can IFTTT recipes have two actions yet? If they can't you need to make another action.

Then in HE you can have a Rule Machine rule that says... when that virtual switch is turned on (the one that the IFTTT will also turn on when it turns on your Smart Life switch because that switch status will sync back to Hubitat) do a thing. Your thing can be ignore based on the time of day, turn on other switches, or wait a period of time and then turn off, etc.

If you turn that switch off it will sync back to IFTTT. Then you have another IFTTT recipe that says if that HE virtual switch turns off then turn off the Smart Life switch.

In this scenario the virtual switch in Hubitat is then just a representation of the Smart Life switch.

thanks inetjnky, I think I created the 4 rules correctly in ifttt and now when writing to commands in hubitat I can start it by saying if ring motion is detected for the actions I cannot find an option to goto ifttt and run my thing I made?

I made the virtual switch like he did in the above pictures and I have ifttt in devices and have the virtual switch clicked on it.

Now when I write the if and thats I cannot find anywhere in there for the action part in rule machine where I can have it goto ifttt to turn them on. How do I do this step when I cannot find it for the action part?

I'm not sure what you mean. Can you try to explain again with some screenshots?

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.