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

modules day and time Depending represented

  • I have an idea. it’s possible to create an extension that certain modules day and time Depending represented ? On weekends MMM traffic i not need it , should instead of soccer standings appear, for example. MMM traffic should be displayed only from Monday to Friday between 5:45 to 7:30 . Soccer only from Saturday to Sunday.

  • for example maybe …

    for each Modul
    daydependig:‘1-5’ //1-5 Monday to Friday, 1-7 Monday to Sunday, 6-7 Saturday to Sunday,1 Monday, 2 Thursday …
    timedepending:‘0545-0730’ // false = fullday

    when in the config is no attr. “daydepending” and no attr. “timedepending” then use standard

  • @bjoern - a common way of scheduling activity is use cron expressions which give an enormous amount of flexibility for defining when things should happen.

    I would think this is a better way to tackle the solution rather than try to create custom scheduling logic.

    I’ve built the basis of the module which hides and shows other modules based on the config options, but will need a little time to add and test the scheduling. Give me a day or so.


  • Ok!

    i have seen that by the cron Expressions i can only set the startTime and not the EndTime. it’s right?

  • Project Sponsor Module Developer

    @bjoern you can make another cron task on the endtime

  • So, my current thinking is based around the following config

    	module: 'MMM-ModuleScheduler'
    	module: 'calendar',
    	position: 'top_left',
    	classes: 'scheduler',
    	config: {
    		// Show at 9:00 and hide at 18:00 every day from Monday through Friday
    		module_schedule: {from: '0 9 * * 1-5', to: '0 18 * * 1-5'}
    	module: 'MMM-soccer',
    	position: 'top_right',
    	classes: 'scheduler',
    	config: {
    		// Show at 9:00 on Saturday and hide at 20:00 on Sunday
    		module_schedule: {from: '0 9 * * SAT', to: '0 20 * * SUN'}

    Modules would then be shown and hidden based on the addition of a specific class classes: 'scheduler' and a module_schedule config option containing the cron expressions which control when the module should be shown (from) and hidden (to).

    How does that sound?

    p.s. here’s another useful cron resource -

  • YES! That’s gerat!

  • Moderator

    You can easily have another module (module_scheduler?) keep track of time and when require, it can call another module’s .hide() or .show() routine. And you’d want to check on the other module every so often, in case the mirror restarted and re-displayed it.

  • @bjoern - I have created an initial version of MMM-ModuleScheduler and pushed it to github -

    If you would like to test it, feel free to install it on your Mirror and report back here.

    However, please remember that this is work in progress and has not yet been fully tested, so please do use with care.

  • Project Sponsor Module Developer

    Seems to work pretty well! I did load it to test it to turn off at 7:50 and it took a while for the mirror to load but I assumed it was the cron preparing itself. The module is indeed off… it didn’t load the Holidays or News feed it just said loading…

    So I stopped the mirror and restarted it. It loaded quicker [still slow so people don’t freak out :)]… the Holiday and News Feed did indeed load …

    So the only thing NOT on the screen is the thing I attached to the scheduler… so it’s working… Only thing I can see wrong is the speed [decreased] of loading the mirror! BUT it’s not like you start and stop the mirror daily anyway so once it loads it works 🙂

    I like it!! Thank you!!!

Log in to reply