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.js in JSON format

    Scheduled Pinned Locked Moved Unsolved Feature Requests
    17 Posts 4 Posters 5.3k Views 4 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 @Guest
      last edited by

      @Sean do you have some examples of these kinds of data elements? I’d be interested to pass them thru this simple converter to see the fidelity

      Sam

      How to add modules

      learning how to use browser developers window for css changes

      ? 1 Reply Last reply Reply Quote 0
      • ? Offline
        A Former User @sdetweil
        last edited by

        @sdetweil

        1. callback function as value;
          Many of my modules use the callback functions to make user command or user-customizable dynamic features instead to modify the source itself. (eg. filter, sort, transform, …)
          Here is the the sameple of MMM-NotificationTrigger;
        {
          module: "MMM-NotificationTrigger",
          config: {
            triggers:[
              {
                trigger: "SOME_NOTIFICATION",
                fires: [
                  {
                    fire:"SHOW_ALERT",
                    payload: (payload) => {
                      return {
                        type:"notification",
                        title:"Notification comming",
                        message: payload.someOption
                      }
                    },
                  }
                ]
              },
            ]
          }
        },
        
        1. dynamic values;
          I manage several different configurations in one config.js for my convenience. like this;

        (simplified concept)

        const mode = "testA"
        const someValue = {
          "testA" : "testA",
          "testB" : "testB",
          "debug" : "debug",
          "release" : "release",
          ...
        }
        ...
        
        {
          module: "MMM-SOMEMODULE",
          config: {
            someField: ((mode == "testA") ? true : false),
            someField2: someValue[mode],
           ...
          }
        },
        

        The real usage is more complex but you can catch my approach.

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

          @Sean thanks… the 1st, with callbacks was preserved… the 2nd, with the algorithmic values, produced the results of the algorithm… the node runtime does the algorithmic replacement on load of the file… the converter would not know. (unless it processed the text)

                          {
                                  module: 'MMM-SOMEMODULE',
                                  config: {
                                          someField: true,
                                          someField2: 'testA'
                                  }
                          }
          

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • SergeS Offline
            Serge @lavolp3
            last edited by Serge

            @lavolp3
            @sdetweil
            @Sean
            here is a short video of what is done at the moment.
            https://youtu.be/6w6Uovy9hbE

            So what I have:

            1. Webserver which is based on the asws webserver. Updated version for MagicMirror is here. Changes made to cmd/asws.go file only.
              Download git

            2. build docker container from it (go to asws directory and run " docker build -t asws_new ."

            3. Clone to home/pi/www sample web-interface for MagicMirror clock module settings. It is bases on free SB Admin 2 bootstrap template.
              Git includes js/settings.js which is necessary for make everything works. Git is here: https://github.com/sergge1/www

            4. Run with a folloing command a docker container build in point 2 above: sudo docker run -d --restart unless-stopped -e DEBUG=true -p 80:80 -v $(pwd)/www:/www asws_new

            Sample config.js from video is located at www/config.js

            screenshot below:
            photo-2019-10-24-18-04-49

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

              @Serge @Sean @lavolp3 cool

              I found this the other day, maybe it will help your UI

              https://github.com/Toreke/MMM-Dynamic-Modules

              allows live dynamically positioning module content

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • 1
              • 2
              • 2 / 2
              • 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