Mode Manager not firing correctly

I have used Mode Manager for over a year, but it has suddenly started misfiring. Below is the log from today:
2022-01-03 17:12:00.124 infoNot setting mode to Evening due to wrong day (2). Current mode is Day.

Setup:
I have mode manager set to Earlier of Sunset-15 or 1800hrs for M-F. On some days it will trigger the Made change correctly, on others it does not. Today is Monday and it did trigger, but obviously from the above, it fired at the correct time but did not execute the mode change.

image

Resolution attempts so far:
I had no issues until about a month ago. i do regular updates, but i cannot identify when this started exactly. I suspect it was around the 2.3.0.112 update applied in late November.
The HE has been restarted several times since then with each update. Currently running 2.3.0.124
I deleted the original Mode Manager. I then created an identical item from scratch.

In Summary, the shift from Day to Evening mode at the proscribed time works on some days but not on others. This errant behavior is not observed at the shift from Morning to Day mode, which is always at 0900hrs M-S.

Any advice / assistance is appreciated.

Today is Tuesday and the Mode Manager trigger at Sunset -15 and processed the change. HEre is the log entry
2022-01-04 17:13:00.223 [info] Mode set to Evening from Day

THe Mode Manager triggered at the proper time and fired the mode change correctly on Wed, Thurs, and Friday.
Today, Saturday it did not behave as designed. Below is the log entry

2022-01-08 17:16:00.063 [info]Not setting mode to Evening due to wrong day (7). Current mode is Day.

I will look into this...

I am not able to get this to fail, yet. That's not a conclusive outcome, just makes it harder to pinpoint what happens:

I have a suspicion that I can't test until sunset today. You could help in one way: Open Mode Manager and hit Done. See if it works correctly today or not. If it does work, that would point the finger at it failing on subsequent days after first set up.

1 Like

I believe i have done that... probably several times in trying to debug this issue,
And on Sunday, yesterday it worked. Here is the log
2022-01-09 17:17:00.549 [info] Mode set to Evening from Day

For clarity, after i originally noticed this behaviour, i have edited and clicked Done on many occasions, and i even deleted the rule and recreated it from scratch thinking perhaps it had been corrupted in the release update.
I will post todays results of success or fail when it happens at 1717hrs.

The scheduler shows an entry for this App at the correct time. It does seem to always have a correct entry scheduled for the app to run, but the app seems to fail on the logic.
[Mode Manager Day] () false timeHandlerNew 2022-01-10 17:18:00 EST

Thanks for looking into this.

I have caught it in the act of failing! What it's doing is failing to schedule both events. It has to reschedule every day, since sunset changes every day. Now that I've seen it fail, I can track it down and fix it.

3 Likes

Maybe this will help. Mine seems to schedule both, but the app's logic is not processing correctly. Here are the logs for Mode Manager for the past several days.

2022-01-09 18:00:00.050 info Not setting mode to Evening due to wrong day (1). Current mode is Evening.
2022-01-09 17:17:00.549 info Mode set to Evening from Day
2022-01-09 09:00:00.090 info Mode set to Day from Morning
2022-01-09 05:30:00.069 info Not setting mode to Morning due to wrong day (1). Current mode is Night.
2022-01-08 18:00:00.066 info Not setting mode to Evening due to wrong day (7). Current mode is Evening.
2022-01-08 17:16:00.063 info Not setting mode to Evening due to wrong day (7). Current mode is Day.
2022-01-08 09:00:00.155 info Mode set to Day from Morning
2022-01-08 07:00:00.211 info Mode set to Morning from Night
2022-01-08 05:30:00.101 info Not setting mode to Morning due to wrong day (7). Current mode is Night.
2022-01-07 18:30:00.063 info Not setting mode to Evening due to wrong day (6). Current mode is Evening.
2022-01-07 17:15:00.232 info Mode set to Evening from Day

On the 7th it ran at sunset -15 and changed the mode to evening as designed. It also ran at the alternate time of 1830 as defined in the logic for Sa Sun. But the 7th was a Friday and by the logic should have scheduled run at 1800
On the 8th it ran at sunset -15, failed (i manually set to evening mode), and then ran again at 1800. But the 8th was Saturday and should have scheduled at 1830.
On the 9th is ran at sunset -15 and worked as designed. However the second time fired at 1800 instead of 1830. The 9th was a Sunday.
Also on the 9th the scheduled job was for morning at 0530 instead of 0700 for the Sa and Sunday, but on the 8th it fired the schedule at the correct time of 0700 for saturday.

It is almost as if the day of the week index is off. Should these be Monday = 1 and Sunday =7?

Thanks

Here is a SS of the Scheduled Jobs logs for today. It shows the sunset -a5 twice and both the 1800 and the 1830hrs triggers for MTWThF and SaSu

Mode Manager triggered at the proper time today (Monday) and changed the mode correctly per design. It triggered twice which would correlate to the previous post listing of the schedule entries.

2022-01-10 17:18:00.152 info Mode set to Evening from Day
2022-01-10 17:18:00.066 info Not setting mode to Evening due to wrong day (2). Current mode is Day.

SO if i am understanding this, it is creating a schedule entry for both M-F and the Sa-Su entries in the logic. I should expect to see the failure for the entry for the incorrect day of the week and an execution for the correct day of the week.

This issue has been worked, and resolved for the next release. Logging has been enhanced also, to give a clearer indication of what Mode Manager is doing.

6 Likes

