Scheduling lights with more randomness

Hello, I'm trying to create a rule that runs through a specific schedule. For instance, at 5:00am, delay a random time between 0 and 15 minutes, then turn on a set of lights. Then at 10am, delay a random time between 0 and 15 minutes, then turn off that set of lights. At around 6:30am turn on another set of lights then turn off again at around 9:30am. etc. Is there any way to have all of this in one rule? From my understanding, the rule only kicks off once a trigger is activated, like using the week schedule trigger that kicks off at a specific time, so I'm guessing it is not possible? Would I have to just create a bunch of rules to accomplish this?

I've looked into the simple lighting app, but there isn't any randomness and the schedule it creates is just a simple turn on at this time, then turn off at another time.

Thank you!

Somebody has an app out there for this.

This? [Release] - Lighting Effects

Lighting Effects won't do that but this does... At home simulator :grin:

1 Like

Thank you for this app. I am testing it out right now.

From what I can gather so far, the app isn't a scheduler but a way to have groups of lights turn on and off randomishly based on my preset parameters. The app is activated using a virtual switch, and I would use rule machine to schedule when to turn on that virtual switch for instance at 5 am when I'd normally wake up?

Would a normal use scenario be to schedule it to run in the morning and then again in the evening? When the virtual switch is turned off, do all the lights just turn off at the same time or does it just freeze at its current state?

Thank you!

Why do need this in one rule? Rules are "free", meaning you can have as many as you want. I would make just make several rules unless the app posted below get's you what you want in a different way

Just some words of advice. The reason we turn lights on is to make it appear someone is home of course. The person that would really notice the time the most is the person that is "casing" your house. That person will very much expect to see a relatively consistent pattern. You don't turn random lights on around your house at random when you're home do you?

So spend a week observing and writing down your lighting habits. Then just make a rule that follows that schedule, but vary it by the sunset offset. That simple rule will be much more convincing to a would be thief than complete random lighting patterns. Also remember that lights will be just one indicator someone casing your house will look for.

@dan.t In webcore, I was able to do something similar in one piston. I was just curious if I was missing something when using rule machine.

So it's safe to assume that Hubitat users will have a ton of rules? I currently have around 30, and it's only been 2 weeks since I started using it.

It all depends on needs but yes, some will end up with a ton of rules. I would always follow the KISS principle when it comes to rules. Quantity really makes no difference.

Yes, it takes some time to get used to RM when you come from WebCore. I did the same quite some time ago but I believe with RM3 and RM4 it became much easier. By now, I don't wish to go back.

And you can always write a "simple" App if you have a REALLY difficult use case. I had one of these and the app is running for months now...

You set it for whenever you want.

Set up different routines for different times of the day (morning, evening, weekends). Try to match what you would 'normally' do.

It will finish whatever is still in the que (not the entire routine) then turn the lights off as they finish. Not all at once, nor will it freeze.

@SmartHomePrimer I definitely agree with you. This is part of the reason why I wanted to create something easy out of rule machine but was confused that I'd need a number of rules to get this done.

A normal day is at 5 am, our main lights turn on. Turn off at around 10am. Turn back on around 4pm, then back off at around 10pm. Bedroom lights turn on at around 7am, turn off at around 8:30am. Then turn on again around 4pm, then back off around 10pm. The randomness I was seeking is when the lights initially turns on and when they finally turn off. I wanted to avoid the "Home Alone" situation.. 5am sharp, lights turn on. 10pm sharp, lights turn off. I don't remember the last time I turned off lights when I left a room! Probably since the advent of LED bulbs or CFLs. Who am I kidding, I never turned off lights when I left rooms. I was a bad kid.

I was able to create something with 4 rules with a number of delays and some random delays. I'm not quite sure if they work yet though.

See my PM for how to schedule various lights in a single rule.

@dan.t The trigger and action of RM did throw me for a loop since webcore can subscribe to multiple events within the same piston.

I got my Hubitat between the revision of RM4 when the restrictions were removed. I noticed some of my rules had restrictions dropdown and some didn't. I couldn't figure out how to get it back until I learned that they were removed. I thought I was going crazy. Now I'm getting brain lock when trying to figure out "If (NOT Mode in evening, night) then exit rule." Don't get me started when I try to add a second NOT condition.

It takes some time to get used to it, for sure. Think about one step at a time. Like this:

no need top combine them, the rule runs top to bottom.

This is an interesting screenshot. I didn't realize there was a specific IF (NOT blah) exit rule action. I now see that using the simple condition is what I need to use. I was using If (NOT blah) then exit. When I add a second IF statement, it nests it below the previous if statement. It probably should still work but kind of looks terrible.

The top to bottom threw me for a loop too!! When you create multiple actions in sequence with the delay option turned on. The rule does not wait until the delay completes before proceeding to the next action.

Thank you for all your help!

Yes, that is by design that way. If you specify a delay on an action only that action will be delayed. There is another action that is called "Delayed Actions"


that will delay all actions following this action. Basically makes the script "pause"

Just in case you are interested I have a rule that when we are away, and between certain time of the day, it turns on the Hall downstairs light, waits a few seconds then turns on a Loo light.
After a small amount of time the Loo light turns off and a few seconds later the hall light.
It's pretty straight forward and here it is.

image

Thank you for this. A little earlier, I was just thinking about how I could consolidate my different time scheduled rules by adding multiple time based triggers into one rule, then creating if/then statements checking the time like what you posted.

Just out of curiosity, I am wondering if the 2 endif's need to be there or is it not necessary in this rule. I thought one should be after END-REP and another at the very end. Still trying to get when and where they should be put in. thanks

I see what you are saying. :thinking: I think logically there probably should be another END-IF after the last END-IF.
It does seem to work though.

Download the Hubitat app