Active
Madrid Metro for Garmin
A Garmin smartwatch app that shows real-time Madrid Metro arrival times, with GPS station search and favourite stations.
Context
“Tiempos Metro Madrid” is an app for Garmin watches that shows when the next trains arrive at a Madrid Metro station. It is not an official Metro de Madrid app.
What it does
- Finds the nearest station with the watch’s GPS.
- Keeps up to ten favourite stations, which you can manage from the watch or from the Garmin Connect settings.
- Lets you browse every station by line, covering the 12 lines and the Ramal branch.
- Shows arrival times in real time, with a coloured badge in the official colour of each line.
- Supports a wide range of Garmin watches, with layouts for round, semi-octagon and rectangular screens.
Architecture
The watch app is written in Monkey C. It talks to a small back end on AWS.
Garmin watch → API Gateway → Lambda → Madrid Metro data
- The back end is a Python Lambda function that queries Madrid Metro’s public data on each request and returns a compact JSON response. It has two endpoints: arrival times for a station, and the nearest station to some coordinates.
- API Gateway applies throttling in front of it, and Terraform defines the infrastructure.
Engineering decisions
- Keep the watch simple. The device only sends a station code or coordinates and renders the answer. Parsing Metro’s data happens in the Lambda function.
- Roll back instantly. Lambda publishes immutable versions and API Gateway points to a
livealias, so reverting a bad release means moving the alias. - Do not store personal data. GPS coordinates are used only to find the nearest station and are not kept on the server. The app has no analytics or advertising.
- Be honest about the data. The store listing states that the app is unofficial and that arrival times may not always be accurate.