• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

MM-Watcher - MagicMirror Config.js Auto-Refresh Script

Scheduled Pinned Locked Moved System
10 Posts 3 Posters 517 Views 3 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.
  • C Offline
    chrisfr1976
    last edited by Jan 9, 2025, 8:12 PM

    Hi,

    I’m currently working on a new module. I had a lot of updates to do in my code to adjust the layout. After saving changes, I had to manually refresh the MagicMirror application every time. This process is tedious, especially if you’re frequently experimenting with configurations.

    That’s where this script comes in. By monitoring your config.js file (or a module.js file) for changes, it automates the refresh process. Now, every time I save my config.js, the Mirror refreshes itself instantly.

    It’s seamless, efficient, and saves you from the hassle of restarting the application manually.

    Perfect for developers and tinkerers alike, this script ensures your MagicMirror reflects your updates in real-time, letting you focus on creativity instead of logistics.

    https://github.com/ChrisF1976/MM-Watcher

    Give it a try…

    Regards,
    Chris.

    Regards, Chris.

    S 1 Reply Last reply Jan 9, 2025, 8:15 PM Reply Quote 1
    • S Away
      sdetweil @chrisfr1976
      last edited by sdetweil Jan 9, 2025, 8:16 PM Jan 9, 2025, 8:15 PM

      @chrisfr1976 if you used my installer script, and selected pm2, I auto configure for watching the config.js file
      BUT they changed the construct to only watch a folder… dumb

      just fyi… if the changes you are making are in css or the UI side (modulename.js)

      you don’t have to restart, just refresh the page with ctrl-r
      as those two files are reloaded on refresh

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      C 1 Reply Last reply Jan 9, 2025, 8:23 PM Reply Quote 0
      • C Offline
        chrisfr1976 @sdetweil
        last edited by chrisfr1976 Jan 9, 2025, 8:25 PM Jan 9, 2025, 8:23 PM

        @sdetweil thats why I made the module. The Pi is completely headless. So I’m in the kitchen with my laptop and enjoy this autorefresh now. Before that I’ve used a Script on my Smartphone. Also manual and annoying :-)
        And sure, also the xdotool command is just pressing “ctrl+r” for me.

        Regards, Chris.

        P 1 Reply Last reply Jan 12, 2025, 7:11 PM Reply Quote 1
        • P Offline
          plainbroke @chrisfr1976
          last edited by plainbroke Jan 12, 2025, 7:13 PM Jan 12, 2025, 7:11 PM

          @chrisfr1976

          I use a file called mm.json ,don’t remember where I got this info, but it still works great. I have it and a copy of the mm.sh in the /home/pi/ folder… the one your setup goes to when you do cd then enter.
          this is the code inside it.

              "apps":[
                  {
                      "name":"mm",
                      "script":"./mm.sh",
                      "cwd":"/home/pi",
                      "watch":[
                          "/home/pi/MagicMirror/config/config.js"
                      ],
                      "watch_options":{
                          "followSymlinks":true
                      }
                  }
              ]
          }
          

          I pm2 delete all that have to do with MagicMirror startup.
          Then do a pm2 start mm.json then pm2 save and PM2 saves it as mm.
          Now anytime I change something in config.js MagicMirror restarts.
          I wish I was smart enough with code to figure out how to get it to restart when I modify the custom.css too.

          Slow learner. But trying anyways.

          S C 3 Replies Last reply Jan 12, 2025, 7:18 PM Reply Quote 0
          • S Away
            sdetweil @plainbroke
            last edited by Jan 12, 2025, 7:18 PM

            @plainbroke great!!! i will fix my json file !!!thanks

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • C Offline
              chrisfr1976 @plainbroke
              last edited by Jan 12, 2025, 7:30 PM

              @plainbroke
              Hi,
              my mm.sh also restarts the mirror. But my intention with was doing only a refresh to save a lot of time. My restarts script sleeps 15s before it is executed. So i created a seperate refresh script.

              Regards, Chris.

              P 1 Reply Last reply Jan 12, 2025, 7:33 PM Reply Quote 0
              • P Offline
                plainbroke @chrisfr1976
                last edited by Jan 12, 2025, 7:33 PM

                @chrisfr1976
                Ok mine doesn’t wait. I usually do a list of changes I have researched.
                So the complete restart of MM is ok for me.
                Right now trying to figure out a couple of modules that are not loading…

                Slow learner. But trying anyways.

                1 Reply Last reply Reply Quote 0
                • S Away
                  sdetweil @plainbroke
                  last edited by Jan 12, 2025, 11:12 PM

                  @plainbroke interesting, my file and your have just two changes

                  1. you have the cwd: setting
                  2. you have followSymlinks (which we don’t have any of)

                  I added cwd to mine and now MM restarts… weird

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  P 1 Reply Last reply Jan 14, 2025, 2:35 AM Reply Quote 0
                  • P Offline
                    plainbroke @sdetweil
                    last edited by Jan 14, 2025, 2:35 AM

                    @sdetweil
                    Glad it works for you.
                    I have no Idea where it came from. I would guess from someone on this forum.

                    Slow learner. But trying anyways.

                    S 1 Reply Last reply Jan 14, 2025, 2:59 AM Reply Quote 0
                    • S Away
                      sdetweil @plainbroke
                      last edited by Jan 14, 2025, 2:59 AM

                      @plainbroke well, mine looks nearly identical… just missing the cwd…

                      I opened an issue about this 2 years ago, never got a response…
                      and adding cwd (current working directory)

                      I don’t know how that matters… but whatever… it works now…

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 1
                      • 1 / 1
                      1 / 1
                      • First post
                        1/10
                        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