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: need help

    Scheduled Pinned Locked Moved Showcase
    13 Posts 2 Posters 307 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.
    • S Offline
      sdetweil @anagallis
      last edited by sdetweil

      @anagallis if the schedules are the same every day, the easiest way would be the global schedule

      Use the crontab tool to create a schedule line from:to for each time period, and add a string for the global_scheduler classname.

      Then on the picture module add a property

      classes:"???? ?????"
      

      Where ??? Is the classname you specified in the schedule definition.

      These classnames are just arbitrary strings, for example

      Morning_scheduler, afternoon_schedule
      The classes property takes a list of space separated strings

      If the schedules are different on different days,
      Make a pair for each day, using the same schedule names for all the days

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        anagallis @sdetweil
        last edited by

        Many thanks @sdetweil ,

        Here is what I done, and MM only displays pictures from the first MMM-RandomPhoto, the class ‘lundimatin’ and we’re mondy afternoon, not morning…

        	modules: [
                {
                    module: 'MMM-ModuleScheduler',
                    config: {
                        // SHOW MODULES WITH THE CLASS '*********' AT **:00 AND HIDE AT **:00 EVERY DAY
                        notification_schedule: [
                        // SHOW AN ALERT toutes les minutes impairs
                        {notification: 'SHOW_ALERT', schedule: '1-59/2 * * * *', payload: {type: "notification", title: 'Impaire !'}},
                        // SHOW AN ALERT toutes les minutes pairs
                        {notification: 'SHOW_ALERT', schedule: '*/2 * * * *', payload: {type: "notification", title: 'Paire !'}},
                        // SHOW MODULES WITH THE CLASS 'lundimatin' AT 09:00 AND HIDE AT 13:00 EVERY LUNDI
                        {from: '0 9 * * *', to: '0 13 * * 1', groupClass: 'lundimatin'},
                        // SHOW MODULES WITH THE CLASS 'lundiaprem' AT 14:00 AND HIDE AT 17:00 EVERY LUNDI
                        {from: '0 14 * * *', to: '0 17 * * 1', groupClass: 'lundiaprem'},
                        // SHOW MODULES WITH THE CLASS 'mardimatin' AT 09:00 AND HIDE AT 13:00 EVERY MARDI
                        {from: '0 9 * * *', to: '0 13 * * 2', groupClass: 'mardimatin'},
                        // SHOW MODULES WITH THE CLASS 'mardiaprem' AT 14:00 AND HIDE AT 17:00 EVERY MARDI
                        {from: '0 14 * * *', to: '0 17 * * 2', groupClass: 'mardiaprem'},
                    ]                
                    }
                },
                {
                    module: 'MMM-RandomPhoto',
                    position: 'fullscreen_below',
                    classes: 'lundimatin',
                    config: {
                        imageRepository: "localdirectory",
                        repositoryConfig: {
                            path: "/home/pi/MagicMirror/modules/Images/lundimatin/",
                            recursive: true,
                            exclude: ["tmp", "#recycle"],
                        },
                        updateInterval: 5,
                        opacity: "0.9",
                    }
                },
                {
                    module: 'MMM-RandomPhoto',
                    position: 'fullscreen_below',
                    classes: 'lundiaprem',
                    config: {
                        imageRepository: "localdirectory",
                        repositoryConfig: {
                            path: "/home/pi/MagicMirror/modules/Images/lundiaprem/",
                            recursive: true,
                            exclude: ["tmp", "#recycle"],
                        },
                        updateInterval: 5,
                        opacity: "0.9",
                    }
                },
        

        Do you see where is my problem, please?

        S 2 Replies Last reply Reply Quote 0
        • S Offline
          sdetweil @anagallis
          last edited by

          @anagallis the MMM-RandomPhoto module doesn’t support multiple instances
          the html ID and Classes are hard coded

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @anagallis
            last edited by sdetweil

            @anagallis delete the MMM-RandomPhoto folder

            cd modules
            rm -rf MMM-RandomPhoto
            

            and git clone my repo

            cd modules
            git clone https://github.com/sdetweil/MMM-RandomPhoto
            

            this supports multiple instances
            restart MagicMirror

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            A 1 Reply Last reply Reply Quote 0
            • A Offline
              anagallis @sdetweil
              last edited by

              @sdetweil aaaah ok, it’s not multiple instances! I understand the problem now.

              The second version you give of the Random-Photo module can’t display local images, it’s only for images via the net. But thank you.

              l have to find a new image module, witch can be multiple instances and with picture in local directories.

              S 2 Replies Last reply Reply Quote 0
              • S Offline
                sdetweil @anagallis
                last edited by sdetweil

                @anagallis ah, I see. I found the original. Not the other fork. Same problem

                Working on it

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @anagallis
                  last edited by sdetweil

                  @anagallis I have redone my fork of the MMM-RandomPhoto module using the correct source, to support multiple instances.

                  to test this do

                  cd ~/MagicMirror/modules
                  rm -rf MMM-RandomPhoto
                  git clone https://github.com/sdetweil/MMM-RandomPhoto.git
                  cd MMM-RandomPhoto
                  git checkout multi-instance
                  npm install
                  

                  see the readme for the doc on how to use the new id property to create multiple instances and what you MUST do for css to support each instance… easy, but required.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  A 1 Reply Last reply Reply Quote 0
                  • A Offline
                    anagallis @sdetweil
                    last edited by

                    Waowww! You did a fork for us, marvelous!
                    Many thanks @sdetweil

                    I’ll test it, and i’ll say you later if if works here.

                    A 1 Reply Last reply Reply Quote 0
                    • A Offline
                      anagallis @anagallis
                      last edited by

                      It’s great!
                      But I have a problem with the css.
                      css is applied only if I set the id=“_”, and if I have only one id with this value.

                      When I replace

                      id='L2_'
                      

                      by

                      id='_'
                      

                      See bellow if I done a mistake.

                      here is my custom.css:

                      #L1_randomPhoto, #L2_randomPhoto, #Ma1_randomPhoto, #Ma2_randomPhoto, #Me1_randomPhoto, #Me2_randomPhoto, #J1_randomPhoto, #J2_randomPhoto, #V1_randomPhoto, #V2_randomPhoto img {
                          opacity: 0;
                          position: absolute;
                          top: 0;
                          left: 0;
                          height: 100%;
                          width: 100%;
                          object-fit: cover;
                      }
                      
                      #L1_randomPhoto, #L2_randomPhoto, #Ma1_randomPhoto, #Ma2_randomPhoto, #Me1_randomPhoto, #Me2_randomPhoto, #J1_randomPhoto, #J2_randomPhoto, #V1_randomPhoto, #V2_randomPhoto img.grayscale {
                          filter: grayscale(100%);
                      }
                      ....etc
                      

                      .
                      and a part of the config.json :

                      	modules: [
                              {
                                  module: 'MMM-ModuleScheduler',
                                  config: {
                                      // SHOW MODULES WITH THE CLASS 'lundimatin' AT 09:00 AND HIDE AT 13:00 EVERY LUNDI
                                      //global_schedule: {from: '0 9 * * *', to: '0 13 * * *', groupClass: 'lundimatin'},
                                      // SHOW MODULES WITH THE CLASS 'lundiaprem' AT 14:00 AND HIDE AT 17:00 EVERY LUNDI
                                      //global_schedule: {from: '0 9 * * *', to: '0 17 * * *', groupClass: 'lundiaprem'},         
                                  }
                              },
                              {
                                  module: 'MMM-RandomPhoto',
                                  position: 'fullscreen_below',
                              	classes: 'scheduler',
                                  config: {
                      				module_schedule: {from: '0 9 * * 1', to: '0 13 * * 1' },
                                      imageRepository: "localdirectory",
                                      repositoryConfig: {
                                          path: "/home/pi/MagicMirror/modules/Images/lundimatin/",
                                          recursive: true,
                                          exclude: ["tmp", "#recycle"],
                                      },
                                      updateInterval: 5,
                                      opacity: "1",
                                      id: 'L1_',
                                  }
                              },
                              {
                                  module: 'MMM-RandomPhoto',
                                  position: 'fullscreen_below',
                              	classes: 'scheduler',
                                  config: {
                      				module_schedule: {from: '0 13 * * 1', to: '0 17 * * 1' },
                                      imageRepository: "localdirectory",
                                      repositoryConfig: {
                                          path: "/home/pi/MagicMirror/modules/Images/lundiaprem/",
                                          recursive: true,
                                          exclude: ["tmp", "#recycle"],
                                      },
                                      updateInterval: 5,
                                      opacity: "1",
                                      id: 'L2_',
                                  }
                              },
                      
                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @anagallis
                        last edited by sdetweil

                        @anagallis said:

                        note you missed one _ (my fault in instructions) there is a root {} section that contains one too

                        :root {
                            --_randomPhoto-blur-value: 0px;
                        }
                        

                        #L1_randomPhoto, #L2_randomPhoto, #Ma1_randomPhoto, #Ma2_randomPhoto,

                        if you are going to use comma, then you need to replicate the actual tag too (I think)

                        #L1_randomPhoto img, #L2_randomPhoto img, #Ma1_randomPhoto img, #Ma2_randomPhoto img ,........
                        

                        note the id can be anything, you were using a string for the global schedule classname, you could use the same string

                        here is what I did and verified it worked (without using commas)
                        config

                        {
                                module: 'MMM-RandomPhoto',
                                position: 'fullscreen_below',
                                config: {
                                        opacity: 0.3,
                                        animationSpeed: 500,
                                        updateInterval: 60,
                                        imageRepository:'localdirectory',
                                        id:"foo",
                                        repositoryConfig :{
                                                path: '/Users/sam/Pictures'
                                        }
                                }
                        },      
                        {       
                                module: 'MMM-RandomPhoto',
                                position: 'fullscreen_below',
                                config: {
                                        opacity: 0.3,
                                        animationSpeed: 500,
                                        updateInterval: 60,
                                        imageRepository:'localdirectory',
                                        id:"fribble",
                                        repositoryConfig :{
                                                path: '/Users/sam/Pics'
                                        }
                                }       
                        },
                        

                        custom.css

                        :root {
                            --foorandomPhoto-blur-value: 0px;
                        }
                        
                        #foorandomPhoto img {
                            opacity: 0;
                            position: absolute;;
                            top: 0;
                            left: 0;
                            height: 100%;
                            width: 100%;
                            object-fit: cover;
                        }
                        
                        #fooArandomPhoto img.grayscale {
                            filter: grayscale(100%);
                        }
                        
                        #foorandomPhoto img.blur {
                            filter: blur(var(--randomphoto-blur-value));
                        }
                        
                        #foorandomPhotoIcon {
                            position: absolute;
                        }
                        
                        #foorandomPhotoIcon.rpitop {
                            top: 5px;
                        }
                        
                        #foorandomPhotoIcon.rpibottom {
                            bottom: 5px;
                        }
                        
                        #foorandomPhotoIcon.rpiright {
                            right: 10px;
                        }
                        
                        #foorandomPhotoIcon.rpileft {
                            left: 10px;
                        }
                        
                        #foorandomPhotoIcon i {
                            opacity: 1;
                        }
                        
                        #foorandomPhotoIcon i.rpihidden {
                            opacity: 0;
                        }
                        :root {
                            --_=fribblerandomPhoto-blur-value: 0px;
                        }
                        
                        #fribblerandomPhoto img {
                            opacity: 0;
                            position: absolute;;
                            top: 0;
                            left: 0;
                            height: 100%;
                            width: 100%;
                            object-fit: cover;
                        }
                        
                        #fribblerandomPhoto img.grayscale {
                            filter: grayscale(100%);
                        }
                        
                        #fribblerandomPhoto img.blur {
                            filter: blur(var(--randomphoto-blur-value));
                        }
                        
                        #fribblerandomPhotoIcon {
                            position: absolute;
                        }
                        
                        #fribblerandomPhotoIcon.rpitop {
                            top: 5px;
                        }
                        
                        #fribblerandomPhotoIcon.rpibottom {
                            bottom: 5px;
                        }
                        
                        #fribblerandomPhotoIcon.rpiright {
                            right: 10px;
                        }
                        
                        #fribblerandomPhotoIcon.rpileft {
                            left: 10px;
                        }
                        
                        #fribblerandomPhotoIcon i {
                            opacity: 1;
                        }
                        
                        #fribblerandomPhotoIcon i.rpihidden {
                            opacity: 0;
                        }
                        

                        I updated the module README.md to document the change needed there too

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        A 1 Reply Last reply Reply Quote 1
                        • A Offline
                          anagallis @sdetweil
                          last edited by

                          @sdetweil
                          I found my mistake!
                          I have copy the custom.css in the path /home/pi/MagicMirror/css and it works great!

                          You’ve just helped me make the schedule accessible to a group of people with disabilities who can’t read. I’m going to show them their half-day schedule using pictures.

                          It’s great that you took the time to help us—thanks again!

                          S 1 Reply Last reply Reply Quote 1
                          • S Offline
                            sdetweil @anagallis
                            last edited by

                            @anagallis yes, custom.css is in the MagicMirror/css folder

                            next release (April 1 it will move to the config folder (user files will all be in one place)

                            Sam

                            How to add modules

                            learning how to use browser developers window for css changes

                            1 Reply Last reply Reply Quote 1

                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                            With your input, this post could be even better 💗

                            Register Login
                            • 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