ianperrin / MMM-ModuleScheduler

A MagicMirror helper module to schedule the display of modules and sending of notifications.
MIT License
99 stars 13 forks source link

Multipe schedule #36

Closed Selyjohns closed 6 months ago

Selyjohns commented 2 years ago

Hello,

is it possible to have multiple schedule with the same class name, and apply it to one module ?

what is the best practice do to that ?

thank you

ianperrin commented 2 years ago

Hi @josselynL

Multiple schedules can be configured using an array - check out the docs for some examples.

Schedules can also be configured to be triggered multiple times using cron expressions. For example at 8am and 6pm each day etc

Selyjohns commented 2 years ago

Hi @josselynL

Multiple schedules can be configured using an array - check out the docs for some examples.

Schedules can also be configured to be triggered multiple times using cron expressions. For example at 8am and 6pm each day etc

Hello,

Thank you for your reply ! Yes I know, but for 1 module, I need 3 different schedule.

Can I set 3 global_schedule with the same GroupClass name, and affect it to the module ?

ianperrin commented 2 years ago

Can you share more details about what you are trying to achieve?

On 14 Apr 2022, at 08:41, josselynL @.***> wrote:

 Hi @josselynL

Multiple schedules can be configured using an array - check out the docs for some examples.

Schedules can also be configured to be triggered multiple times using cron expressions. For example at 8am and 6pm each day etc

Hello,

Thank you for your reply ! Yes I know, but for 1 module, I need 3 different schedule.

Can I set 3 global_schedule with the same ClassName, and affect it to the module ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Selyjohns commented 2 years ago

Can you share more details about what you are trying to achieve? On 14 Apr 2022, at 08:41, josselynL @.***> wrote:  Hi @josselynL Multiple schedules can be configured using an array - check out the docs for some examples. Schedules can also be configured to be triggered multiple times using cron expressions. For example at 8am and 6pm each day etc Hello, Thank you for your reply ! Yes I know, but for 1 module, I need 3 different schedule. Can I set 3 global_schedule with the same ClassName, and affect it to the module ? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.

Sure !

I want to use Global Schedules instead of Individual Module Schedules

For some module, I want 2 schedules (morning 6:00 to 09:00 and evening 18:00 to 21:00) So, what is the best practice to do ?

1/Define 2 groupClass and affect both to the modules

        module: 'MMM-ModuleScheduler',
        config: {
            global_schedule: [
                global_schedule: {from: '0 6 * * *', to: '0 9 * * *', groupClass: 'morning'},
                global_schedule: {from: '0 18 * * *', to: '0 21 * * *', groupClass: 'evening'},
            ]
        }
    },
    {
        module: 'clock',
        position: 'top_left',
        classes: 'morning',
        classes:'evening'
    }

2/Define multiples global_schedules with the same groupClass name, and affect it to the module

        module: 'MMM-ModuleScheduler',
        config: {
            global_schedule: [
                global_schedule: {from: '0 6 * * *', to: '0 9 * * *', groupClass: 'morning_and_evening'},
                global_schedule: {from: '0 18 * * *', to: '0 21 * * *', groupClass: 'morning_and_evening'},
            ]
        }
    },
    {
        module: 'clock',
        position: 'top_left',
        classes: 'morning_and_evening',
    }

Sorry if it's not clear. I just want to have a global configuration for morning and evening, and apply it to several module, and I don't know what is the best practice. For the moment, each module have indivual schedule on the module configuration directly, and it's not clean.

Thank you.