Rules Machine - Light On and Light Off

I just received my hub about a week ago and I'm having issues getting a lighting rule to work in Rules Machine. I came from Homeseer, so I am used to home automation and rule formatting for integrations. I've attempted multiple times excluding and re-discovering my z-wave devices and I've also attempted a complete reset of my hub. Here's the rules I'm having issues with:

Rule #1:
Trigger Event "When time is Sunset-30 minutes"
Action "On: Light Switch"

Rule #2:
Trigger Event "When time is Sunrise-30 minutes"
Action "Off: Light Switch"

Rule #1 works perfectly every time. However, Rule #2 does not work. It makes no sense to me. Anyone have any insight on why this is happening?

It should work, seems simple enough. These are two separate rules in RM? Hard to say why it is not working from what you posted.

Perhaps turn on logging in your rule and see what the log says. You could also post a screen shot of the rule, perhaps someone will see something you are missing.

Yes, there's two seperate rules. I turned logging on when I originally created the rules, see screenshots below:

Seems weird that the System Event Log only has sunset events in the Location Events section:

Here's the Light Off Rule:

Here's the Light On Rule:

Here's the Light Off Log:

Here's the Light On Log:

IMHO use simple lighting- (simple automations) for this rule. It's recommended to only use Rule Machine when you need complicated calculations or something that is not available in motion lighting, simple automations, and notifications apps. All are native apps but you need to add them to your hub through the built in apps menu.

Also, your system might have to establish the sunset time when it checks in with the servers. It's been a long time since the question was asked, but if you search it out here, you'll come across the answer. I would take a moment to verify that your location and timezone is correct in your hub under settings.
Then, load the simple automations app, set it up in one rule and move on to something more fun.
Welcome to Hubitat


Per your advice I've uninstalled the Rules Machine and I've installed Simple Automation Rules. However, I cannot achieve my desired result with a single rule. I have to create two rules; here's what I've done:

What is the procedure for requesting a return and refund? If this does not work, then I'll just go back to HomeSeer. I don't want to continue to troubleshoot and work with a hub that cannot get a simple lighting automation done. It really dissuades me from wanting to try anything more complex.

What's wrong with doing it in 2 rules? Not like they charge by the rule... :slight_smile:


I didn't say anything was wrong with doing it in 2 rules. That comment was in reference to @april.brandt telling me to set this up in a single rule.

1 Like


You should be able to do this in either RM or simple automations. Not sure why your RM rule wasn't working - just glancing at it, it looks fine to me.

I assume hitting OFF on the device details page works? (I'm sure it does if ON is working, but had to ask)

Yes, manually triggering "on" and "off" in the device page works just fine.

1 Like

Could this be a time zone thing, with sunrise/sunset times not setting correctly?

1 Like

The OP is missing the sunrise in the event log. I think I've read somewhere that it might help to change the hub to a different time zone and reboot the hub. Then when the hub is back online, change the time zone back again and a second reboot.

So I did a reboot. Then I changed the timezone to Pacific Timezone. Then I rebooted. Then I changed the Timezone to Eastern Timezone. Then I rebooted again. The Event Log still does not show a sunrise time.

I assume that you used the update after every change of time zone, even though I do not know if it matters. Despite of this, there have been a few users that experienced similar issues as you do, and the link below is one of them. Maybe this could give you another approach towards a solution.

Yeah I'm not fooling around with all this mess. The Hubitat hub should be able to do a simple light automation triggered off the sunrise/sunset. How can their hub be bugged to not know the sunrise time? I've searched through the forum and see a lot of people having similar issues with the sunrise triggers. I'm just going to return for a refund. Thanks for all the replies and attempts to help.

And it can/does. I used sunset/sunrise times for a very long time before I moved my calcs elsewhere. Worked fine.

The speculation is that there is something funny going on with the sunset/sunrise calcs - thus the suggestions.

Anyway, good luck wherever you end up. :+1:

1 Like

Look through the whole list while you are in timezones. Is Eastern really the closest match for your exact location? (They aren't always alphabetical by the way.) I have two other choices that are more specific for my State, and a close by metro area, in addition to Eastern zone. (3 total)

I have suggested before to try the more specific locations when seeing this behavior, and nobody has really given feedback whether doing this works or not. But they never said it didn't work either. If it is related to using "Eastern" instead of "New York" that might help to track down a bug or whatever.

Regardless if the timezone is right or wrong. There is a sunrise time that is associated with whatever timezone is set. My light NEVER turns off even though there is a rule that states says "Turn off at sunrise-30 minutes."

You also have to make sure that your hub's location is correct. Sunrise is not only based on timezone but your long/lat as well. I have my timezone set for US/Eastern and it works for me. If you go into your hub's location setting it will display the sunrise and sunset times. If those are not set correctly, nothing will work. But that is where you can check it.

1 Like

You might try it in one rule. I've had luck with the following rule (you can state +- 30 min in the trigger).


1 Like