MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-ModuleScheduler Loading Wrong Date

    Scheduled Pinned Locked Moved Troubleshooting
    mmm-modulescheduler
    4 Posts 3 Posters 449 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pattanner92
      last edited by pattanner92

      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.

      1 Reply Last reply Reply Quote 0
      • P Offline
        pattanner92
        last edited by

        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.

        SnilleS 1 Reply Last reply Reply Quote 0
        • SnilleS Offline
          Snille Module Developer @pattanner92
          last edited by Snille

          @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. :)

          If you cant find it, make it and share it!
          Modules: MMM-homeassistant-sensors, MMM-Modulebar, MMM-Profilepicture, MMM-Videoplayer

          I 1 Reply Last reply Reply Quote 2
          • I Offline
            ianperrin @Snille
            last edited by

            @snille - you’re spot on. MMM-ModuleScheduler uses the cron module. The ranges for cron values can be found in the npm module documentation.

            I’ve added an issue in the GitHub repository to update the documentation for the module.

            "Live as if you were to die tomorrow. Learn as if you were to live forever." - Mahatma Gandhi

            1 Reply Last reply Reply Quote 2
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy