MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

MMM-ModuleScheduler Loading Wrong Date



  • This is a bit of an odd one. I have several modules scheduled for various things, one of those being MMM-Snow to display various seasonal “snows”.

    I added a fall one today and could not, for the life of me, get the snow to show when I added the module_schedule:{from:"* * * * *", to:"* * * * *"}, line. It would work if I commented that out, or removed the line classes: "scheduler",. So I went to the logs and found something weird.

    Here is how it is actually written in the config:

    {
    module: "MMM-Snow",
    position: "fullscreen_above",
    classes: "scheduler",
    config: {
            module_schedule: {from: "0 0 25 10 *", to: "0 0 29 11 *"},
            theme: "fall"
            }
    },
    

    This is what the pm2 logs say when I reload the mirror:
    The “grab the schedules” bit:

    1|mm  | [2020-11-10 11:58:44.045] [LOG]    MMM-ModuleScheduler has completed the show job for module_7_MMM-Snow based on "0 0 25 10 *"
    1|mm  | [2020-11-10 11:58:44.046] [LOG]    MMM-ModuleScheduler has completed the hide job for module_7_MMM-Snow based on "0 0 29 11 *"
    

    The “I’m scheduling now” bit:

    [2020-11-10 11:49:49.572] [LOG]    
    1|mm  | [2020-11-10 11:49:49.572] [LOG]    
    1|mm  | MMM-ModuleScheduler has scheduled MMM-Snow
    1|mm  | [2020-11-10 11:49:49.573] [LOG]    
    1|mm  | MMM-ModuleScheduler will next show MMM-Snow at Wed Nov 25 2020 00:00:00 GMT-0500 (Eastern Standard Time)
    1|mm  | [2020-11-10 11:49:49.574] [LOG]    MMM-ModuleScheduler will next hide MMM-Snow at Tue Dec 29 2020 00:00:00 GMT-0500 (Eastern Standard Time)
    

    Not sure why the timestamp and log text are separated, but I can’t control that. You can see that the time I specify vs. the time it will be scheduled are exactly one month late. This happens for every module, EXCEPT those scheduled in December. I have several modules the appear and disappear based on time alone, and those all work as scheduled. It seems only the month variable is off kilt. Any thoughts?

    P.S. There are no errors pertaining to MMM-ModuleScheduler being thrown.



  • In case anyone else seems to struggle with this weird issue, I have found that if you use the “non-standard” approach of using the month name rather than number, it works.

    Here is what I mean. This is my config for all my “MMM-Snow” module iterations:

    {
    module: "MMM-Snow",
    position: "fullscreen_above",
    classes: "scheduler",
    config: {
                  module_schedule: {from: "0 0 1 DEC *", to: "59 11 31 DEC *"},
                  theme: "winter"
                  }
    },
    {
    module: "MMM-Snow",
    position: "fullscreen_above",
    classes: "scheduler",
    config: {
                  module_schedule: {from: "0 0 14 FEB *", to: "0 0 15 FEB *" },
                  theme: "love"
                   }
    },
    {
    module: "MMM-Snow",
    position: "fullscreen_above",
    classes: "scheduler",
    config: {
                  module_schedule: {from: "0 0 12 DEC *", to: "0 0 27 DEC *"},
                  theme: "xmas"
                  }
    },
    {
    module: "MMM-Snow",
    position: "fullscreen_above",
    classes: "scheduler",
    config: {
                 module_schedule: {from: "0 0 17 MAR *", to: " 0 0 18 MAR *"},
                 theme: "stpattys"
                 }
    },
    {
    module: "MMM-Snow",
    position: "fullscreen_above",
    classes: "scheduler",
    config: {
                  module_schedule: {from: "0 0 25 OCT *", to: "0 0 1 DEC *"},
                  theme: "fall"
                  }
    },
    

    Here is my log output (only a selection, that’s been chopped up) on reload:

    ...
    
    MMM-ModuleScheduler is removing all scheduled jobs
    MMM-ModuleScheduler has completed the send job for REMOTE_ACTION based on "30 7 * * 1-5"
    MMM-ModuleScheduler has completed the send job for REMOTE_ACTION based on "0 17 * * 1-5"
    MMM-ModuleScheduler has completed the send job for REMOTE_ACTION based on "0 4 8,18,28 * *"
    MMM-ModuleScheduler has completed the show job for module_3_MMM-Snow based on "0 0 1 DEC *"
    MMM-ModuleScheduler has completed the hide job for module_3_MMM-Snow based on "59 11 31 DEC *"
    MMM-ModuleScheduler has completed the show job for module_4_MMM-Snow based on "0 0 14 FEB *"
    MMM-ModuleScheduler has completed the hide job for module_4_MMM-Snow based on "0 0 15 FEB *"
    MMM-ModuleScheduler has completed the show job for module_5_MMM-Snow based on "0 0 12 DEC *"
    MMM-ModuleScheduler has completed the hide job for module_5_MMM-Snow based on "0 0 27 DEC *"
    MMM-ModuleScheduler has completed the show job for module_6_MMM-Snow based on "0 0 17 MAR *"
    MMM-ModuleScheduler has completed the hide job for module_6_MMM-Snow based on " 0 0 18 MAR *"
    MMM-ModuleScheduler has completed the show job for module_7_MMM-Snow based on "0 0 25 OCT *"
    MMM-ModuleScheduler has completed the hide job for module_7_MMM-Snow based on "0 0 1 DEC *"
    
    ...
    
    MMM-ModuleScheduler received CREATE_MODULE_SCHEDULE
    MMM-ModuleScheduler is scheduling MMM-Snow using "0 0 17 MAR *" and " 0 0 18 MAR *" with dim level undefined    
    MMM-ModuleScheduler is hiding MMM-Snow
    MMM-ModuleScheduler has scheduled MMM-Snow
    MMM-ModuleScheduler will next show MMM-Snow at Wed Mar 17 2021 00:00:00 GMT-0400 (Eastern Daylight Time)
    MMM-ModuleScheduler will next hide MMM-Snow at Thu Mar 18 2021 00:00:00 GMT-0400 (Eastern Daylight Time)
    MMM-ModuleScheduler received CREATE_MODULE_SCHEDULE
    MMM-ModuleScheduler is scheduling MMM-Snow using "0 0 25 OCT *" and "0 0 1 DEC *" with dim level undefined
    MMM-ModuleScheduler has scheduled MMM-Snow
    MMM-ModuleScheduler will next show MMM-Snow at Mon Oct 25 2021 00:00:00 GMT-0400 (Eastern Daylight Time)
    MMM-ModuleScheduler will next hide MMM-Snow at Tue Dec 01 2020 00:00:00 GMT-0500 (Eastern Standard Time)
    
    ...
    
    

    I guess this is the way to fix this issue? I always thought that using “MAR” over “3” was considered bad, but maybe it’s the new standard and should be done? Either way, my “fall” snow is now displaying properly. Hope this helps some.

    If someone knows why the standard Crontab is bumping up a month, and knows a solution, please feel free to add it here. I feel like this is an odd issue to have.


  • Module Developer

    @pattanner92 I noticed the same with the scheduler, normally cron has MAR as 3 but for some reson the scheduler does not. The month are from 0-11. 🙂


Log in to reply