UK Trains
by @jabbslad
Query UK National Rail live departure boards, arrivals, delays, and train services. Use when asked about train times, departures, arrivals, delays, platforms, or "when is the next train" for UK railways. Supports all GB stations via Darwin/Huxley2 API.
clawhub install uk-trainsπ About This Skill
name: trains description: Query UK National Rail live departure boards, arrivals, delays, and train services. Use when asked about train times, departures, arrivals, delays, platforms, or "when is the next train" for UK railways. Supports all GB stations via Darwin/Huxley2 API.
UK Trains
Query National Rail Darwin API for live train departures and arrivals.
Setup
Requires free Darwin API token:
1. Register at https://realtime.nationalrail.co.uk/OpenLDBWSRegistration/
2. Set NATIONAL_RAIL_TOKEN in environment (or configure in skills.entries.uk-trains.apiKey)
Commands
# Departures
./scripts/trains.py departures PAD
./scripts/trains.py departures PAD to OXF --rows 5Arrivals
./scripts/trains.py arrivals MAN
./scripts/trains.py arrivals MAN from EUSStation search
./scripts/trains.py search paddington
./scripts/trains.py search kings
Station Codes
Use 3-letter CRS codes:
PAD = London PaddingtonEUS = London Euston KGX = London Kings CrossVIC = London VictoriaWAT = London WaterlooMAN = Manchester PiccadillyBHM = Birmingham New StreetEDB = Edinburgh WaverleyGLC = Glasgow CentralBRI = Bristol Temple MeadsLDS = LeedsLIV = Liverpool Lime StreetRDG = ReadingOXF = OxfordCBG = CambridgeResponse Format
JSON with:
locationName, crs - Station infomessages[] - Service alertstrainServices[] - List of trains:std/sta - Scheduled departure/arrival time
- etd/eta - Expected time ("On time", "Delayed", or actual time)
- platform - Platform number
- operator - Train operating company
- destination[].name - Final destination
- isCancelled, cancelReason, delayReason - Disruption infoMessage Template
Use this compact format for WhatsApp/chat responses:
π {Origin} β {Destination}*{dep} β {arr}* βπ{platform} β π {coaches}
{status}
*{dep} β {arr}* βπ{platform} β π {coaches}
{status}
Elements
Example
π Hemel Hempstead β Euston*20:18 β 20:55* βπ4 β π 4
β
On time
*20:55 β 21:30* βπ4 β π 12
β
On time
*21:11 β 21:41* βπ4 β π 8
β
On time
Getting Arrival Times
To show arrival times, make two API calls: 1.departures {origin} to {dest} β get departure times + service IDs
2. arrivals {dest} from {origin} β get arrival timesMatch services by the numeric prefix in serviceID (e.g., 4748110HEMLHMP_ matches 4748110EUSTON__).
Notes
β οΈ Delayed (exp 20:35)π‘ Examples
π Hemel Hempstead β Euston*20:18 β 20:55* βπ4 β π 4
β
On time
*20:55 β 21:30* βπ4 β π 12
β
On time
*21:11 β 21:41* βπ4 β π 8
β
On time
Getting Arrival Times
To show arrival times, make two API calls: 1.departures {origin} to {dest} β get departure times + service IDs
2. arrivals {dest} from {origin} β get arrival timesMatch services by the numeric prefix in serviceID (e.g., 4748110HEMLHMP_ matches 4748110EUSTON__).
Notes
β οΈ Delayed (exp 20:35)βοΈ Configuration
Requires free Darwin API token:
1. Register at https://realtime.nationalrail.co.uk/OpenLDBWSRegistration/
2. Set NATIONAL_RAIL_TOKEN in environment (or configure in skills.entries.uk-trains.apiKey)
π Tips & Best Practices
β οΈ Delayed (exp 20:35)