Sunrise / Timer conditional logic

Need a little help with how to set up the Trigger / Flow in the SharpTools Rules engine:

If SUNRISE is after 6:00a
THEN open shades at SUNRISE;

ELSE if SUNRISE is before 6:00a,
THEN open shades at 6:00a.


You will need to split up your logic.

Trigger is sunrise.

Your flow starts with if condition, before 6 am, then.
Else, then…

Edit, was a bit hasty as to your full needs.
You can make a variable that changes every day, triggered by sunrise, if before 6 am, do nothing, else turn boolean on. Reset it at noon or night.

Then you can make 2 rules, one to trigger at sunrise and one at 6 am. Depending on the variable status, it will fire or not.

I guess there might be a way to make this into 1 rule, but it’s 5 am and I’m failing at processing :sweat_smile:

1 Like

Maybe I haven’t had enough caffeine yet either @Sgt.Flippy_PJ – I had to write this one down to wrap my head around it. :laughing:

I believe something like the following should work:


* Sunrise
* Timer: 6 AM


IF time after 6:01
  shades â–¸ open()

IF time before 6:01
AND time after 5:59
AND time after sunrise
  shades â–¸ open()

For the triggers, we want to the rule flow to run at 6 AM and at Sunrise… and the flow will do the work of deciding what action it should take.

The first part of the flow checks if it’s after 6:01 – if it is, then it must be our Sunrise trigger, so we can open the blinds.

The second part is a bit more tricky. We’re basically checking if it’s the 6 AM trigger and it’s after sunrise. We check if it’s between 5:59 and 6:01 but also need to make sure that sunrise already occurred before that as we would have told the rule to skip it in the first IF condition (eg. nothing in the else path)


THANKS SO MUCH! I will give this a try!

I knew there had to be a nice concise way to write this… much cleaner than my WebCoRE piston!

1 Like

Does the Rule engine allow for:

IF ((time after 6:01)) OR
((time before 6:01) AND (time after 5:59) AND (time after sunrise))
shades â–¸ open()

I have several actions i want to bundle with my shades ▸ open() and would be easier to keep consistent if those actions didn’t have to be in 2 different places.

Gave that code a try last night. I presume the rule should fire only once: at 6:00a -or- at SUNRISE (after 6:00a); but it fired twice…

Thanks for any help…

Your trigger is 6:01 instead of 6:00, which makes the first part of your rule fire.
If it’s 6:00 that part won’t fire by the time schedule.

You want it to go to the second part of your rule.

I see my typo…

Just want to make sure I understand correctly… you’re suggesting changing only the TRIGGER (from 6:01a → 6:00a), but NOT do anything with either of the (2) IF conditions?


That way the rule works like this:
If 6 am triggers it, it’s not after 6:01, so the first part of the rule won’t execute.
On to the second part, it is between 5:59 and 6:01, sunrise has passed, so blinds go up. If sunrise hasn’t passed yet, nothing happens.

If sunrise triggers it and it’s after 6, so this would happen when the 6 am trigger already happened, but did nothing, the blinds go up. It’s not between 5:59 and 6:01, so the second part of the rule is not triggered.

With the 6:01 typo in your trigger, it will always make the flow run the first part, since it’s by default passed 6:01.

1 Like

Thanks again! It worked last night as expected: the rule only fired once, and according to my weather app SUNRISE was at 6:29a this morning…