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

multiple module instances overwrites itself values

Scheduled Pinned Locked Moved Unsolved Development
13 Posts 7 Posters 9.0k Views 9 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.
  • B Offline
    bobbob601
    last edited by bobbob601 Apr 19, 2017, 12:54 PM Apr 19, 2017, 12:44 PM

    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 Apr 19, 2017, 10:03 PM Reply Quote 0
    • T Offline
      trgraglia @bobbob601
      last edited by Apr 19, 2017, 10:03 PM

      @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
      • S Offline
        strawberry 3.141 Project Sponsor Module Developer
        last edited by Apr 20, 2017, 12:35 PM

        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
        2 / 2
        • First post
          11/13
          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