How to make a basic rule for sunset and sunrise

I have two light bulbs that I just bought that are matter enabled and would like to set them for Sunday set to turn on and sunrise to turn off?

All explained in the documentation. Here's the link:

https://docs2.hubitat.com/en/apps/basic-rules

In basic roll machine I don't see an option for sunrise and sunset. So what option am I supposed to use?

Read the documentation. It's in there. Right up front as the first type of event that can be used as a trigger.

1 Like

I'm not understanding that document I just need step by step instructions!
Now it say it is Restricted for the rule.

You need to add the final action to turn off the light.

I don't use Basic Rules myself, but I'm guessing you added that Restriction (as opposed to the system adding it) --it doesn't seem necessary, so you should be able to just remove it.

2 Likes

I got it working but I had to add to Rules.

one of my new laundry room Light bald not running off in hubitat. in it app it say it is off. but hubitat say it is on.

Light bulb?

Is that related to your basic rule or something different?

Also I’m not quite sure i understand the purpose of the restriction you added to your basic rule.

The rule turns the porch light on at sunset. But then the restriction will disable pending actions when the porch light is on.

So since the porch light will be on until sunrise, and the rule has been restricted from running since the light turned on at sunset, how will the light be able to turn off at sunrise?

As written, the restriction will prevent your rule from turning the light off at sunrise. And it doesn’t appear to do anything useful otherwise. What was your goal with that restriction while creating the rule?

2 Likes

As has been noted already, it does not appear that you need the Restriction in your rule. The following rule is an example of turning ON a light switch at sunset, then turning that same switch OFF at sunrise.

1 Like

When I get back home I will post an updated picture of my setup. But my new question is how do I set up sunrise and sunset for front porch and back porch as two separate rules for example front porch comes on at sunset and goes off at sunrise. Then the back porch does the same. I'd like to use two rules one for front porch and one for back porch. Be back porch needs to come on at sunset and golf at sunrise in the front porch the same.

Perhaps I am misunderstanding you.

But you want two lights to come on and sunset, and the same two lights to turn off at sunrise?

Why do you want to use two different rules? You can control two lights with the same basic rule you already created.

2 Likes

It might also be worth re-stating (since it was pointed out above), that your last rule screenshot doesn’t appear to include an action to turn the front porch light off once sunrise has occurred.

2 Likes

This post: How to make a basic rule for sunset and sunrise - #10 by John_Land shows how to create an ON-at-sunset and OFF-at-sunrise Basic Rule for a single light switch. You can simply create a separate rule that looks the same but changes the light switch identification.

Alternatively, since it appears you want the front and back porch lights to go ON and OFF at exactly the same times, you can use a single rule and select BOTH switches in the ON and OFF actions (that is, in the blocks that say "Select switches to turn on" and "Select switches to turn off" -- note the plural, suggesting that more than one switch can be selected in those actions).

2 Likes

Also, another word of advice: it appears that you are new to Hubitat, and thus on the hard part of the learning curve. I was there not too long ago myself. One thing that really helps understanding the capabilities of Hubitat's various Rule making tools and how to use them to accomplish your goals is to look at posted examples.

Working through examples while reading the pertinent documentation is probably how most programmers have learned a new language/environment (I find reading the documentation straight through without seeing examples of usage doesn't stick with me very well). And experiment -- you can build up rules by testing bits and pieces and seeing how things work.

3 Likes