NSW Departures (unofficial) smart home integration, free and open source

Unofficial. Next departures and alerts at your NSW stops (Transport for NSW data).
The next departures (trains, metro, light rail, buses, ferries) at up to four stops of New South Wales, and the service alerts in effect there, in Gladys. Data: Transport for NSW, Open Data Hub, licensed under Creative Commons Attribution 4.0.
This integration is unofficial: it is not affiliated with nor endorsed by Transport for NSW, and it is not an official source. Check transportnsw.info or the signs at the stop before you travel. It was never tested with a real key nor on a real Gladys installation by its author: the answers of the Trip Planner were simulated from its official documentation (Swagger file of 2025-10-02, API Basics page).
Get started
- Create the free API key: register on the
Open Data Hub, click your profile
icon, then API Tokens, type a name and Create API token
(user guide).
Copy the key at once: the hub shows it only once. Type the key alone (if
you paste it with
apikeybefore it, that word is taken away). - Find the stop ids. A station (e.g. 200060 for Central Station: every
platform), a platform, a bus stop or a wharf has a number in the Trip
Planner: the
stop_idof the GTFS timetables of Transport for NSW, or the number in the stop pages of transportnsw.info. - Install the integration, type the key and the ids in its configuration, and save. Open the Discover tab and press Add on each stop. Its name becomes the Trip Planner name ("Central Station (departures)") after the first read, unless you typed one.
One device per stop. A device belongs to a slot and its id: if you type another id in a slot, the integration offers a new device; the old one is no longer updated and keeps its last values (the configuration page lists it under "Not updated any more": delete it in Gladys). Changing the routes filter keeps the device.
What each device shows
| Feature | Type | Content |
|---|---|---|
| Next departure | text | "T1 → Hornsby in 6 min (12:41, Platform 18, 2 min late)", "due" within a minute, "timetable time" without real time |
| Following departure | text | the same for the next one |
| Departures (30 min) | counter | for scenes, e.g. "more than 0" |
| Departures | text | "12:35 · T1 → Hornsby 6, 14 min · T9 → Gordon 11 min" |
| Alerts in effect | counter | the alerts the Trip Planner gives for the stop today |
| Alert | text | the first alert (highest priority first, then the latest) and how many more |
The times are Sydney times. Every read publishes every value: a departure that is gone becomes "No following departure (read 12:36)", never a number left behind. A failed or unreadable read publishes nothing (no 0): the configuration page says why and since when. A departure flagged cancelled is left out. The routes filter keeps only the routes you list, as shown (T1, 333, F1...).
A stop id is checked against the answer: the departures are published only when the Trip Planner names that id (as the stop, a parent of the platform or in its properties). When it names other stops only, the id is said unknown and asked again 30 minutes later; when it names none and there is no departure, nothing is published until the id has been confirmed once.
The scene trigger New service alert at a stop fires once for an alert seen for the first time at a watched stop, when it started within the last 24 hours (the first read only learns the alerts already there). You can keep high priority alerts only ("high" or "veryHigh"), or the others.
Requests and quotas
- One request per stop and per read for the departures; the alerts every 5 minutes, one request per stop. Both carry the key and are counted. One request at a time, 1 s apart at least (the hub allows 5 a second).
- The default "Bronze" plan of the hub grants 60,000 requests a day per
key, all the APIs together (API Basics page, read on 2026-12-03). The
integration keeps its own daily budget (10,000 by default, 500 to
60,000), counted per Sydney date and written to
/databefore each request: a restart keeps the count. When the planned reads would use more than 90 % of the budget (80 % of it for the departures, 20 % for the alerts), the intervals are stretched, and the configuration page says so. With 4 stops and 10,000 requests, the defaults hold (60 s, 5 min). - A read never comes sooner than the interval: neither a restart, nor a
reconnection, nor saving an unchanged configuration, nor Discovery (when
/datacannot tell the time of the last read, the first one waits 30 s after the start). - "Account Over Rate Limit" or HTTP 429: the key is paused (2 minutes,
doubled up to 6 hours,
Retry-Afterrespected). "Account Over Quota Limit": the key is paused until 00:05 the next day in Sydney, but 1 to 3 hours only (the hour of the reset is an assumption: the hub is asked again after at most 3 hours). A server error pauses the service that got it (1 minute, doubled up to 6 hours). The pauses are kept in/data.
The key
The key is kept by Gladys in its database, never shown again, and sent only
to Transport for NSW, in the Authorization header (never in a URL). It
never appears in the logs, the status nor /data.
When the departures answer HTTP 401 with "The calling application is
unauthenticated", the key is refused: nothing is sent with it any more
(neither departures nor alerts) until you type another key, or until the
button Show the last read / retry the key sends one request with it that
succeeds (30 s at least after the previous request). /data keeps two salted
8-bit prints of the refused key, never the key: another key is tried (after a
restart, unless both its prints match too: 1 key in 65,536).
Any other 401 or 403 (the hub also uses them when a limit is exceeded), and
any 401 or 403 of the alerts, is never a refusal: the departures pause, the
alerts are spaced out (5 minutes, doubled up to 1 hour).
Clock and time zone
The answers are used only when their Date header is within 5 minutes of
the clock of the machine running Gladys: set its clock (NTP) if the status
says it differs. The quota day and the alerts filter use the Sydney date.
Limits
- Read-only: nothing is ever sent but reads.
- The departures of a stop are those the Trip Planner gives for "now"
(
departure_mon); the alerts those ofadd_infofor the stop and today. - The quota day of the hub is assumed to start at midnight in Sydney (not documented).
Licence and attribution
Data: Transport for NSW (Open Data Hub), under the Creative Commons Attribution 4.0 licence and the Open Data Hub terms: attributed to Transport for NSW, no Transport for NSW logo, nothing suggesting an official status or an endorsement.
Configuration settings
These are the settings NSW Departures (unofficial) asks for in its configuration screen in Gladys.
| Setting | Type | Required | Description |
|---|---|---|---|
| Departures in New South Wales | section | No | Unofficial, not affiliated with nor endorsed by Transport for NSW. Data: Transport for NSW (Open Data Hub, Creative Commons Attribution 4.0). The next departures (trains, metro, light rail, buses, ferries) at up to four stops of the Trip Planner, and the service alerts in effect there. Needs one free API key of the Open Data Hub (an account, then 'API Tokens'). The key has a daily quota (60,000 requests on the default plan): the integration counts its requests and stays within the daily budget below. |
| Open Data Hub API key | secret | Yes | The free API key (token) of the Open Data Hub, kept by Gladys in its database, never shown again, sent only to Transport for NSW (api.transport.nsw.gov.au). |
| Language of the texts | select | No | The language of the device names and the departure texts (the Transport for NSW texts stay in English). |
| Read interval (s) | number | No | How often the departures are read, in seconds (30 to 600). Stretched when the daily budget would not hold it. The alerts are read every 5 minutes. |
| Daily budget (requests) | number | No | Requests per Sydney day at most (500 to 60000; the default plan of the hub grants 60000 a day). Each stop costs one request per read, and one more per alerts read. |
| Stop 1 | section | No | The stop id of the Trip Planner: a station (e.g. 200060 for Central Station, every platform), a platform, a bus stop or a wharf, as in the GTFS stops of Transport for NSW or the stop pages of transportnsw.info. |
| Name (optional) | string | No | |
| Stop id | string | No | |
| Routes (optional) | string | No | Only these routes, comma separated, as shown (e.g. T1, 333, F1). Empty: every route. |
| Stop 2 | section | No | The stop id of the Trip Planner: a station (e.g. 200060 for Central Station, every platform), a platform, a bus stop or a wharf, as in the GTFS stops of Transport for NSW or the stop pages of transportnsw.info. |
| Name (optional) | string | No | |
| Stop id | string | No | |
| Routes (optional) | string | No | Only these routes, comma separated, as shown (e.g. T1, 333, F1). Empty: every route. |
| Stop 3 | section | No | The stop id of the Trip Planner: a station (e.g. 200060 for Central Station, every platform), a platform, a bus stop or a wharf, as in the GTFS stops of Transport for NSW or the stop pages of transportnsw.info. |
| Name (optional) | string | No | |
| Stop id | string | No | |
| Routes (optional) | string | No | Only these routes, comma separated, as shown (e.g. T1, 333, F1). Empty: every route. |
| Stop 4 | section | No | The stop id of the Trip Planner: a station (e.g. 200060 for Central Station, every platform), a platform, a bus stop or a wharf, as in the GTFS stops of Transport for NSW or the stop pages of transportnsw.info. |
| Name (optional) | string | No | |
| Stop id | string | No | |
| Routes (optional) | string | No | Only these routes, comma separated, as shown (e.g. T1, 333, F1). Empty: every route. |
How to install NSW Departures (unofficial) in Gladys
- In Gladys, open Integrations: NSW Departures (unofficial) appears in the catalog, next to the native integrations, with a community badge.
- Click Install. Gladys pulls the Docker image (
ghcr.io/lm1lc3n7/gladys-nsw-departures:0.1.1), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration). - Open the Configuration screen of the integration, fill in the settings, and save.
- You can also install it directly from its repository URL: https://github.com/LM1LC3N7/gladys-nsw-departures.
NSW Departures (unofficial) requires Gladys >=5.3.0. The catalog inside Gladys refreshes every hour, so a new version becomes available at most one hour after its release.
Not running Gladys yet? It is free and open source: follow the installation guide to get started.
About external integrations
NSW Departures (unofficial) is an external integration: a community integration packaged as a Docker container and published on GitHub, that Gladys installs in one click and runs in a sandbox isolated from its core. It is published and maintained by LM1LC3N7, not by the Gladys core team.
- Browse all integrations, native and community
- Build and publish your own external integration
- Source code on GitHub — source of this documentation