Open light at a fix moment close it at sunrise

Hello
In the winter time i open the light at 8:00am and close it at the sunrise but with the time the sun will raise around 6:30 and in this case the sunrise will be done before the 8:00 am triger, the light still open till someone close it.
What is the best way to programm this kind of situation??

Thanks for your support

1 Like

I would setup a “Required Expression” that the rule cannot run after sunrise.

1 Like

Ok i will try to di the rule, thank you

1 Like

I would also consider if you want a minimum amount of time for the light to be on. For example, if sunrise is 6:01, do you really want the light to on for 1 minute? My threshold is 4 minutes so my Required Expression would be something like
Time between 2:00 AM and sunrise -4 minutes

2 Likes

Sorry to ask, but i guess i need to write the code ? Because i don t see any option in the basic rule.

From my basic program i ask to open the light at 6:00am till the sunrise, right now and during the summer time the surise will be earlier then 6:00am. So this basic rule need to be adjust of pause for summer time. There s not option to write the rule like if sunrise is earlier then 6:00am do nothing.

Thank for your help

Basic Rule uses Restrictions that can be found at the bottom of the rule.

2 Likes

Thank you i will try it.

Hello a quick follow up, it's dosen't work not the fixed time is 8hrs am and the sunrise right now a 7h30. what i need in this case it's the rule don't start because the sunrise before the 8h00 am.

note : for now i put the rule in Pause mode but it will be nice to automate it. :slight_smile:

thank you

Change your Restriction to 02:00 and Sunrise-4 minutes.

that'S mean the light will open at 2hrs?
i will try it.

The Restriction means the rule is only able to run between 2:00 AM and Sunrise -4 minutes. Actual running will be controlled by when you tell it to run. This technique is use to make sure the trigger only happens when sunrise is after 6:00 AM.

Please post a screenshot of your entire rule so I can explain it further.

ok i will try it tomorrow morning and see what happen, below the rule.
thank four your help and support.

In your first post you said that you turn on the light at 6:00 but in this rule the first action turns on the light at 8:00. Do you want to turn on the light at 8:00? What time is sunrise?

Normaly in winter 8:00am is good, now the surise is around 7:20am, so following your advice i put the trigger at 6:00am to see if it will work.

Best regards

1 Like

if the sunrise is before the time set on the rule, no matter what eventually at the time the rule will start. ex : the time is 8 am and sunrise is at 6am eventually the rule will start at 8 but nothing to close the ligne after that because the next sunrise will be the next day at 6am. so this kind of rules are impossible i guess.

@Guy_F17 Let me restate what I think you would like the rule to do here. Please correct me if I'm wrong.
In the winter when sunrise is after 8:00 AM, you would like the light to turn on at 8:00 AM then turn off at sunrise + 10 minutes.
In the summer when sunrise is before 8:00 AM, you don't want the light to turn on.

Hello that's wright, for the sunset it's easy and no problems but for the sunrise it's different because the sun rise earlier in summer instead of winter so right now the sun rise at 6h50 am and the schedule is open at 8 am. in this case the rule need to stay close instead of open the light.

thank you for your support and sorry for my poor explanation.

The way your rule is currently written with the Restriction of Only between 06:00 and Sunrise-4 minutes the rule shouldn't be triggering at 8:00; however, I see that you also have Only on Saturday, Sunday. I think the Restrictions are allowing the light to turn on on weekdays but not on weekends. Is that what you're seeing?

The rule work saturday and sunday only, but this morning the lights was open at 8:00, seams like the rule don t work or is it because the surise is at 6:50 and the rule open the light at 8:00?

The Restrictions include Only between 06:00 and Sunrise-4 minutes so the rule should only trigger between 06:00 and 06:46. Since 08:00 doesn't fall within this time window the rule should not have triggered today. Do you have logging enabled? If not, enable it and post the logs that are generated tomorrow. Also, check the "in use by" section of the device page for your two switches and make sure there isn't another rule turning them on at 08:00.