• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Realtime data (GTFS) added to MMM-Resrobot timetables (swe) to show buss delay

Scheduled Pinned Locked Moved Transport
1 Posts 1 Posters 189 Views 1 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.
  • K Offline
    karl.d.hagstrom
    last edited by Nov 4, 2024, 2:29 PM

    Re: MMM-ResRobot - Public transport information for Sweden
    Since Trafiklab also provides a free api to the GTFS files, I wanted to add the delay to the buss timetable that I currently show with the MMM-Resrobot module.
    I took a shortcut and added my GTFS-implementation in a fork/branch of MMM-Resrobot, so all creds to the creator of that module!
    My branch also contains modificatios that does not only affect the realtime-data that you might not want in your version. I think i hardcoded a filter to only show busses heading towards the city, so you might not want to directly clone my branch without having a look at it first (search for “directionFlag”).

    b77fd1a0-62ab-49c1-809b-af7183952eb0-image.png

    to use:

    1. create free account in www.trafiklab.se
    2. create project
    3. create api-keys for Stops data, ResRobot v2.1 & GTFS Regional Realtime
    4. find your station ID for the buss-stop
    • download “_stops.xml” for sweden:
      easiest to do it in the web-browser by browsing:
      https://opendata.samtrafiken.se/stopsregister-netex-sweden/sweden.zip?key=\<your API key for Stops data>
    • find your stop-id called local-stoppoint-gid that matches your buss-stop
      this file is very hard to traverse, so i made a script to do it for me: (change “Gävle Domarringen” to your stop and point to where you have the _steps.xml)
      perl -0777 -ne 'while (/Gävle Domarringen(?:(?!<\/StopPlace>).)*?local-stoppoint-gid<\/Key>\n *<Value>\d*:(.*?)<\/Value>\n/sg) { print "stop: $1\n" }' data/_stops.xml which outputs something like:
      - stop: 9022021480123001
      - stop: 9022021480123002
      the two stops are on the different sides of the road, and i only wanted the one with the 2 at the end (heading towards town in my case which I found out by looking att the actual data and comparing with the x-trafik-app).
      Use this stop-ID in the config.js where I added a GTFSRegionalRealtime, se my example config-setup for resrobot.
    1 Reply Last reply Reply Quote 1
    • 1 / 1
    1 / 1
    • First post
      1/1
      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