STM Montréal Smart-Home-Integration, kostenlos und Open Source

Next STM bus departures, metro line status and BIXI stations in Montréal.
Die Dokumentation dieser Integration wird von ihrem Autor geschrieben und ist bisher nur auf Englisch verfügbar.
The next STM buses, the metro status and the BIXI bikes near your home, in Gladys.
This integration is not affiliated with the Société de transport de Montréal (STM) nor with BIXI Montréal.
Get started in 3 steps
No technical knowledge is needed, and no account to begin with.
- Check the address of your house in Gladys: Settings → Houses. The house must have a position on the map. The integration uses it to find the stops near you. The position stays in your Gladys.
- Install the integration from the integration catalog, and accept the access to the house location. Open its configuration page and press Save, without filling anything in.
- Open the Discover tab of the integration. The 3 bus stops and 2 BIXI stations closest to your home are offered there, with their name and the direction of their routes, e.g. "Bus – Notre-Dame / Peel (36 → Ouest)". Press Add on each one you want.
That's it. You now get the scheduled times of the next buses at each stop, and the bikes and free docks of each BIXI station.
The message at the top of the configuration page always tells you what to do next. For example: "Ready: 3 bus stops and 2 BIXI stations to add. Open the Discover tab…".
Device names start with Bus – or BIXI –, so they are easy to tell apart in the device list of Gladys. You can rename them freely in Gladys.
Showing the departures on the dashboard
- Open the dashboard, then press Edit.
- Add a widget and choose STM bus departures.
- Choose the stop, then save.
The BIXI station widget is added the same way. The STM metro status widget needs an STM key (see below).
Scheduled times carry a ~, as on the STM signs: "~12 min" means "scheduled in 12 minutes".
Going real time and adding the metro (optional)
With a free, personal STM API key:
- the scheduled times become real-time predictions (where the buses actually are);
- the STM metro device appears, with the status of the green, orange, yellow and blue lines.
Getting the STM API key (5 minutes)
- Go to the STM developer portal and create an account (email and password). Confirm the email you receive.
- Once logged in, add an application. The name does not matter, e.g. "Gladys home".
- In that application, subscribe to both APIs:
- GTFS-realtime: the real-time bus departures;
- i3: the metro service status.
- Create a key, then publish it. The portal shows an "API key" and a "shared secret". Only the API key is needed.
- In Gladys, open the configuration of the integration. Paste the key in STM API key, then press Save.
- Press Test the STM API key. Both lines must show ✔. A ✖ line tells you which API your application is missing.
- Go back to the Discover tab and add the STM metro device.
The labels of the STM portal may differ slightly: when in doubt, the portal FAQ describes the same steps.
Quota. The STM grants 10,000 requests a day per account. With the default settings the integration uses about 2,200, whatever the number of stops: one read of the STM data serves all your stops. The message of the configuration page shows the estimate for your setup.
Watching other stops (work, school…)
For a stop far from home:
- At the bottom of the configuration page, press Find a bus stop. Type a street corner, e.g. "Sherbrooke Papineau".
- The answer lists the stops with their code and the direction of their
routes, e.g.
52682 — Papineau / Sherbrooke (24 → Est, 45 → Sud). - Copy the code (
52682) in Bus stops, save, then add the stop in the Discover tab.
The code is also the five-digit number written on every STM bus stop sign.
For BIXI stations, the Find a BIXI station button works the same way.
Going further
The Bus stops field accepts several codes separated by commas, a route
filter after @ and a name after :.
| Entry | Meaning |
|---|---|
52743 | every bus calling at stop 52743 |
51003@24 | route 24 only |
61503@69|469 | routes 69 and 469 |
51003@24:Bus to work | route 24, displayed as "Bus to work" |
What each device holds
Bus stop:
- Next departure, Departure 2…: the minutes to wait. 999 means no departure is scheduled.
- Next departure route…: the route number.
- Next departures: a summary, e.g.
24 3 min · 747 14 min.
STM metro (with a key): for each line, a status (Normal,
Disrupted, Notice or Unknown) and the STM message. The STM publishes
no real-time train times: only the line status is available.
BIXI station: the bikes (e-bikes included), the e-bikes, the free docks and the state of the station.
Part of the BIXI stations are removed every winter. A station that leaves the network shows 0 bikes, 0 docks and the state "Removed from the BIXI network (seasonal?)", with an orange dot on the device. The "Out of service" trigger fires once, then "Back in service" when the station returns in the spring. There is nothing to do: the device resumes by itself. While it is away, the station is only checked every 15 minutes.
Scenes
Triggers:
- STM bus approaching: a bus gets under 1, 2, 3, 5, 10 or 15 minutes. Example: "when the 24 is 5 minutes away, turn the hall light on".
- STM metro status changed: a line is disrupted, gets back to normal, or receives a notice. Example: "if the orange line is disrupted, send me a message".
- BIXI station changed: the station runs out of bikes or docks, or gets some back.
Actions:
- Read the next STM buses: e.g. a message every morning "Your 24 comes in {{minutes}} minutes".
- Read an STM metro line status: returns the status, the STM message and
normal(true or false).
Troubleshooting
| Message or symptom | What to do |
|---|---|
| "set the address of your house" | Settings → Houses: place the house on the map, then save the configuration of the integration again. |
| "Gladys did not share the location of your house" | Reinstall the integration and accept the location access, or type stop codes. |
| Nothing in the Discover tab | Read the message of the configuration page: it says what is missing. |
| "The STM refused the API key" | Check the key, and that the application is subscribed to both APIs (GTFS-realtime and i3). |
| "Quota used up" | Raise the intervals (Advanced section), or check no other application uses the same STM account. |
| BIXI station "Removed from the BIXI network" | The station left the BIXI network, often for the winter: it will come back by itself. To follow another one, see "Find a BIXI station". |
| A stop stays at 999 | No bus scheduled (at night), or a route filter matching no route of the stop. |
Privacy, data and licences
- The house location is only used to look the nearby stops up. Only a box of a few hundred meters around the house is sent to Transitous. Nothing is sent anywhere else.
- Scheduled times, stop names and search: Transitous, a free community service, from the STM data.
- Real time and metro status: STM open data, CC BY 4.0 licence, source: Société de transport de Montréal.
- Bikes: public GBFS feed of BIXI Montréal.
- Integration code: Apache 2.0 licence.
Konfigurationseinstellungen
Diese Einstellungen fragt STM Montréal in seinem Konfigurationsbildschirm in Gladys ab.
| Einstellung | Typ | Pflichtfeld | Beschreibung |
|---|---|---|---|
| Get started in 2 minutes | section | Nein | 1. Check that your house has an address in Gladys (Settings → Houses). 2. Save this page. 3. Open the “Discover” tab of this integration and press “Add” on the stops and BIXI stations near your home. That's it: you get the scheduled bus times and the BIXI bikes right away. An STM key (optional, free) adds real time and the metro status. |
| Near my home | section | Nein | How many of the closest bus stops (within 600 m) and BIXI stations (within 1 km) are proposed in the “Discover” tab. 0 turns the suggestion off. |
| Bus stops near my home | number | Nein | |
| BIXI stations near my home | number | Nein | |
| Real time and metro (optional) | section | Nein | Without a key you get the scheduled times. With a free STM key you get the real-time bus predictions and the status of the metro lines. Getting one takes 5 minutes: follow the step-by-step guide. |
| STM API key | secret | Nein | The key of your application on the STM developer portal (the shared secret is not needed). |
| Watch the metro | boolean | Nein | Creates a "STM metro" device with the status of the green, orange, yellow and blue lines. |
| Scheduled times without a key | boolean | Nein | Without an STM key, show the scheduled bus times (from the free Transitous service). |
| Other stops and stations (optional) | section | Nein | To watch a stop that is not near your home (work, school…): type its five-digit code, written on the stop sign, or find it with the “Find a bus stop” button at the bottom of this page. |
| Bus stops | string | Nein | Stop codes. Optional route filter after @ and custom name after : — e.g. "52743, 51003@24:Bus to work, 61503@69|469". |
| BIXI stations | string | Nein | BIXI station ids, with an optional custom name after : — e.g. "1, 42:Station at home". |
| Advanced | section | Nein | The defaults suit almost everyone. With an STM key, one read of the bus feed serves every stop: about 2,200 of your 10,000 daily STM requests. |
| Departures refresh interval (s) | number | Nein | How often the bus departures are refreshed, in seconds. |
| Metro refresh interval (s) | number | Nein | How often the metro status is refreshed, in seconds. |
| BIXI refresh interval (s) | number | Nein | How often the BIXI stations are refreshed, in seconds. |
| Departures per stop | number | Nein | How many upcoming departures each stop device exposes as features. |
| Language of the values | select | Nein | Language of the feature names and of the texts published (metro messages, statuses). |
So installierst du STM Montréal in Gladys
- Öffne in Gladys Integrationen: STM Montréal erscheint im Katalog neben den nativen Integrationen, mit einem Community-Badge.
- Klicke auf Installieren. Gladys lädt das Docker-Image (
ghcr.io/lm1lc3n7/gladys-stm:0.2.2) herunter, startet es in einer vom Kern isolierten Sandbox und erzeugt die Oberfläche der Integration (Geräte, Erkennung und Konfiguration). - Öffne den Bildschirm Konfiguration der Integration, fülle die Einstellungen aus und speichere.
- Du kannst sie auch direkt über die URL ihres Repositorys installieren: https://github.com/LM1LC3N7/gladys-stm.
STM Montréal benötigt Gladys >=5.1.0. Der Katalog in Gladys wird stündlich aktualisiert, eine neue Version ist also spätestens eine Stunde nach ihrer Veröffentlichung verfügbar.
Du nutzt Gladys noch nicht? Es ist kostenlos und Open Source: folge der Installationsanleitung, um loszulegen.
Über externe Integrationen
STM Montréal ist eine externe Integration: eine Community-Integration, die als Docker-Container verpackt und auf GitHub veröffentlicht wird. Gladys installiert sie mit einem Klick und führt sie in einer vom Kern isolierten Sandbox aus. Sie wird von LM1LC3N7 veröffentlicht und gepflegt, nicht vom Gladys-Kernteam.
- Alle externen Integrationen durchsuchen
- Die nativen Integrationen entdecken, die in Gladys eingebaut sind
- Deine eigene externe Integration bauen und veröffentlichen
- Quellcode auf GitHub — Quelle dieser Dokumentation