• 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.

mergeConfig() function

Scheduled Pinned Locked Moved Development
11 Posts 2 Posters 1.7k 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 @Guest
    last edited by Aug 1, 2020, 2:36 PM

    @Bugsounet lodash.merge loaded before 2.12.

    just saying it’s easy, if u need to do this, without another script

    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
      last edited by Aug 10, 2020, 3:35 PM

      So I do some another test and not worked without configMerge()

      Module name : MMM-Freebox (in dev for new version)
      in MMM-Freebox.js:

        defaults: {
          updateDelay:  5 * 1000,
          token: "",
          activeOnly: false,
          showIcon: true,
          showButton: true,
          showBandWidth: true,
          showRate: true,
          showClient: true,
          showClientRate: true,
          showClientCnxType: true,
          showFreePlayer: true,
          showMissedCall: true,
          showVPNUsers: true,
          maxMissed: 3,
          showIP: true,
          showPing: true,
          pingAdress: "google.fr",
          textWidth: 250,
          excludeMac: [],
          sortBy: null,
          debug: false,
          verbose: false,
          dev: false,
          debitText: "Débit total utilisé : ",
          player : {
            showPlayerInfo: false,
            // depuis le firmware 4.2.3, problemes d'affichage des logos
            // essayez avec les ips :  "192.168.0.254" (l'ip du freebox server)
            //                         "mafreebox.free.fr" ou le resultat de l'ip de mafreebox.free.fr
            //                         "212.27.38.253" l'ip de mafreebox.free.fr (a voir si cela fonctionne pour vous)
            ServerIP: "212.27.38.253",
            UseEPGDayURL: true,
            EPGDelay: 2* 60 *60 *1000
          }
        },
      

      I try to merge config with MMM-Freebox.js :

        start: function () {
          this.config = Object.assign({}, this.defaults, this.config)
      

      I send config to node_helper.js with:

        notificationReceived: function (notification, payload) {
          switch(notification) {
            case "DOM_OBJECTS_CREATED":
              this.sendSocketNotification("INIT", this.config)
              break
          }
        },
      

      module configuration in config.js:

      {
        module: "MMM-Freebox",
        disabled: false,
        header: "INFO Freebox",
        position: "top_center",
        config: {
          token: "xxxx",
          updateDelay:  5 * 1000,
          activeOnly: false,
          sortBy: "type",
          showButton: true,
          debug: true,
          //dev: true,
          //verbose: true,
          showVPNUsers: true,
          textWidth: 250,
          player: {
            showPlayerInfo: true
          }
        }
      },
      

      result in node_helper.js:

      [2020-08-10 16:53:52.705] [LOG]    {
        updateDelay: 5000,
        token: 'xxxx',
        activeOnly: false,
        showIcon: true,
        showButton: true,
        showBandWidth: true,
        showRate: true,
        showClient: true,
        showClientRate: true,
        showClientCnxType: true,
        showFreePlayer: true,
        showMissedCall: true,
        showVPNUsers: true,
        maxMissed: 3,
        showIP: true,
        showPing: true,
        pingAdress: 'google.fr',
        textWidth: 250,
        excludeMac: [],
        sortBy: 'type',
        debug: true,
        verbose: false,
        dev: false,
        debitText: 'Débit total utilisé : ',
        player: { showPlayerInfo: true }
      }
      

      so config is not merged !

      now … Let’s try with configMerge() with SAME configuration
      just modify :

        start: function () {
          this.config = configMerge({}, this.defaults, this.config)
      

      result in node_helper.js:

      [2020-08-10 17:08:14.984] [LOG]    {
        updateDelay: 5000,
        token: 'xxxx',
        activeOnly: false,
        showIcon: true,
        showButton: true,
        showBandWidth: true,
        showRate: true,
        showClient: true,
        showClientRate: true,
        showClientCnxType: true,
        showFreePlayer: true,
        showMissedCall: true,
        showVPNUsers: true,
        maxMissed: 3,
        showIP: true,
        showPing: true,
        pingAdress: 'google.fr',
        textWidth: 250,
        excludeMac: [],
        sortBy: 'type',
        debug: true,
        verbose: false,
        dev: false,
        debitText: 'Débit total utilisé : ',
        player: {
          showPlayerInfo: true,
          ServerIP: '212.27.38.253',
          UseEPGDayURL: true,
          EPGDelay: 7200000
        }
      }
      

      You can’t see that player: {} value is now set and merged with default value

      @MichMich :

      in MM core js/module.js

      	/* setConfig(config)
      	 * Set the module config and combine it with the module defaults.
      	 *
      	 * argument config object - Module config.
      	 */
      	setConfig: function (config) {
      		this.config = Object.assign({}, this.defaults, config);
      	},
      

      Can I send you a patch with configMerge() script for solve this developer issue (It take head !) ?

      S 1 Reply Last reply Aug 10, 2020, 3:52 PM Reply Quote 0
      • S Offline
        sdetweil @Guest
        last edited by Aug 10, 2020, 3:52 PM

        @Bugsounet open a PR, describe the problem, and your solution

        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
          last edited by Aug 12, 2020, 4:38 PM

          sure, i just open it

          1 Reply Last reply Reply Quote 1
          • ? Offline
            A Former User
            last edited by Sep 13, 2020, 5:26 PM

            Ok, so, after one month

            1. No news on this topic (I have mentionned @MichMich but …)
            2. I have open an issue, no news
            3. i have make a PR, euh no news too ??

            So i decide I close Issue and PR
            it’s not a problem for me… i use my own tools :)

            In this forum,
            There are not many developers left …
            So avoid listening to them, you would have even less :)
            I don’t know what you are looking for :)

            For the moment, you have one motivated!
            This is not likely to continue for long …

            @bugsounet for @MichMich

            1 Reply Last reply Reply Quote 0
            • ? Offline
              A Former User
              last edited by Sep 20, 2020, 12:43 PM

              Waiting… and Waiting …

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