Read the statement by Michael Teeuw here.
multiple module instances overwrites itself values
-
Ok other question.
If i setup a module twice in the config, do they share the variables from the code? -
Any news here?
-
@DazDavid nope
-
Would it work if u give them names like MMM-FHEM1 and MMM-FHEM2?
Cause if u add two instances with the same name in the config i can imagine, that he will read the first value and overwrites them in the second instance. Like
var variable = 1;
var variable = 2;Output would be 2.
-
This post is deleted! -
@bobbob601 thx for the answer. Do you have a example how to write a module with multi-instace support?
-
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…
-
This post is deleted! -
@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.
-
This post is deleted! -
@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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login