Multiple actions for a trigger?

Hi, this is my first post since receiving my hub and getting it registered, so I hope that this kind of newbie question is OK. I've tried searching, but couldn't find an answer.

I have a Hue hub and Ring cameras, so I've installed the Hue app to hook up my lights. To detect motion from the Ring cameras I've installed the Alexa Hubitat skill and configured a Hubitat virtual switch which I've added to Alexa and configured an Alexa routine to turn on the switch when motion is detected by the Ring cameras. This all works and I can then use Rules Machine to define triggers to switch on/off lights (with a delay) when the virtual switch in on.

To be more specific, I have 2 lights, light A and light B. I want light A to switch on after 5 seconds and switch off after 2 minutes. I also want light B to switch on after 20 seconds and switch off after 1 minute.

So, I have achieved this with 4 triggers, 2 for each light. Each is triggered using the virtual switch, has a delayed on/off for the light with a restriction of between sunset and sunrise. This all works, but what's frustrating me is that I need 4 separate triggers to do this. This may be by design, but I want to check.

Is there a way of achieving the same 4 actions using fewer Rule Machine definitions? Ideally I was expecting to be able to have a single trigger definition with multiple actions (of the same delayed on/off type), so the virtual switch trigger would then cause 4 actions, which are all defined within the same trigger definition, rather than having to repeat the same trigger with 4 separate actions.

This is my first set of rules and I've tried to figure it out, so apologies if I've missed something obvious.

Do it as a rule instead of trigger. Then you could do it in 2 rules - one for light A and one for light B.

Since you can have adjustable ON/OFF delays with a rule, there should be no issues with the delay ON/OFF.

For a "newbie", you're doing great! Welcome to the community!

BTW, if you'd like your Ring Cameras to show up as Hubitat Motion Sensors, instead of a simple Switch, you can use my Virtual Motion + Switch Driver. It also automatically turns itself off after a few seconds of being activated. It is sometimes 'more logical' to deal with these devices as Motion Sensors instead of switches for some standard Apps, like Motion Lighting.

Here's the code. You would NOT need to delete your current Virtual Switch device. Just simply change the Driver to the one below and it will register as both a Switch and Motion Sensor.

1 Like

OK, is this what you are suggesting?

A single rule working off the virtual switch, with actions that are delayed by 'n' seconds, first to turn on the light and also a delayed off for the same light? (with a restriction between sunset/sunrise)


1 Like

OK thanks. I've not tried pasting any script/code yet but I'll give it a try.

1 Like

Be sure you click on the GitHub RAW button before copying the code from GitHub. This will ensure you get a clean copy of the code.

Thanks, that's working with your driver code.

The Ring movement is triggered pretty quickly (within a second) so this seems to be an OK solution (pending any kind of direct integration with the Ring cameras from Hubitat), but I assume that the Ring motion trigger would not be passed to Hubitat if the internet connection was down even though the Echo, Ring cameras and Hubitat are all on the same LAN (I've not tried disconnecting from the internet)?

Correct. This integration is Ring Device -> Internet -> Ring Cloud Server -> Internet -> Amazon Cloud Server -> Internet -> Hubitat Cloud Server -> Internet -> your Hubitat Hub.

Thanks for the confirmation, I'm just starting to appreciate the flexibility and power of this little box of tricks, it's so useful to have an active and helpful community so I've been spending hours looking at the posts to avoid asking stupid questions.

I'm starting to get my mind around the concepts of Rule Machine and understanding the possibilities, just got the Pushover notifications working and I think I might have a go with your Alexa TTS next. I'd like to get a send email capability, but that looks like I'd need to use a Rasp Pi (can't understand why this isn't built-in).

Also waiting for a Konnected Interface board to arrive from the US, so that I can hook into my existing hard wired alarm motion sensors before I start adding any new devices.

1 Like

Can I restart this thread with a basic question: How do you use Ring cameras with HE? I don't have Alexa or anything, which seems to get mentioned a lot in Ring threads. I also don't have a ring camera right now, but they look really cool. Where do you start with integrating these things? Can someone outline the process?

There are only two options that I am aware of currently... Use Amazon Alexa as a middle-man as I outlined above... Or, use IFTTT (which was too slow for my liking in my testing last year.) I wonder if you can use the Alexa integration without actually having an Echo device? Might be possible with just the Alexa App on your phone.

OK.... I installed IFTTT and it immediately wants you to specify which devices to control. Will a Ring Camera pair to HE and appear in that list?

A Ring camera will not pair with HE, but you can have IFTTT access your Ring account and then act upon whatever events the camera throws.

OK, I have a ring account (at another location). Can I use that for learning purposes? How do you get IFTTT to access your ring account? With no devices in the list that I want to act on, clicking "done" on the IFTTT app page just aborts the app and brings me back to the Apps page.

You need to hook up your Ring account to IFTTT. When you create an applet, click on +THIS and type in Ring, it should give you the opportunity to connect your Ring account. Then, when you select +THAT, select your Hubitat account and you should be able to control switches, lights, etc.

What I did with my Ring doorbell was to create a virtual switch in Hubitat and named it Ring Doorbell with auto turn off selected. This way, I can create rules to trigger when that switch gets "turned" on either by motion or button press.

Thank You! That was interesting. Never used IFTTT before. Now I just have to figure out what I expect this integration to do that isn't just handled by the Ring app itself. Seems like I had something in mind, but now... maybe not. What do y'all do with this capability?

1 Like