DST and Messed up Automation

Just a somewhat humorous rant about the time change and HE.

I have a light in my living room that comes on at 6 am and goes off at sunrise. Got up this morning, way too early due to time change, and walked out into living room. Stubbed my toe as light wasn't on.

After a couple cups of coffee to get my brain working I finally figured it out. The sunrise was calculated yesterday evening before the time change, so thus the schedule for light off was set. And then the time changed and the light went off an hour early.

This rant is not against HE, it's against the ******* that still want to change the time twice a year.


I agree - It's just stupid to do this. If we want to start this or that earlier or later depending on the season, we could just do that. But instead, we rearrange the whole - oh, no, wait - just most, of the country. What the _ ?

How we are the dominant species is still a matter of amazement to me.


This is why I have exposed my time of day routines via virtual switches. Just like modes I can set the flags that control my automation. Sitting in my office with the sun coming in the window all my Dawn lights came on. Clicked one switch in the dashboard and things were back to normal until the sunrise/sunset variables are corrected the next day.

Even my weather station was having issues yesterday, I get an extra Sunday:


Did you just set this up yesterday? Was it before sunrise, or right at sunrise? Unless you (a) set it up yesterday, and (b) it was for before sunrise, it should have worked. We aren't hearing of a lot of failures this morning wrt DST change, so I'm hopeful we may finally have gotten this working right.

1 Like

I have Mode Manager configured to change the Mode from Night to Day at Sunrise every monring and it didn't change this morning. Not a huge deal, but just FYI

Can you show the App Status page (gear icon) where the Event Subscriptions portion is. That should have worked.

And here is the Event Log. Last entry was at midnight but nothing this morning.

So it is for before sunrise, right? Could you show the app setup itself?

Yes, I do use a slight offset to accommodate for twilight (10 min before sunrise and 10 min after sunset)

Did you just install this or hit Done yesterday? Or had it been there for a while?

It has been set this way for months with no changes.

Thanks. See my PM.

I'm pretty sure this is a bug in Mode Manager.

Didn't mean to cause quite a stir. Just mainly kibitzing about the time change.

I guess I should explain what I have going on. Way back when, probably a year or more ago, I set up a custom app to turn on a virtual switch at sunset and off at sunrise. I then use this switch several places.

The app worked fine except over the course of a few days I noticed the time wasn't changing. Sunrise and Sunset got scheduled ok, but it was always the same time as it was first scheduled. I attributed this to me not really understanding how it all worked.

So I changed my app. When it runs the sunset routine it reschedules the sunrise. And vice versa. That has worked great all this time so I really didn't think much more about it. Thus last night when it ran the sunset routine it scheduled the sunrise based on last night.

So if there was something initially wrong with the sunrise or sunset I didn't realize it and since my method worked ok, I didn't worry anymore about it.

There are system events, sunrise and sunset, that you can subscribe to, like this:

subscribe(location, "sunrise", handler)

Those will work through the DST change.

Not only that but the US decided in 2006 or 2007 to shift our DST switch over date a week different that before. While the EU is still at the old change date. So right now EU is still in standard time. Of course what would we expect, the rest of the world in in metric.

1 Like

Can you do an offset with that method?

No, that just gets an event at sunrise/sunset. After sunrise/sunset is easy, because you get that event and just runIn() so many seconds later. Before is trickier. There are two more events of interest: tomorrowsSunrise and tomorrowsSunset. Each of those comes right after sunrise and sunset as appropriate, and give the date object for tomorrows event. So before sunrise takes getting tomorrowsSunrise and subtracting some number of minutes from it.

This is what I do now. It works ok, just the two times a year where it’s off. Not that big a deal.

def riseAndSet = getSunriseAndSunset(sunsetOffset: -15)
schedule (riseAndSet.sunrise, sunriseHandler)
schedule (riseAndSet.sunset, sunsetHandler)