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:

create free account in www.trafiklab.se create project create api-keys for Stops data, ResRobot v2.1 & GTFS Regional Realtime 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.