Clarification about "between sunset and sunrise" rule action

I have a rule (4.0) which is meant to turn on some lights in the house when we are back at dark; I created it by adding a condition to the action which says (or should say) that the action occurs only between sunset and sunrise. But the action seems to trigger regardless of whether it happens before or after sunset, What am I doing wrong? This is the rule definition:

Can you show the rule please.
The boffins on here may need that info as well. :wink:

I guess what I posted contains the rule definition - in internal format; these are the two relevant screenshots displayed when editing it:

Ah OK.
At the bottom where you have created conditions they don't actually do anything. You have to define them in the actions for them to be evaluated.
So in your actions, and I don't use buttons so I'm assuming you can do this, use a conditional action.
Then select IF-THEN.
You should the end up with.......

Time is between Sunset and Sunrise.
Do your actions.

Ah, OK; something like this?

Looks good to me.
Just to be picky though it's good practice to end your expression with an END-IF.
It will not matter in this rule but if you move on to more complex rules you will definitely need to put an END-IF's in so I suppose it's good to get into the habit.

Got it; makes sense. I usually just code that kind of logic directly in the apps - this is the first time I use rules for anything more than basic actions; looks a bit awkward, but I can see the power and appeal.
Thanks for your help!

1 Like