Time issue when sunrise moves


#1

I have a problem with my lights (they are coming on throughout the day) and I think I know the issue but I’m not sure.

I have the following code, but Sunset happens before 6:25, does this mean that Webcore will treat it as 6:25 today and sunrise tomorrow?

06


#2

As long as 06:25 is before sunrise it will use today’s sunrise. If sunrise is before 06:25 the it will use tomorrow’s sunrise.


#3

I am curious if anyone can confirm if the opposite is also true…

For example, if I invert the code to say:
execute only when Time is between sunrise and 06:25:00

Will it use today’s sunrise if sunrise is before 6:25?
Will it use tomorrow’s sunrise if sunrise if after 6:25?

If so, then maybe use something like this:

If sunrise > 06:25:00 then execute only when Time is between 06:25:00 and sunrise
If sunrise < 06:25:00 then execute only when Time is between sunrise and 06:25:00

This would basically insure that it always triggered between 6:25 and sunrise, no matter which came first. (of courses, two days a year the sun will rise AT 6:25, so nothing will trigger on those days.)


#4

Thank you. Does anyone know how to fix this?


#5

I$sunrise <= datetime(‘06:25’) Triggers if sunrise is greater or equal to 06:25
$sunrise >= datetime(‘06:25’) Triggers if sunrise is less than or equal to 06:25

If you look in your webcore console there is a list of functions in there with the values returned. $sunrise will show you what is being returned for sunrise. Both date and time


#6

Thank you. I couldn’t work out how to enter it the same way as you. Will this work the same?

time


#7

I’m not sure on mobile right now. When building the piston. Where you are entering $sunset. Click in the option for value and a drop down will open. Select expression and it should let you enter the way I showed earlier.


#8

Try restoring this piston with backup code. Then click on the statement and see how done. Also fin there modify to your needs