This is a custom component for Home Assistant, which adds a single stop (bus or tram stop, train or metro platform) from Helsinki Region Transport (Helsingin seudun liikenne, HSL, Helsingforsregionens trafik, HRT), Waltti or another Digitransit-supported region as a Home Assistant sensor.
You can add a stop using either:
- The stop number, which you can find on a sign at the stop or from the journey planner (reittiopas). For example, for trams from Länsiterminaali T1 going towards central Helsinki, you'd use H0236. For platform 1 at Tapiola bus station, you'd use E2187. This won't work if two stops have the same code.
- The GTFS identifier of the stop. This is useful if two stops
share a single stop number. You can find this URL encoded inside the address
of the journey planner page for the stop. For example, Alberganesplanadi
(E1112)
has the address
pysakit/HSL%3A2112231
, and the GTFS identifierHSL:2112231
- swap the%3A
for a colon.
You'll also need a Digitransit API key. You can sign up for one for free on the Digitransit website.
The basic functionality works, but this isn't yet ready for wider use, so use this at your own risk.
Another limitation is that stations are not currently supported, only stops. This means you can't monitor all departures from a station with multiple stops or platforms.
Before a stable release, these will be addressed, and it's possible that addressing these will break the current functionality, so if you want to use this already, please check the release notes carefully before upgrading.
Installing with HACS is recommended.
First, install the custom integration using HACS:
- Add the integration using HACS
- Restart Home Assistant
Then add a new integraion:
- Go to Settings, then Devices & Services
- Click Add Integration
- Select 'Digitransit' from the list
- Enter your API key and stop number.
The sensor counts down to the next uncancelled departure. The attributes provide a list of upcoming departures with their service name and departure time in a machine-friendly format.
This repository is based on the excellent integration_blueprint template.