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.

    MMM-SwissStationboard

    Scheduled Pinned Locked Moved Troubleshooting
    12 Posts 5 Posters 5.6k Views 6 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.
    • D Offline
      doubleT Module Developer
      last edited by doubleT

      Looking at the code it seems like “unreachable” trains get the class “.darkgrey”. Without changing the code of the module, you can add this line to your MagicMirror/css/custom.css :

      div.module.MMM-SwissStationboard .darkgrey { display: none; }
      

      Going further:

      If you want to change the code and care about making it configurable, add hideUnreachable: true to the config of the module and hideUnreachable: false to the defaults in the module’s js. Similar to the other if switch, add this at line 105:

      if ((diff > this.config.minWalkingTime) || (diff < this.config.minWalkingTime && this.config.hideUnreachable != true)) {
          // all the code from the original for-loop from line 106 on
          // you can leave the if switch at line 110 - 120
          // this way the unreachable trains will be darkgrey via css when hideUnreachable is not active
          // shows trains:
          // if diff is greater than minWalkingTime (= reachable) OR
          // if diff is smaller than minWalkingTime AND hide is not true (is false)
      }
      

      If you don’t care about config, default and css and want to change the code, just add an if switch at line 105 similar to line 110 but with switched signs < to >:

      if (diff > this.config.minWalkingTime) {
          // everything from the original for-loop from line 106 on 
          // only adds results that have a diff greater than your minWalkingTime
          // you can leave out the if switch at line 110 - 120 in this case
      }
      

      I didn’t test all of this, though.

      1 Reply Last reply Reply Quote 0
      • D Offline
        DenateG
        last edited by

        Thanks for your help! Your first suggestion works. It removes the unreachable ones; if the maximumEntries is 10 and 8 of the entries are unreachable then only 2 will be shown. I fixed this by just increasing the maximum entries.
        I tried the last suggestion, thinking this would bypass the maximumEntries problem but unfortunately, i couldnt get the code working.

        Anyway thanks for your help!

        1 Reply Last reply Reply Quote 0
        • D Offline
          doubleT Module Developer
          last edited by

          Ah, yes of course, it will still only call the maximum number of entries. That’s a bit more challenging.

          1 Reply Last reply Reply Quote 0
          • V Offline
            vanhoekd 0 Module Developer
            last edited by

            I will try to integrate that possability in a future release. Please give me some time for that, because i go on holiday soon and i don’t know if i get to it untill then.

            1 Reply Last reply Reply Quote 0
            • V Offline
              vanhoekd 0 Module Developer
              last edited by

              It is included in the Module, please go into the Modules/MMM-SwissStationboard folder and issue the following command

              git pull
              

              Now you can remove the line from your custom.css and you will always have the same amount of connections shown, just add the following line to your module configuration:

              hideNotReachable: 1, //Will hide all the not reachable connections
              

              I hope, this will help :)

              1 Reply Last reply Reply Quote 1
              • D Offline
                DenateG
                last edited by

                This is great! Thanks a lot. I will try it when i get home.

                1 Reply Last reply Reply Quote 0
                • I Offline
                  insofern
                  last edited by

                  I have a question to the MMM-SwissCommute Module. Perhaps anyone can help me within this topic:

                  My code looks like this:

                  {
                  			module: 'MMM-SwissCommute',
                  			position: 'top_right',
                  			header: 'Winterthur - Zurich',
                  			config: {
                  				from: 'Winterthur', // Start train station
                  				to: 'Eschlikon', // Destination station
                  				maximumEntries: 2, // Max departures displayed
                  				minWalkingTime: 10, // Minimum time to get to the station
                  			}
                  		},
                  		{
                  			module: 'MMM-SwissCommute',
                  			position: 'top_right',
                  			header: 'Winterthur - Lausanne',
                  			config: {
                  				from: 'Winterthur', // Start train station
                  				to: 'Lausanne', // Destination station
                  				maximumEntries: 2, // Max departures displayed
                  				minWalkingTime: 10 // Minimum time to get to the station
                  			}
                  		},
                  

                  And I hoped to get the two Modules in the top-right corner, one below another. But for some reason they appear next to each other without a space (see figure).

                  Does anyone know how to get the modules one below another?0_1524927274964_screen_mm.png

                  1 Reply Last reply Reply Quote 0
                  • V Offline
                    vanhoekd 0 Module Developer
                    last edited by

                    Hi insofern,

                    After digging into my code (which did not explain your issue) i noticed, that you used another module. I wrote the MMM_SwissStationboard module and you are using the MMM_SwissCommute module. May I suggest moving your question to another thread?

                    I 1 Reply Last reply Reply Quote 0
                    • I Offline
                      insofern @vanhoekd 0
                      last edited by

                      @vanhoekd-0 thank you for your reply.

                      I thought to ask the question here, because you reference the swisscommute module on your GitHub page. Wanted to try my luck :)

                      But of course, feel free to move it to a more fitting place

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        duxnobis
                        last edited by

                        Hi. I still think it was a good question. I for example wanted to have twice your module one above the other. Say the first shows the bus connection and below the train. Or simply two different starting points. How can I write this? Thanks for this very helpful module by the way!

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          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