How can i toggle various destinations via transport module?



  • Hey guys, so far im having a blast configuring my mirror and adding features. What i wanted to know is, has anyone created a module that will swap out 2 different destinations via the same module? For example, i am using the localtransport module to display my subway times to work. i wanted to add another destination, but i want to save space. I tried using carousel but i failed. i want to configure it where i can toggle various different destinations (via touch) so i can easily toggle through my routes. Granted I can just add the module several times, but i need to conserve space.



  • @mirror.master Have a look here. I don’t know how you want to trigger the swapping, but in general the possibilities described in the thread are the ways to go.



  • definitely going to check it out. hope i can get a lead to solve my problem. Thank you!



  • @mirror.master You’re welcome! The information provided are rather general. Feel free to ask again, if you need more specific help.



  • This post is deleted!


  • @Anhalter42
    so i started using the carousel, and i have modules working except that i cannot run the localtransport module 2 different instances. For example i have no idea how to add the same module twice that will display 2 diff destinations for each slide. i tried dulpicating the module under a different name and made the corresponding changes, however. no bueno… lol there has to be a way to give each instance of localtransport im running withing my config a unique name so i can run one instance in one slide and a another in the second.



  • @mirror.master ah i see. I don’t think modules are meant to be used in form of multiple instances of the same module. For example, see the way node_helper is used (even when changing some names/parameters in config). Some modules may work with multiple instances of themselves, some don’t.

    The module you are talking about is MMM-LocalTransport, correct? It’s not really clear by the term “localtransport module”. If I see correctly, you should be able to use multiple instances of this module just by adding it two times in the config file. If not, see below.

    As far as I understand, you already tried to copy the whole module under different name? In other words, you created a “new” module which does exactly same / has the same code as the one you want to use, but has a different name (folder named “newModule” -> file named “newModule.js” -> within the line Module.register('newModule'))?! This is definitely possible and should work unless the module itself uses some sort of API which restricts multiple accesses.

    Alternative way IF the module itself provides the option to set destinations via notifications (Note: MMM-LocalTransport doesn’t seem to offer that): use MMM-RemoteControl and/or MMM-ModuleScheduler to swap destinations by remote command and/or timing.
    IF it doesn’t, implement it yourself (and use together with the modules mentioned above). In most cases, it is not difficult: basically the following structure should apply

    notificationReceived: function(notification, payload) {
      if (notification==="SET_FROM_TO") {
        /* 1. set variable containing destination to new destination defined by payload;
         *     may be this.config.origin/this.config.destination or something
         * 2. make changes visible; probably by doing this.update() or this.updateDom();
         * So, for example for MMM_LocalTransport something like this should work:
         */
        this.config.origin = payload.origin;
        this.config.destination = payload.destination;
        this.update();
      }
    }
    


  • @Anhalter42 i can run mmm-localtransport twice (same module, two different destinations) but what i was trying to do was have destination A show up on slide1 and Destination B show up on slide 2, Since the module has one name i cant choose which way the module works for each slide, i can only carry over both destinations to both slides which defeats the purpose of me using carousel as a profile switch. I did change change the module name when i duplicated it. it would get stuck on loading even though i configured it. I gave up on creating the module twice. I will see if i can work with your additional pointers. I do ok, but im not on the level of the rest of you guys lol.

    p.s i apologize for saying localtransport module. i renamed mmm-localtransport to it lol



  • @mirror.master ah, so you got it to display two different instances of the module? Just Carousel doesn’t let you input those two instances because it requires a name?! Then I recommend using MMM-ProfileSwitcher + MMM-Remote-Control and/or MMM-ModuleScheduler. Instead of having to provide a list of modules which form one “page”, you can assign every module a list of “pages” it should be displayed on. This eliminates the problem of modules being named the same / being duplicates.
    Just install ProfileSwitcher and RemoteControl, assign some “classes” (think of it as pages) to modules (e.g. “transport1” and “transport2” to the transport instances) and switch between them using URLs like here. I guess ModuleScheduler isn’t necessary since ProfileSwitcher already comes with timing functionalities. Just mentioned for completeness.



  • @Anhalter42 said in How can i toggle various destinations via transport module?:

    @mirror.master ah, so you got it to display two different instances of the module? Just Carousel doesn’t let you input those two instances because it requires a name?! Then I recommend using MMM-ProfileSwitcher + MMM-Remote-Control and/or MMM-ModuleScheduler. Instead of having to provide a list of modules which form one “page”, you can assign every module a list of “pages” it should be displayed on. This eliminates the problem of modules being named the same / being duplicates.
    Just install ProfileSwitcher and RemoteControl, assign some “classes” (think of it as pages) to modules (e.g. “transport1” and “transport2” to the transport instances) and switch between them using URLs like here. I guess ModuleScheduler isn’t necessary since ProfileSwitcher already comes with timing functionalities. Just mentioned for completeness.

    ill try my best with all the info provided. thank you, im honestly loving this mess i call my mirror


Log in to reply
 

Looks like your connection to MagicMirror Forum was lost, please wait while we try to reconnect.