Sunrise Sunset

Hi Patrick
I’m using 3.3develop (stable version) and created a secondary condition in a sensor that only fires between Sundown and Sunrise…essentially night time.

As shown in the screen, the condition is green per the clock setting at the top of the screen, but the condition reads like I’m asking for daylight hours. It seems like the stated logic is backwards. Is this a bug or am I reading the condition wrong.

It looks like you entered it incorrectly. If you want to test for the night interval, you have to put sunset first then sunrise.

Right. But you can see from the clock in the image (top center), it’s long past sunset, the time interval is showing true (green) with the interval condition appearing to test for daytime. Last night, when I reversed the Sunrise Sunset position in the interval expression (Sunset—>Sunrise), the condition went false, even though it was night time (which is what caught my attention in the first place).

This afternoon, I recreated the condition, placing Sunset first, followed by Sunrise (ie night time) and now the condition shows false as it should. That’s why I was asking if this could be a bug. Perhaps something related to dusk to dawn logic…as dawn to dusk seems to trigger properly.

Nevermind. It was the 30 minutes after sunset offset that caused the condition to go true. Official Sunset arrived at 8pm here last night, thus it was right at the edge of the condition change over.

This is a much used condition, including in my own environment. Based on your goals, you need to have sunset first, then sunrise, in that order in the condition terms. If it goes wrong, make a logic summary and post it, and then it will likely be much more clear what it going on.