Read the statement by Michael Teeuw here.
London DLR arrivals
-
Hi,
Looking for a module that will pull in the arrival times of DLR trains customisable by station and destination.
i.e.
next arrival @ (station) to (destination) in (time) (i.e.7mins)
The data can be pulled from the TFL api.
https://api.tfl.gov.uk/StopPoint/940GZZDLGAL/Arrivals
I am happy to try and write the module myself but have no experience scripting with node.js any assistance would be appreciated.
Thanks
J.
-
@dragon8_uk sounds good and not too difficult:
I would structure it this way:
Main.js:
defaults:- station
- arrivals / departures
- API Key/
functions:
- start: sendSocketNoti (to node_helper.js) including config
- socketNotiReceived: get json from node_helper and store it in an object. Then call getDom()
- getDom: create dom and include object elements as table including line and ETA
- setInterval() to create a loop calling the API with a certain interval.
Node_helper
- socketNotiReceived: get config from main.js, call API url, fetch data and send it back to main.js via sendSocketNoti.
No claim for completeness.
There is a vast amount of modules here working roughly like this. Take a look around on github for
third party modules and check the MagicMirror Readme for creating modules.It’s really not difficult and much fun to develop!
-
@dragon8_uk Have a look at this:
https://github.com/ryck/MMM-TFL-Arrivals
Should work for DLR as well!?Or this one:
https://github.com/nwootton/MMM-UKLiveBusStopInfo -
Has anyone got MMM-TFL-Arrivals running?
Just shows a blank screen for me.The UKLiveBusStopInfo did work, but did some strange things to some buses. Also what is needed is for a ETA not if the bus is late.
Just spent the evening trying to parse the JSON data using MMM-json-feed. That didn’t behave either, it either displays the whole feed or nothing at all.
Is there anyone a bit more knowledgeable who can look into this, live bus and train departures for TfL would be awesome.
-
@pumpy266 im trying it out at the moment
-
@pumpy266 tfl-arrivals works for me.
Have you setdebug: true
in the config?
Then you can check for debug messages in the developers console.
Either by pressing f12 in your browser or by starting the mirror withnpm start dev
-
@lavolp3 Interesting, many thanks for looking at this.
I am running it in MMM-Pages so Alexa can control it, I am new to all of this so just asking in case this has any bearing on things?Can’t look right now, but will in the morning.
-
Slightly later than expected.
Many thanks for trying the module out and confirming it works.
OK, got the TFL-Arrivals working.
But not in MMM-Pages.Any thoughts on how to troubleshoot this?