Great. I will look forward to updating and testing. Thank you.

I believe the previous issue with firing the scheduler at sunset has been resolved in the latest release.
However, now the Mode Manager is not working in the morning. Morning mode schedule is the same as the listing in the original post (above).
It looks like the sunrise was scheduled but seems to think it is the wrong day. Therefor does not execute the mode change. Here is the log from this morning (saturday May 7).

2022-05-07 07:00:00.157 [info]Not setting mode to Morning, earlier of two times already happened

2022-05-07 06:29:00.175 [info]Not setting mode to Morning due to wrong day (Saturday). Current mode is Night.

2022-05-07 06:29:00.156 [info]Not setting mode to Morning due to wrong day (Saturday). Current mode is Night.

2022-05-07 05:30:00.287 [info]Not setting mode to Morning due to wrong day (Saturday). Current mode is Night.

Please take a screenshot of the Settings portion of the App Status page (gear icon) and post it here.

Has this worked in the past on Saturday? Is this a new failure?

Settings
Name Type Value
atSunsetOffset21Evening number -30
atSunsetOffset22Evening number -30
atTime11Day time 09:00
atTime11Evening time 18:00
atTime11Night time 01:30
atTime12Evening time 18:30
atTime21Morning time 05:30
atTime22Morning time 07:00
daily bool true
days1Day enum ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
days1Evening enum ["Monday","Tuesday","Wednesday","Thursday","Friday"]
days1Morning enum ["Monday","Tuesday","Wednesday","Thursday","Friday"]
days1Movie enum ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
days1Night enum ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
days2Evening enum ["Sunday","Saturday"]
days2Morning enum ["Sunday","Saturday"]
ignoreModes enum ["Away","Movie"]
logging bool true
returnSensors capability.presenceSensor [K Phone], [J Phone]
time11Day enum A specific time
time11Evening enum A specific time
time11Morning enum Sunrise
time11Night enum A specific time
time12Evening enum A specific time
time12Morning enum Sunrise
time21Evening enum Sunset
time21Morning enum A specific time
time22Evening enum Sunset
time22Morning enum A specific time
type1Day enum Certain time
type1Evening enum Earlier of two times
type1Morning enum Earlier of two times
type1Movie enum Certain time
type1Night enum Certain time
type2Evening enum Earlier of two times
type2Morning enum Earlier of two times
useTimes bool false
Event Subscriptions
Source Event Handler Filter
Home (Location) sunsetTime beforeSunsetHandlerNew false
Home (Location) sunrise sunriseHandlerNew false
Home (Location) mode modeHandler false
Application State
Name Value
shadowMode Day
str Day: at 09:00 on Sun, Mon, Tue, Wed, Thu, Fri, Sat Evening: Earlier of two times, 18:00 or Sunset -30 minutes on Mon, Tue, Wed, Thu, Fri Evening: Earlier of two times, 18:30 or Sunset -30 minutes on Sun, Sat Morning: Earlier of two times, Sunrise or 05:30 on Mon, Tue, Wed, Thu, Fri Morning: Earlier of two times, Sunrise or 07:00 on Sun, Sat Night: at 01:30 on Sun, Mon, Tue, Wed, Thu, Fri, Sat Modes to ignore time changes: Away, Movie
strP
strS
timeVarUpdate true
updated true
updateIgnore true
Scheduled Jobs
Handler Next Run Time Prev Run Time Status Schedule
timeHandlerNew 2022-05-07 18:30:00 EDT 2022-05-06 18:30:00 EDT PENDING 0 30 18 * * ?
timeHandlerNew 2022-05-07 19:43:00 EDT PENDING Once
timeHandlerNew 2022-05-08 05:30:00 EDT 2022-05-07 05:30:00 EDT PENDING 0 30 5 * * ?
timeHandlerNew 2022-05-07 19:43:00 EDT PENDING Once
timeHandlerNew 2022-05-08 01:30:00 EDT 2022-05-07 01:30:00 EDT PENDING 0 30 1 * * ?
timeHandlerNew 2022-05-08 07:00:00 EDT 2022-05-07 07:00:00 EDT PENDING 0 0 7 * * ?
timeHandlerNew 2022-05-07 18:00:00 EDT 2022-05-06 18:00:00 EDT PENDING 0 0 18 * * ?
timeHandlerNew 2022-05-08 09:00:00 EDT 2022-05-07 09:00:00 EDT PENDING 0 0 9 * * ?

The publish schedule in the original post has been in place since 2020. THe new failure on the sunrise on weekends started recently, perhaps several weeks ago. I am not positive when it failed as we typically wakeup before sunrise / 7am trigger and morning mode is triggered manually.
So in summary i am not positive when it began to fail, but i first noticed in the last three weeks.

Please see the private message I just sent to you.

Hi guys,

Am I the only one having problems with Modes???

Yesterday I noticed that some devices started acting weird, without a logical reason, and afer a while I detected that MODE changes is not working.

I´ve gone through all options on MODE MANAGER, but couldn´t notice anything wrong, besides the fact that I havent touched anything on that APP.

Any comments from the Hubitat Team?

Thanks.

Note: I´m on 2.3.2.125, Mode Manager Version 1.1.6 (5/22/2022)
Note 2: This is a copy of another message posted

For the past couple days, my mode manager is not working correctly, either. Specifically, I set the mode to "Day" at sunrise, and after sunrise it has still been set to "Night" mode.

This corresponds with update to v2.3.2.125