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.

    Config modules from external file (JSON)

    Scheduled Pinned Locked Moved Troubleshooting
    config modulesjsonfile
    14 Posts 3 Posters 5.5k 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.
    • telminiT Offline
      telmini
      last edited by

      So, it can detect that the json file has the “currentweather” module, but then fails to load it properly.

      Any help?

      S 1 Reply Last reply Reply Quote 0
      • S Do not disturb
        sdetweil @telmini
        last edited by

        @telmini u have a bad path

        /js/ /modules
        

        note modules is off the mm root just like js

        /modules/modulename
        /js/mm_core_filename.js
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • telminiT Offline
          telmini
          last edited by

          @telmini said in Config modules from external file (JSON):

          loadJSON(“./modules.json”)

          But that bug/crash is inside Magic Mirror code. Or is related to the path defined here “loadJSON(”./modules.json")"?

          S 1 Reply Last reply Reply Quote 0
          • S Do not disturb
            sdetweil @telmini
            last edited by

            @telmini i do not know, screen is hard to read. got enoent file not found. path is wrong.

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • telminiT Offline
              telmini
              last edited by

              Sorry, this is the output.

              > magicmirror@2.11.0 start /home/pi/MagicMirror
              > DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js
              
              [2021-01-27 16:55:09.858] [LOG]    Starting MagicMirror: v2.11.0
              [2021-01-27 16:55:09.878] [LOG]    Loading config ...
              [2021-01-27 16:55:09.892] [LOG]    Loading module helpers ...
              [2021-01-27 16:55:09.896] [LOG]    Error: ENOENT: no such file or directory, access '/home/pi/MagicMirror/js/../modules/default/currentweather/node_helper.js'
                  at Object.accessSync (fs.js:202:3)
                  at Object.fs.accessSync (electron/js2c/asar.js:491:38)
                  at Object.fs.accessSync (electron/js2c/asar.js:491:38)
                  at loadModule (/home/pi/MagicMirror/js/app.js:124:7)
                  at loadNextModule (/home/pi/MagicMirror/js/app.js:166:5)
                  at loadModules (/home/pi/MagicMirror/js/app.js:177:3)
                  at /home/pi/MagicMirror/js/app.js:223:4
                  at loadConfig (/home/pi/MagicMirror/js/app.js:72:4)
                  at App.start (/home/pi/MagicMirror/js/app.js:211:3)
                  at Object.<anonymous> (/home/pi/MagicMirror/js/electron.js:115:7) {
                errno: -2,
                syscall: 'access',
                code: 'ENOENT',
                path: '/home/pi/MagicMirror/js/../modules/default/currentweather/node_helper.js'
              }
              [2021-01-27 16:55:09.924] [LOG]    No helper found for module: currentweather.
              [2021-01-27 16:55:09.926] [LOG]    All module helpers loaded.
              [2021-01-27 16:55:10.246] [LOG]    Starting server on port 8080 ... 
              [2021-01-27 16:55:10.256] [INFO]   You're using a full whitelist configuration to allow for all IPs
              [2021-01-27 16:55:10.268] [LOG]    Server started ...
              [2021-01-27 16:55:10.268] [LOG]    Sockets connected & modules started ...
              [2021-01-27 16:55:10.428] [LOG]    Launching application.
              ^[$
              
              

              I don’t understand why it’s trying to go to this path

              Error: ENOENT: no such file or directory, access’/home/pi/MagicMirror/js/…/modules/default/currentweather/node_helper.js’

              S 2 Replies Last reply Reply Quote 0
              • S Do not disturb
                sdetweil @telmini
                last edited by

                @telmini because its looking for the (optional) node_helper.js of a module.
                this one, currentweather doesnt use one

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • S Do not disturb
                  sdetweil @telmini
                  last edited by

                  @telmini so the returncode is right but its not fatal in mm view.

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  1 Reply Last reply Reply Quote 0
                  • telminiT Offline
                    telmini
                    last edited by

                    It could probably be that the XmlHttpRequest is async and the page is already loaded when the request has finished executing.

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      tatianobusatto
                      last edited by

                      Hi, I’m trying something similar. Have you managed to solve your issue using this fuction loadJSON? If not, did you find any solution to update config.js “dinamicaly”?

                      S 1 Reply Last reply Reply Quote 0
                      • S Do not disturb
                        sdetweil @tatianobusatto
                        last edited by

                        @tatianobusatto others have written js/python code that takes their settings ( file, database, web service) and applied to a model config.js. (all their modules with fake strings for keys, etc)
                        and call that js/python just before launching mm

                        in installers/mm.sh

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        T 1 Reply Last reply Reply Quote 0
                        • T Offline
                          tatianobusatto @sdetweil
                          last edited by

                          @sdetweil thanks for the tip. Unfortunately, I couldn’t find a good js/python script example for that. For a while, I ended up creating a simple batch script to append multiple json config files for each module in between the config header and footer. In case you remember a place were I can find a thread for that discussion, please let me know.

                          1 Reply Last reply Reply Quote 0

                          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