Rule Confirmation

Greeting Everyone,
Could someone look at this rule and tell me if you feel it will work as intended..

I need to have this rule run when the sun goes down.. The sunset option works fine but if its cloudy outside, its dark for some time before the lights go on.. So I added the required expression to keep the rule from running in the morning if its really cloudy and turning hte lights back on all day.. I am not concerned with the actions - they work perfectly..

I greatly appreciate any suggestions..

This rule will trigger only between 5:00 and 10:00 pm when the illuminance goes below 1000 or less.

Be aware, however, that it will also trigger when the illuminance is 1000 and then again at 999 and 998, and so on. So you probably want to add something to only allow your rule to trigger only once a day. [Note] it will just be sending the on command to a device already on, so will work.

A couple of ways to do that. The private boolean method, or perhaps the use the don't trigger when rule is running and add a wait at the end of the rule until 10:00PM

2 Likes

@terminal3 Thank you...

Trying to understand..
I added this

Are you saying add a "Wait" in the actions??

Or why not just use sunset

"Ignore Trigger Events While Running" will only apply while the rule is actually running its actions (which doesn't take long in your case since you don't have any waits or delays) - it won't ignore additional trigger events after the rule finishes running.

To ensure it only runs once a day (if that's the goal), you can use a private boolean, or you could have the trigger time be 5pm (or sunset or whatever time), then use a "wait for illuminance <= 1000 (timeout 5 hours [or whatever makes sense])"as the first action in the rule.

I was suggesting a wait until 10:00PM as the last action. I am still not 100% clear if a during a wait the ignore trigger while running is valid. As the rule is basically waiting for another trigger, time to become 10:00PM.

So perhaps the private boolean would be a better choice. Setting private boolean to False when the rule starts and then after the wait until 10:00PM set it to true. Use Private boolean as true along with your time constraint as required expressions.

I have never used used boolean's before so I am not sure how to implement that..

Yes my goal is to only have the rule run once. Let me see if I can decipher the below..

Just using sunset as the trigger may be the easiest solution here though -- then you don't have to mess with waits etc...

I get that wouldn't catch activating earlier on a gloomy day, but in terms of just getting this up & running in the meantime, sunset would work.

But here's an example of what I mentioned earlier -- this rule turns on an exhaust fan on in my detached garage when afternoon temps get hot in the summer...

Starting at ~Noon, the rule waits for a certain temp to fire the fan. But the whole rule times out in the early evening (7 hours later) if the temp threshold isn't ever hit. This ensures it runs just once a day...

Summary

Apologies I wasn't able to post this when I made my earlier comment - I was travelling at the time.

@hydro311 Thanks Chris..

What I would do for this is the following:

Required Expression: None

Trigger: When time is 5pm

Action:
Wait for expression: Illuminance of Wayne’s Weather Station reports <=1000
…Keep the rest as is.

—-
This will trigger the rule every day at 5pm. Then it will run if the illuminance is already <= 1000, or only when the illuminance reach that value later on in the late afternoon/evening. It will also only run once a day.

4 Likes

As @Sebastien shows there are many approaches that would also be a good approach. Just to be clear. however, your rule will probably work as is. It will just send a command to run the expected IF section every time the illuminance lowers until 10:00PM.

If you want to use the private Boolean method you just add private Boolean as True as another required expression.

Then the first action in your rule is to set the Private boolean False. Once you set the private Boolean False your rule can no longer trigger because the private Boolean must be True. The rule will however complete the rest of the rule actions.

So after the ENDIF set a action to wait until time is 10:01PM. Then set the next action after the wait to set the private Boolean to True again. Your required expression will still be false as it is now 10:01 PM and outside of your time constraint. The private Boolean is true but both required expression must be true. At 5:00 PM the next day they will both be true again and your rule can now trigger again when the illuminance drops below your set level.

1 Like

@Sebastien Like this?

1 Like

I think that looks good - there's no need to do a "cancel timed actions" since it will inevitably get that dark at some point in the evening.

Only wildcard to consider depends on where you live -- in the winter season, will it already be that dark at 4pm? If so, you could bump the trigger to be earlier. However, then the risk is that this time of year, a dark afternoon thunderstorm could trigger all of this several hours before dusk.

It's all a lot to consider & juggle!

You mean the ignore trigger events switch?

I was talking about the "cancel timed actions" step that I have in my example rule posted above, but there's really no need for the "Ignore trigger events..." switch either.

That "Ignore..." option is really only useful when a rule has delays or waits that would cause it to have an extended "run time" (for lack of a better term)... In those cases, subsequent triggers could potentially cause the rule to re-fire instead of just completing its current run. But even when waits/delays are involved, that switch is not necessarily the right answer every time -- that particular rabblt hole is pretty deep, so I'll avoid going down it here...

In cases like this (no waits or delays), the rule's run time is very fast -- there's really no threat of a retrigger messing anything up, so employing that switch just isn't necessary.

Edit - ugh, my soapbox there was well-intentioned, but I shot at the wrong target lol...
Yeah, you obviously do have a Wait there, but your trigger is 4:00 -- that certain time isn't not going to happen more than once :), so the general answer remains same (no "Ignore..." switch necessary)

@hydro311 Thanks Chris... We will see how the rule works this evening and Ill let you know..

Yes.