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-ResRobot - Public transport information for Sweden

    Scheduled Pinned Locked Moved Transport
    138 Posts 27 Posters 199.0k Views 28 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.
    • AlvingerA Offline
      Alvinger
      last edited by Alvinger

      Description:

      MMM-ResRobot is a module that displays departure times for one or more public transport stops in Sweden. It uses the ResRobot API which is a collaboration between a number of public transport providers.

      Screenshots:

      Download:

      [card:Alvinger/MMM-ResRobot]

      Version 1

      Initial release

      Version 1.1

      One minor change: transportation type icons are now displayed (to the left of the linenumber). All rail-bound types are displayed as trains (fa-train), all buses are displayed as bus (fa-bus) and all waterborne transportation is displayed as ship (fa-ship).

      Version 1.2

      Added config option skipMinutes. Allows for skipping of departures within skipMinutes minutes from now. Default is 0 (zero).

      Version 1.3

      Reworked the updating logic. For some reason the module stopped updating in some cases. This version also reduces the number of API calls to Resrobot.
      NOTE! The configuration has been changed in this version. Added new array “Routes” consisting of pairs of “from” and “to” (“to” can be empty but must be present). This is a breaking change.
      Previous configuration:

      from: "from1,from2,from3",
      to: "to1,,to3"
      

      New configuration:

      routes: [
        from: "from1", to: "to1",
        from: "from2", to: "",
        from: "from3", to: "to3",
      ]
      1 Reply Last reply Reply Quote 3
      • N Offline
        Notumlord
        last edited by

        Awesome, i’ve been looking for something like this but was unable to code it myself, i’ll try it once i get home.
        Could you also write a module for Västtrafiks API which would show next departure for a given stop?

        https://developer.vasttrafik.se/portal/#/

        1 Reply Last reply Reply Quote 0
        • AlvingerA Offline
          Alvinger
          last edited by

          Thanks.

          Västtrafik is actually already covered by ResRobot. Just look up the stop id at Trafiklab (see README.md for instructions) and you’re ready to go!

          1 Reply Last reply Reply Quote -1
          • N Offline
            Notumlord
            last edited by

            Unfortently i can’t get it to work, all i get is a black screen when i load the mirror.

            This is my config:

            {
                module: "ResRobot",
                position: "left",
                header: "Departures",
                config: {
                    from: "740059685",   // ResRobot Station ID (or a comma-separated string of IDs)
                    to: "740072430", // ResRobot Station ID of destination (or a comma-separated string of IDs)
                    maximumEntries: 6,  // Number of departures to show on screen
                    truncateAfter: 5,   // A value > 0 will truncate direction name at first space after <value> characters. 0 = no truncation
                    apiKey: "57434e24-a128-4cdb-bb88-e4b1e857c1aa"  // Your ResRobot apiKey
                }
            },
            

            If i remove the code again the mirror loads fine.

            1 Reply Last reply Reply Quote 0
            • AlvingerA Offline
              Alvinger
              last edited by Alvinger

              The module name is “MMM-ResRobot”, not “ResRobot”. Change that and it will work. Sorry, my bad!

              N 1 Reply Last reply Reply Quote 0
              • N Offline
                Notumlord @Alvinger
                last edited by

                @Alvinger Woops, don’t know how i missed that. It was copied from your README but i can see you’ve fixed it now, i’ll give it another try. :)

                1 Reply Last reply Reply Quote 0
                • AlvingerA Offline
                  Alvinger
                  last edited by

                  @Notumlord, please give it another try. I actually made a last-minute name change but forgot to update the README. :-(

                  N 1 Reply Last reply Reply Quote 0
                  • N Offline
                    Notumlord @Alvinger
                    last edited by

                    @Alvinger Tried it and now it works, another issue though is that the “To/From” doesnt seem to work properly. If i put station A in “From” and station B in “To” the module also shows “From B to A” so it shows both directions (if that makes sense).

                    1 Reply Last reply Reply Quote 0
                    • AlvingerA Offline
                      Alvinger
                      last edited by

                      Hi,
                      Can you post your config?

                      N 1 Reply Last reply Reply Quote 0
                      • N Offline
                        Notumlord @Alvinger
                        last edited by paviro

                        @Alvinger

                        {
                            module: "MMM-ResRobot",
                            position: "left",
                            header: "Avgång",
                            config: {
                                from: "740015597",   // ResRobot Station ID (or a comma-separated string of IDs)
                                to: "740000002", // ResRobot Station ID of destination (or a comma-separated string of IDs)
                                maximumEntries: 6,  // Number of departures to show on screen
                                truncateAfter: 5,   // A value > 0 will truncate direction name at first space after <value> characters. 0 = no truncation
                                apiKey: "<key>"  // Your ResRobot apiKey
                            }
                        },
                        

                        Note from admin: Please use Markdown on code snippets for easier reading!

                        1 Reply Last reply Reply Quote 0
                        • AlvingerA Offline
                          Alvinger
                          last edited by

                          @Notumlord
                          When I use your from: and to: I only get departures from Svingeln. I do get a lot of replies but cannot determine if they are all going in the same direction. As far as I can tell they are all departures from Svingeln, not arrivals.

                          There is a comment in the documentation of the ResRobot API which states that in some situations duplicate data is returned (has to do with real time information). My guess is that it whas just something with the data.

                          If you want to troubleshoot you can uncomment the print of “body” in node_helper.js, this will print the json-reply from ResRobot.

                          N 1 Reply Last reply Reply Quote 0
                          • N Offline
                            Notumlord @Alvinger
                            last edited by paviro

                            @Alvinger
                            My mistake, here is the config:
                            from: "740059685",
                            to: "740098001"

                            Since this is from “Vagnhallen Gårda” to “Centralstaionen” it should only show Bus 60 with the title/destination “Masthugget”.While this does show up it also shows “Redbergsplatsen” which is the opposite direction.
                            Maybe this is intended?


                            Note from admin: Please use Markdown on code snippets for easier reading!

                            1 Reply Last reply Reply Quote 0
                            • AlvingerA Offline
                              Alvinger
                              last edited by

                              It might be. I can’t control what replies ResRobot gives for a specific search. According to its documentation it should only return the result matching the from and to parameters. I’ll do some additionsl checking but you could try the search without a “to” valur to see if there is a difference.

                              1 Reply Last reply Reply Quote 0
                              • MrHM Offline
                                MrH
                                last edited by

                                Hi
                                Anyone got this working with Skånetrafiken bus traffic? so far I only get “fetching departures…” but someone said that I need to use their own API, not Trafiklabs, is that true?

                                1 Reply Last reply Reply Quote 0
                                • AlvingerA Offline
                                  Alvinger
                                  last edited by

                                  According to Trafiklab site Skånetrafiken is included in ResRobot so it should work.
                                  Can you post your config?

                                  MrHM 1 Reply Last reply Reply Quote 0
                                  • MrHM Offline
                                    MrH @Alvinger
                                    last edited by MrH

                                    did’nt work yesterday at all… now, I get a response but as of right now 16:16 it only shows one departure at 16:30 ?

                                    
                                                    {
                                                            module: "MMM-ResRobot",
                                                            position: "right",
                                                            header: "Femman",
                                                            config: {
                                                            from: "740015772",   // ResRobot Station ID (or a comma-separated string of IDs)
                                                            to: "740015577", // ResRobot Station ID of destination (or a comma-separated string of IDs)
                                                            maximumEntries: 6,  // Number of departures to show on screen
                                                            truncateAfter: 5,   // A value > 0 will truncate direction name at first space after <value> characters. 0 = no truncation
                                                            apiKey: "407fe5c8-4621-4a20-a171-xxxxxxxxx"  // Your ResRobot apiKey
                                    
                                                           }
                                                    },
                                    

                                    edit:

                                    sometimes only one departure shows up… after a while 5-6 shows… then it’s back to one. Will try different to: ID’s and see if I can get a better response

                                    1 Reply Last reply Reply Quote 0
                                    • AlvingerA Offline
                                      Alvinger
                                      last edited by Alvinger

                                      @MrH, ResRobot (Samtrafiken) had a service window between between 22.00 and 24.00 on October 10th. That was probably why you didn’t get a response then.

                                      I will have a look this evening using your station ids.

                                      1 Reply Last reply Reply Quote 0
                                      • K Offline
                                        Klzow
                                        last edited by

                                        Hi I’m in the making of building my Magic Mirror and came across this module. I have a problem that after roughly 7 hours it stops to update with the buss departures and freezes. Have anyone else had the same problem and found a solution to it? Works perfectly again after a restart but would like to find a solution to it.

                                        N 1 Reply Last reply Reply Quote 0
                                        • AlvingerA Offline
                                          Alvinger
                                          last edited by

                                          @Klzow, I’ve noticed the same but thought it had to do with the fact that I’m running of a first-generation pi with 256MB. Will look into it to see if I can find out why.

                                          1 Reply Last reply Reply Quote 0
                                          • N Offline
                                            Notumlord @Klzow
                                            last edited by

                                            @Klzow same here, sometimes it works for a few days but usually it stops working within 24h

                                            AlvingerA 1 Reply Last reply Reply Quote 0

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 1 / 7
                                            • 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