MagicMirror Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • Donate
    • Discord

    UNSOLVED multiple module instances overwrites itself values

    Development
    7
    13
    6757
    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.
    • B
      bobbob601 last edited by bobbob601

      same than mine 🙂 coded exactly like you while I was on the plane I just pushed but not tested (sadly I pushed it on my master :-/)
      https://github.com/lgmorand/MMM-Ratp

      socketNotificationReceived: function(notification, payload) {
              Log.info("Notif:" + notification);
              if (notification === "TRANSPORTS") {
                  if (this.config.debugging) {
                      Log.info("Transports received");
                      Log.info(payload.lineInfo);
                      Log.info(payload.transports);
                  }
      
                  if(this.config.uniqueID == payload.uniqueID) // just in case of multi instances
                  {
                      this.transports = payload.transports;
                      this.lineInfo = payload.lineInfo;
                      this.loaded = true;
                      this.updateDom(this.config.animationSpeed);
                  }
      }
      

      At least, thanks to you, I know it can work 🙂

      my idea to improve it was to auto-generate a ID for the module, not in the config, but generated by the Magic Mirror on loading. it should be easy to implement. Once this ID generated, it is accessible from the node_helper and the module.js. this way, no need to declare a uniqueID in the config

      T 1 Reply Last reply Reply Quote 0
      • T
        trgraglia @bobbob601 last edited by

        @bobbob601 Yup. In my case, the user provides a station ID per instance because it has to do with local transport here in Munich. So in theory, the user is already providing unique IDs and I have no need to generate them. 😉

        http://www.anthonygraglia.com/

        1 Reply Last reply Reply Quote 0
        • strawberry 3.141
          strawberry 3.141 Project Sponsor Module Developer last edited by

          every instance has already a unique identifier see here https://github.com/MichMich/MagicMirror/tree/master/modules#available-module-instance-properties

          also the discussion in here is related to the issue https://forum.magicmirror.builders/topic/960/london-bus-status/14

          Please create a github issue if you need help, so I can keep track

          1 Reply Last reply Reply Quote 1
          • 1
          • 2
          • 2 / 2
          • First post
            Last post
          Enjoying MagicMirror? Please consider a donation!
          MagicMirror created by Michael Teeuw.
          Forum managed by Paul-Vincent Roll and Rodrigo Ramírez Norambuena.
          This forum is using NodeBB as its core | Contributors
          Contact | Privacy Policy