Condition - between sunset and sunrise (both offset)

I’m trying to limit the “then” of an activity to only happen on an offset of Sunset and an offset of Sunrise. I saw the previous discussion about considering having offsets for Sunset and Sunrise in conditions, so I don’t think that’s possible, yet. In the meantime, how about being able to just say between sunset and sunrise? I don’t believe I can put this in the trigger, as I need the action of a device closing to be the trigger (unless I can put the sunset and sunrise also within the trigger.)

I tried to put in two conditional rules that it happens after sunset and before sunrise, but that wasn’t working.

One other question: When I look at the logs, it doesn’t appear to be possible to see which condition(s) actually failed and which one “passed.” The only way I could tell is by removing certain conditions and then watching the behavior. Am I reading the logs correctly or is there something I’m missing that would tell me this information?

As you noted, the device event would be the trigger and you could use an IF Condition within the rule to restrict the execution.

You can edit the condition to use OR for before sunrise or after sunset. This post with the visualization might be helpful to you.

The logs should have the Runtime Data showing the various states that were used up to the comparison failure, but yes, you will have to compare those manually to your rule conditions.

1 Like

Thank you. Maybe it helps to visualize my flow, as I don’t see where I can add an “or” part anywhere. The additional restriction I’d like is the “then” should only occur after sunset and before sunrise.

You can do it as a nested condition.

IF bypassStatus is not 'bypassed'
THEN
   IF time is before sunrise or time is after sunset
   THEN
      setShadeLevel(0)
   ELSE
      //nothing
ELSE
   //nothing

Thank you. I couldn’t figure out how to change all to any, but now I see how to do it…

1 Like

Thanks for the update and my apologies for missing that part of the question. For anyone else who might find this thread via search in the future, you can tap the Edit button at the bottom of the IF Condition block, then change the drop-down selection at the top of that block.

Not a problem - thanks for the help :slight_smile:

1 Like