Daylight Savings and Sunset

triggers

#1

Two pistons set to execute at 30 minutes before sunset are executing 1 hour late with time change today

A piston set to execute at sunset did work properly


#2

I think the choice of wording resolves it. For example, this worked at the expected time:

temp


#3

Same here. I noticed that a lighting piston that usually executes 1 hour before sunset didn’t fire until sunset. The system variable for $sunset shows the correct time for sunset but the piston missed the “execute at 1 hour before sunset” statement. It’s been working fine for months until today. I’m assuming the time change is causing a problem somewhere in ST or WC.


#4

@markplewis @WCmore Same here, but I’ve got problems with BOTH webCoRE AND ST:

  1. Simple piston that executes at 7:40 PM executed today at 6:40 PM, one hour early. See pic below.

  2. ST Smart Lighting rules that should fire at 60 minutes before sunset triggered one hour early today, too.


#5

I see the same thing: (expression) formatDateTime($sunset, “H:mm:ss:SSS”) »»» (string) 16:25:00:000

So $sunset is returning the correct time, 4:25 PM.


#6

Yes. If a piston only has one trigger like this:
temp
it will only run once a day.

At the end of the execution, it schedules the next execution time 24 hours in the future.

So, in other words, the last time the piston loaded into memory (Saturday night), it was on track. Yet during that 24 hour wait, our clocks changed, so the next run (on Sunday) was an hour off according to our new time. Once it runs on Sunday, it schedules another accurate wake up in the future.


On important timers, one way to prevent this is adding a blank trigger at 3:05am every day.

Something like this:
temp

This will wake up the piston, but not actually run any code. The entire purpose of this is to reset the real timer (in your case 7:40) in the following lines. This is in case our clocks changed.at 2am (with a 65 minute buffer added for when the clocks move forward)


#7

Thanks for the explanation. My pistons appear to have self corrected and show correct execution times.


#8

Thanks. Of course! I completely forgot that WC sets up the next run time each time a piston runs. That makes perfect sense.

My ST Classic app (IOS) had a similar “off by one hour” problem in Smart Lighting rules. Do you think the same thing holds for the ST rules engine?


#9

I looked at the log for this piston (abbreviated version below). A few curious things:

  1. The piston should set up scheduled jobs for 7:40 pm. It is setting those up ok, but it is also setting up other executions at odd times like 7:56:52 PM and 6:43:32 PM.
  2. At 11/3 7:39:39, it set up a scheduled job for 11/3 at 7:56:52 PM PDT
  3. Then, at 7:56:52 PM PDT, it set up a scheduled for Sun 11/4 at 6:40 PM PST. Not sure why it ran at 7:56:52. It set up the scheduled job for the correct PST time, but didn’t make the correction for the extra hour. So it essentially set the piston up to run 24 hours later.

I added the code you suggested for the blank trigger at 3:05 AM every day. The piston set up a scheduled run today at 7:40 PM PST which is correct.


#10

That extra wake up schedule is because you have "Wait randomly between 0 and 40 minutes" in your code.


#11

Thanks. Well, that’s another “Duh” moment!


#12

…and the 6:42 execution would have been 7:42 a day before. That should be all sorted out today, I hope.