Rule assistance

Iā€™ve long been doing rules with rule machine to allow me to turn on my house lights outside shortly after sunset, and then I have a separate rule that shuts them off about 20 minutes before sunrise since itā€™s generally light enough out.

What Iā€™ve been doing in the sunrise rule is saying at sunrise -400 minutes start fading down The exterior lights to zero. Issue is I want to be able to have one rule that does everything as opposed to two, my ultimate goal is to have it start feeding the lights down at 10 PM and then end about 20 minutes before sunrise. As the days get longer my rule start lowering my lights sooner than I want them to

My example would be as follows:

At 15 minutes After sunset, begin fading outside lights up to 100% over 15 minutes. (Easy enough)

At 10 PM, begin fading down lights to zero so that it ends about 15 minutes before sunrise ( canā€™t seem to get how I can do this within the same rule as sunset)

Iā€™m assuming it would be if sunset -15 then fade lights to 100% over 15 minutes at x rate.
THEN at 10 PM, fade lights to 0, but hereā€™s where I get lost, how do I tell the rule to use sunrise as the end, -15?

Can anyone help with this?

I think you are trying to have a dim rate that is the difference in minutes between 10pm and the next sunrise (less 15 minutes), is that correct? If so, you can setup a few variable and then have RM do the calculation of how many minutes that would be. You can do it by adding this to your rule:

In that rule, I calculate the difference between midnight and the sunrise time. Then I add to that the number of minutes between 10pm and midnight (120 minutes) less 15 minutes (105 minutes).

The setting of the variables, etc: ā€œSet EndTime to ā€¦ā€ is done with a ā€œSet Variableā€ command

Does that help? Let me know if you get stuck somewhere. And when you define the ā€œstartTimeā€ variable, be sure to leave the date blank.

1 Like

This is exactly what I want to do, but when I create the rule, it doesn't proceed forward.
I select action, then set variable, set variable, then set endTime but nothing happens, it doesn't give me a "done with action" button and I cant make any changes.

I am sure I am missing a step.

Interesting - The exact same thing happened to me the first time I tried to build the rule to test. I went through the steps and at one point, there were no longer any drop downs or buttons appearing.

I started a new rule from scratch and it worked. I suspect a small bug, but not sure if @bravenel is aware of it, or if there is a way to consistently reproduce it.

Try starting again from scratch and let us know if that works. If not, please provide the exact steps you followed and Iā€™ll try to reproduce.

Looks like doing a new rule fixed that issue, thanks!

But what do I do for a trigger for this action? is it certain time 10PM?

Also why add the 105 minutes ?

here is my rule:

10pm should work as a trigger.

Form the 105 minutes:
The rule that I had calculated the time between midnight and sunrise. Adding 120 minutes (2 hours) to this makes this the time between 10pm and sunrise. Subtracting 15 minutes makes it so it will finish dimming 15 minutes prior to sunrise. 120 minutes - 15 minutes = 105 minutes.

I did this because I believed that it would not be able to calculate the time between 10pm one day and sunrise on another - I made an assumption, but didnā€™t test itā€¦ I see you went directly from 10pm to sunrise in your calculation - if that works, the addition of 105 minutes is not required.

I think you are right, I am seeing this now, I can't seem to get rid of this invalid error.

The invalid is due to the number being negative. It might be having problems with the 10PM to 5:58AM difference calculations. First thing to try is just reversing those to (Put EndTime in the first ā€œslotā€ and startTime in the second. That will make it positive again.

If that doesnā€™t work, try setting the startTime to 0:00 and removing the 105 minutes.

It wonā€™t do that with the variable, it always puts minuetsDiff in the second slot.

I think I may have it now, Iā€™m going to test tonight.
Iā€™m assuming my trigger event for the action will be my 10pm time?

1 Like

Yes, 10pm should be the trigger.

I have the rule created, and tonight will be the test of it. Last night I tried it but it didn't work, I think that was on my side of things, I had something wrong.

I have create the rule as follows:

One thing I am curious about, the minutes diff I have to put in a value myself, is that just the first time only? or is it going to always use 475 minutes? If too, that would end up wrong at some point in the very near future for timing

1 Like

Once I get this working, I would have another item I would like to add, and maybe it is pretty simple.
I created this rule to have my lights come on and fade up over time, is there a way to combine this all int one rule, or is it just easier to keep them separated?

1 Like

It will update every time the rule is run. After 10PM tonight, you will see the value that was calculated on this run.

Itā€™s up to you to combine the 2 rules or keep them separate. In this situation, either should work.

To combine, add at the end of the actions of the first rule to trigger the fade-up:

Wait for condition: time is sunset+15 minutes
Fade Outdoor Garage lights, ā€¦

1 Like

Working like a champ! Thanks for the help!

1 Like