Rule machine to open light at sunset


I'm new with Hubitat and Rule machine. I want to open my living room light 30 minutes before sunset and close it at 22h. I made this rule and it doesn't work.

Select Trigger Events
When time is Sunset-30 minutes

Select Actions to Run
On: Prise Salon Wait for events: When time is 22:00 Off: Prise Salon

Can anyone tell me what is wrong with my rule?

Please help me!

There are people better placed than me to help with RM, but I use it a little.... How is the rule not working? Is it not firing at all?

That looks good to me, so I'm not sure what would be going wrong. Turning on logging (trigger and action logging, at least) would tell you what RM thinks it's doing so would give you something to look back on to confirm whether it actually ran and what it tried to do.

As an aside, you don't really need Rule Machine for this; Simple Automation Rules is easier to set up and would work here, too. (I like to suggest the simplest tool for the job.) But it still doesn't explain this. :thinking:

Not sure about wait for events, however this works for me: (you can change the off to a fixed time)

Yes, It doesn't fire at all.

I tried to turn the light on at a certain time and close at a certain time and it worked. But with this, it doesn't work at all.

I haven't done anything myself that uses the sunrise / sunset options. How are they determined? Do you configure them somewhere, or does HE pick them up automatically?

That's a good thing to consider! I forgot to ask:

In Settings > Location and Modes, make sure your hub location is set correctly. The actual latitude and longitude or, equivalently, on-map location, are what determines this (the postal code may get you somewhere close but isn't ultimately used) and, together with your "Time Zone" setting (which you should also check) is what Hubitat uses to calculate sunrise and sunset times.

Hubitat seems to do pretty good at guessing locations if you use a US-based ZIP code. Guessing by your device name and profile time zone, I'm guessing you might be in Canada, and I've heard from non-US users that it seems to do a bad job detecting your location in that case. Manually configuring this might be the trick to making it work correctly. Ensure the "Sunrise" and "Sunset" times are accurate on that page before you leave.

Good luck!

1 Like

Thank you @bertabcd1234.

I already cheked that. When I found that, I tought my problem will be over (i was in Atlantic time insted of Eastern time). But apparently it changed nothing...

I tried to stop the hub and restart it to fix my problem, but now, it doesn't restart...

I was with Wink and wanted something different and I had great expectations. I hope I'll be able to meet those expectations...

Why not just break it into two rules? You can make all the rules you want. Don't even need RM4 for that. Sunset +45 Dim Front Entrance_v2 100
Sunset +120 Dim Front Entrance 0

Simple automation to turn on light 45 minutes after sunset.

Then another rule to turn them off 2 hours after sunset.


Have you tried the solution in my post 4? It's really simple just change the off time to 22:00 (10:00 PM) for me.

I have other rules that essentially do the same thing but have added capabilities that would cloud the issue here.


Simple is the way to go. Using Rule Machine is like using a cement block to swat a fly. Sure it probably will work, but using a flyswatter (Simple Automation) would be more appropriate.

I use to have all kinds of complicated rules to reduce the number of rules I had but rules are free and they run faster and more reliably when you keep it simple.