Integración domótica STM Montréal, gratuita y de código abierto

Next STM bus departures, metro line status and BIXI stations in Montréal.
La documentación de esta integración la escribe su autor y, por ahora, solo está disponible en inglés.
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.
Parámetros de configuración
Estos son los parámetros que STM Montréal te pide en su pantalla de configuración en Gladys.
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| Get started in 2 minutes | section | No | 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 | No | 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 | No | |
| BIXI stations near my home | number | No | |
| Real time and metro (optional) | section | No | 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 | No | The key of your application on the STM developer portal (the shared secret is not needed). |
| Watch the metro | boolean | No | Creates a "STM metro" device with the status of the green, orange, yellow and blue lines. |
| Scheduled times without a key | boolean | No | Without an STM key, show the scheduled bus times (from the free Transitous service). |
| Other stops and stations (optional) | section | No | 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 | No | Stop codes. Optional route filter after @ and custom name after : — e.g. "52743, 51003@24:Bus to work, 61503@69|469". |
| BIXI stations | string | No | BIXI station ids, with an optional custom name after : — e.g. "1, 42:Station at home". |
| Advanced | section | No | 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 | No | How often the bus departures are refreshed, in seconds. |
| Metro refresh interval (s) | number | No | How often the metro status is refreshed, in seconds. |
| BIXI refresh interval (s) | number | No | How often the BIXI stations are refreshed, in seconds. |
| Departures per stop | number | No | How many upcoming departures each stop device exposes as features. |
| Language of the values | select | No | Language of the feature names and of the texts published (metro messages, statuses). |
Cómo instalar STM Montréal en Gladys
- En Gladys, abre Integraciones: STM Montréal aparece en el catálogo junto a las integraciones nativas, con una insignia de comunidad.
- Haz clic en Instalar. Gladys descarga la imagen Docker (
ghcr.io/lm1lc3n7/gladys-stm:0.2.2), la ejecuta en un entorno aislado del núcleo y genera la interfaz de la integración (dispositivos, descubrimiento y configuración). - Abre la pantalla de Configuración de la integración, rellena los parámetros y guarda.
- También puedes instalarla directamente desde la URL de su repositorio: https://github.com/LM1LC3N7/gladys-stm.
STM Montréal requiere Gladys >=5.1.0. El catálogo de Gladys se actualiza cada hora, así que una nueva versión está disponible como máximo una hora después de publicarse.
¿Todavía no usas Gladys? Es gratuito y de código abierto: sigue la guía de instalación para empezar.
Sobre las integraciones externas
STM Montréal es una integración externa: una integración comunitaria empaquetada como contenedor Docker y publicada en GitHub. Gladys la instala con un clic y la ejecuta en un entorno aislado del núcleo. La publica y mantiene LM1LC3N7, no el equipo principal de Gladys.
- Explorar todas las integraciones externas
- Descubrir las integraciones nativas incluidas en Gladys
- Crear y publicar tu propia integración externa
- Código fuente en GitHub — fuente de esta documentación