Looking for before sunset and after sunset

Hello,

I’m going to try and explain my question correctly here so stay with me.

I am looking to have a certain action within a rule in rule machine to only fire if the time is before sunset. I am not looking for between sunrise and sunset and I’m not looking for between sunset/sunrise and another time.
I simply want to use “if” before sunset the trigger a certain action.

I used to use webcore and the before sunset, after sunset, before sunrise and after sunrise option was there. I can’t find those option in a conditional if within Hubitat rule machine. I am only finding between certain times option.

I think you will need to define between times, because EVERY time is before some sunset. Even if sunset is at 7:30pm and it is currently 7:45pm, it is still before sunset tomorrow.

Would defining the condition as between 12:01 am and sunset work for your use case? Or even take the latest sunset of the year at your location, and define the condition as between latest sunset of year + 1 minute and sunset.

2 Likes

I would use a virtual switch or variable. Every Sunset switch turns on, or variable goes to 1. Sunrise, it switches back off or variable to zero.

Then you can just use variable 0 or 1, or virtual switch on or off as the test in your rules depending on what time segment you are looking for.

Keep it simple.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.