Mode manager not switching to Day

I have an issue where the hub is not transitioning from Night to Day mode. It does sometimes, which is strange, but often not.

When Day mode is not selected, I get the following in the logs:

2022-04-25 06:30:00.107 Not setting mode to Day, earlier of two times already happened
2022-04-25 06:25:00.074 Not setting mode to Day due to wrong day (Monday).  Current mode is Night.

The configuration of mode manager is as follows:

Day: Earlier of two times, 06:30 or Sunrise on Sun, Mon, Tue, Wed, Thu, Fri, Sat 
Evening: at Sunset -30 minutes on Sun, Mon, Tue, Wed, Thu, Fri, Sat 
Night: at 22:30 on Sun, Mon, Tue, Wed, Thu 
Night: at 23:45 on Fri, Sat 
Modes to ignore time changes: Away

Here is a more full log from the Mode Manager. I have annotated it with the day.

Tue
2022-04-26 06:30:00.110 Not setting mode to Day, earlier of two times already happened
2022-04-26 06:26:00.101 Not setting mode to Day due to wrong day (Tuesday).  Current mode is Night.

Mon
2022-04-25 23:45:00.050 Not setting mode to Night due to wrong day (Monday).  Current mode is Night.
2022-04-25 22:30:00.058 Mode set to Night from Evening
2022-04-25 16:52:00.064 Mode set to Evening from Night
2022-04-25 06:30:00.107 Not setting mode to Day, earlier of two times already happened
2022-04-25 06:25:00.074 Not setting mode to Day due to wrong day (Monday).  Current mode is Night.

Sun
2022-04-24 23:45:00.049 Not setting mode to Night due to wrong day (Sunday).  Current mode is Night.
2022-04-24 22:30:00.076 Mode set to Night from Evening
2022-04-24 16:53:00.058 Mode set to Evening from Night
2022-04-24 06:30:00.169 Not setting mode to Day, earlier of two times already happened
2022-04-24 06:24:00.089 Not setting mode to Day due to wrong day (Sunday).  Current mode is Night.

Sat
2022-04-23 23:45:00.097 Mode set to Night from Evening
2022-04-23 22:30:00.045 Not setting mode to Night due to wrong day (Saturday).  Current mode is Evening.
2022-04-23 16:54:00.074 Mode set to Evening from Day
2022-04-23 06:30:00.032 Not setting mode to Day, earlier of two times already happened
2022-04-23 06:23:00.174 Mode set to Day from Night

Fri
2022-04-22 23:45:00.065 Mode set to Night from Evening
2022-04-22 22:30:00.040 Not setting mode to Night due to wrong day (Friday).  Current mode is Evening.
2022-04-22 16:55:00.067 Mode set to Evening from Day
2022-04-22 06:30:00.031 Not setting mode to Day, earlier of two times already happened
2022-04-22 06:23:00.174 Mode set to Day from Night

Thu
2022-04-21 23:45:00.048 Not setting mode to Night due to wrong day (Thursday).  Current mode is Night.
2022-04-21 22:30:00.067 Mode set to Night from Evening
2022-04-21 16:56:00.077 Mode set to Evening from Night
2022-04-21 06:30:00.172 Not setting mode to Day, earlier of two times already happened
2022-04-21 06:22:00.091 Not setting mode to Day due to wrong day (Thursday).  Current mode is Night.

Wed
2022-04-20 23:45:00.047 Not setting mode to Night due to wrong day (Wednesday).  Current mode is Night.
2022-04-20 22:30:00.065 Mode set to Night from Evening
2022-04-20 16:58:00.077 Mode set to Evening from Night
2022-04-20 06:30:00.122 Not setting mode to Day, earlier of two times already happened
2022-04-20 06:21:00.076 Not setting mode to Day due to wrong day (Wednesday).  Current mode is Night.

Tue
2022-04-19 23:45:00.038 Not setting mode to Night due to wrong day (Tuesday).  Current mode is Night.
2022-04-19 22:30:00.059 Mode set to Night from Evening
2022-04-19 16:59:00.063 Mode set to Evening from Night
2022-04-19 06:30:00.149 Not setting mode to Day, earlier of two times already happened
2022-04-19 06:21:00.077 Not setting mode to Day due to wrong day (Tuesday).  Current mode is Night.

Mon
2022-04-18 23:45:00.050 Not setting mode to Night due to wrong day (Monday).  Current mode is Night.
2022-04-18 22:30:00.063 Mode set to Night from Evening

You can see it sometimes works, but other times does not.

My guesses as to what is wrong:

  • Some issue with time zones - I am in Sydney (GMT+10). It means when sunrise happens, it is still the previous day GMT.
  • Could there be an issue calculating Surise/Sunset?
  • Is there an issue related to the fact that the two times: Sunrise and 6:30am are currently quite close together at the moment.

Here is a picture of my Mode Manager config:

Your last guess seems the most likely to me, but nothing looks wrong with your setup, so it should work.

You may want to verify that your location (latitude and longitude) and time zone are correct in Settings > Hub Details. While there, you can also see what the hub is currently calculating for sunrise and sunset, which may provides additional clues.

It seems ok:


FWIW, I'm on the very latest version, but I think this has been happening for a while.

According to the first log, it occurred just after 6:30am, 110 milliseconds after. At that point I would expect Sunrise would be 6:26am the next day and 6:30am has already happened. That said, that could also just be a delay in the log being recorded....

Might be one for @bobbyD or one of the other support / dev staff?

Is it possible this is related to the discrepancy of sunrise time being a previous day (a recently identified issue)? I could imagine where when the rule is run, it checks for an updated sunrise time, then compares it to the sunrise of the day before and determines the time has already passed....
you could test it by adding a different source for the sunrise time, then comparing against that specifically in the rule to see if it resolves... I'm using OWM (OpenWeatherMap) to pull sunrise/sunset data. I had 2 rules that were comparing to Sunrise and not firing on the expected minute - ultimately I took sunrise out of the equation ...

Just tossing that out there...

There might be an issue, I will try to replicate to see if I get the same results. Meanwhile, may I suggest removing the days from Day and Evening? Obviously, you need them for the Night mode.

1 Like

I'm not sure this is possible. For Day and Evening, if I uncheck all the day boxes, it reverts to setting them all. The setting for "Allow mode setting based on days of the week? Configure with daily settings?" is global to the app, I can't turn it off just for Day and Evening, and just leave it on for night.

I guess one solution is to just have a common night time for weekdays and weeknights. Though, if the issue is as suggested by @jshimota I think it might not fix things.

So thinking about that, at the moment, Sunrise here is getting later and later. Almost every day currently, it moves later by one minute. So say the next sunrise is at 6:30. 6:30 comes around and the system then goes to set the sunrise after that at 6:31. Could the system be waking up one minute later and that's the source of the problem (or something around this idea)?