Lights on at sunset, but off at a set time

Apologies as I'm a newb... I am trying to set some lights to come on at sunset, but turn off at 11p. I am totally turned around by the rules machine, so I tried simple lighting, but I can only find the ability to also turn them off at sunrise.

any thoughts?

I think a rule like this should do what you want:

Explanation - the rule has two "certain time" triggers: Sunset and 11:00PM. There is one condition (Time is Sunset).

When the rule is triggered, if it is sunset, then the lights come at the specified color/level. When the rule is triggered at any other time, the lights are turned off.


Use sunset as a trigger for a RM4
turn on lights
wait for events when time is 11pm
turn off lights

No IF statements required


As I'm sure you are now realising there are lots of ways to skin a cat. :wink:


This is amazing, you guys solved this question, and I'm pretty sure what would have been my next question. Thanks!

1 Like

Just a dumb question here, but if you happen to reboot the HE after sunset but before the wait till time, will the lights turn off at the appropriate time still, Or is the wait then interrupted and now you must wait until the next trigger event until the wait can be restarted (in other words, the light would say on all night and into the next day until the next sunset then triggers the on command then the wait period starts again).

You are correct that if the hub reboots, the wait time will probably not carry over. Myself, I just use two simple lighting rules, one to turn it on at sunset, one to turn it off at 11pm. Also @aaiyar 's solution should work over a reboot.

1 Like

...if you happen to reboot the HE after sunset but before the wait till time, will the lights turn off at the appropriate time still,

Yes, the lights will turn off at the appropriate time. When a rule is triggered, a wait for events of a certain time will create a scheduled job. Scheduled jobs are not impacted by a hub reboot and will remain as they were before the reboot.


Hello, I'm also new. For this same solution. I am trying to turn on 3 lights at sunset and off at 11pm. Two lights are on a lutron pro, one is a GE dimmer. Rule 1: I'm turning on the two lutron dimmers to 80 percent at sunset. Rule:2 I'm tuning on the GE dimmer at 20% at sunset. Rule 3: Turning off all 3 lights at 11pm.

Should this not work? Sometimes they turn on but not off, sometimes not on but off....

What does this 'wait" look like in RM4?
I basically have 2 Hubitat Simple Lighting child apps to achieve something just like this, wondering if a RM4 rule would be more efficient and easier to manage.

@aaiyar - This rule results in everything being off by default. In other words, assume after sunset you (but before 11pm), you run the rule again, everything will turn off. So, a simple workaround I used is to replace the If condition from "Time is Sunset" to "Time between Sunset and 10:55pm". The extra 5 mins is just there to avoid any overlap due to latency, clock sync, etc. But this way, if you ever run the rule AFTER sunset, it'll still qualify to turn the lights ON, which is the intent anyway.

Not a super important edit, but I was running a set of similar rules and it was annoying when it would default to off every time I updated and ran the rule again to test minor changes.

Here's an example of one of my recent rules (same thing, just a different time scale).
Screen Shot 2020-06-17 at 11.37.46 PM

1 Like

Just use the Built in "Simple Automation Rule" App
It makes it simple

1 Like