Read the statement by Michael Teeuw here.
multiple module instances overwrites itself values
-
Having the same problem with my module… A theoretical solution could be to make node_helper multi instance aware by appending some identifier to the notification unique to the instance: ie GET_WEATHER_001… The helper triggers on GET_WEATHER and builds an array with the different notifications and payloads. It then periodically runs through the array getting the appropriate requests and sending out notifications like WEATHER_001 with the specific payload.
Haven’t built it yet though…
-
@BenRoe nope. And I tried several months ago without success. But I’m trying it now (thought I’ll not be able to test before the next week). If it works, it could be easily implemented everywhere and furthermore, I have an idea to simplify it a little bit by improving Magic Mirror itself.
I’ll come back here after my tests
-
@bobbob601 I got it working by passing a unique ID to the node helper and passing it back from the node helper.
https://github.com/trgraglia/MMM-MVG-LocalTransport
Hope this helps.
-
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-RatpsocketNotificationReceived: 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
-
@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. ;)
-
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