How to control a light to turn on just for 5 or 10 minutes?

How to control a light to turn on just for 5 or 10 minutes and then turn off?

What do you want to trigger it? Motion, manually turned on, contact sensor?
Built in Simple lighting app would be my starting point.

1 Like

I think youā€™re gonna need to provide a few more details.

How do you want the automation to be triggered?

Do you really mean sometimes you want the light on for 5 minutes, but other times for 10 minutes?

Sure, I have an IFTTT that turns on a virtual switch. Then I want to use this virtual switch to turn on a light, maybe using the Hubitat Simple Lighting which uses another virtual switch to control a Lutron light. The Virtual Switch that control a light is already implemented and works great but I just want the light to turn on for 5 or any other number of minutes and then turn off automatically.

Iā€™m still not sure if Iā€™m following you 100%. But if your trigger for on is a virtual switch, and then you want the light to turn off in five mins you can do that with rule machine. I donā€™t think simple lighting will give you that option.

I often use a RM rule I call a timeout.
Light comes on, delay off by variable time.

I use this kind of logic for bath fans too.

For me it allows catching the manually operated switches when I'm in a mode where motion lighting isn't governing.

2 Likes

I'm still a little confused: what does the "[other] virtual switch to control a Lutron" light do? A Lutron switch or dimmer (I'm assuming that's what this is) should be usable directly in Hubitat, so you shouldn't need a virtual switch as an in-between if that is what you're doing, unless you have some other reason for doing that. (I do understand the first virtual switch, assuming you're using some device that only supports IFTTT and doesn't have a direct integration into Hubitat; avoiding IFTTT would be better if possible since that is both dependent on the cloud and likely slower than something local.) In any case, I guess if you already have the second virtual switch set up and it works to "mirror" the real light, then what works works.

Does the IFTTT virtual switch ever turn off? If so, is it immediately (so more of a momentary switch) or after the desired delay? If it's after the desired delay (say, 5 minutes) and you want that to "mirror" a different switch/light, Hubitat Simple Lighting can do that. If it never turns off, you'll need something like the rule above (I think, not sure if any other app can do this natively) except if the switch never turns off, I'm not sure if RM will respond to a "changed" trigger (RM 4 is pretty new and I haven't tested this so I can't say for sure). Just something to consider.

Basically, you have a lot of different ways you can do this, but the best way for you depends on what your "triggers" for this look like and how you actually want it to behave (e.g., turn the light off 5 or whatever minutes after it's turned on all the time regardless of what turned it on, what should happen if it was already on, what to do if the device that "triggered" this changed states, and so on).

1 Like

Thank you for the information guys, your answers gave me an idea that I am going to try and keep you posted.

I have to use IFTTT because my cameras (Reolink) have an only usable feature to send an email if they detect motion, so if they do, the system will send an email to trigger@applet.ifttt.com which will trigger to turn on a Hubitat virtual switch. I want to avoid the IFTTT thing all together but I cannot find any other way to have the email trigger an event because my email will need an email server to be sent, so it is going to the outside world anyway.

I'll keep you posted.

Thanks

Just musing here, I wonder if one could set up a local DNS server, or perhaps something like a Pi-hole to capture/redirect this trigger message to a local mail server, and then use a script to post it to a URL that could be read by Hubitat?

Again just musing, I don't actually know how to do this, but I may have to do some research!

1 Like

Hey ya

I was getting annoyed with the false alerts from my Reolink system with motion triggering as the sun changes. Currently i have a instance running on the AWS free tier that is running some custom python code that polls my gmail every minute, grabs new mails with a certain tag and then grabs the attachment. It then passes the attachment through Rekognition to see if there are humans in the pic. If there are it saves the image to a bucket and then send a notification to slack with the image preview.

So you could replace the slack notification with a post to the hubitat cloud end point.

This is my stage one method of achieving this. its not the most ideal due to the polling delay to get the new mails, and its only single threaded so If there's a tonne of mails to process because of lots of light changes or something it increases the delay more.

It was more of a POC, and i'm not looking into using GCP pub/sub triggering a cloud function
https://developers.google.com/gmail/api/guides/push

Happy to share my current python code if of interest.