Skip to main content

Entur smart home integration, free and open source

Entur integration for Gladys Assistant

Next departures in Norway (train, metro, tram, bus, ferry), delays, cancellations and disruptions.

Next departures of your public transport stops in Norway in Gladys: trains, metro, trams, buses, coaches and ferries, with delays, cancellations and traffic messages, in real time.

The data comes from Entur, the national registry of all Norwegian public transport operators (Vy, Ruter, Skyss, AtB, Kolumbus…), through its open APIs: no account and no key. This integration is not affiliated with Entur.

What you get​

  • A device per watched stop (optionally filtered by lines, direction or transport mode): next departure and following departure (minutes), delay of the next departure (minutes), its line and destination (text), and whether a traffic message touches its departures (yes/no).
  • A dashboard widget with the next departures of a stop: time, minutes, delay, cancelled departures in red, traffic messages on top.
  • Four scene triggers: time to leave, departure delayed, departure cancelled, new disruption.
  • A scene action that reads the next departures of a stop, with a sentence ready to send by message or speaker.

Requirements​

  • Gladys Assistant 5.1.0 or later.
  • Internet access from the Gladys host (the integration calls api.entur.io).
  • A stop in Norway. Entur covers the whole country; it does not cover the other Nordic countries.

Installation​

  1. In Gladys, open Integrations → Install from GitHub.
  2. Paste https://github.com/guim31/gladys-entur and install.
  3. Open the integration's Configuration tab.

Configuration​

Settings​

  • Language of the texts: language of the feature names (set when a device is created), of the scene sentences and of the traffic messages when Entur publishes them in that language. Entur writes its messages in Norwegian and often in English: a message without the chosen language is shown in English, else in Norwegian. Norwegian is not offered as an interface language.
  • Refresh interval: 30 seconds, 1 minute (default) or 2 minutes. All the created devices are read in a single request.

Adding a stop​

  1. Find a stop: type a name (Jernbanetorget, Bergen busstasjon…). The answer lists the matching stops with their identifier, NSR:StopPlace:58366 for example.
  2. Add a stop: paste the identifier (or the number alone, or the exact name when it is unique). Optional filters:
    • Lines: L1, R13 keeps only these lines (as written on the vehicle).
    • Direction: Ski keeps only the departures whose destination contains this text (accents and case ignored, lillestrom matches Lillestrøm).
    • Mode: train, metro, tram, bus, coach or ferry, for the large hubs.
  3. Open the Discover tab and add the device to Gladys.

The same stop with other filters makes another device: add Oslo S towards Ski and Oslo S towards Drammen to follow both directions. Up to 20 stops can be watched.

Removing a stop, checking the state​

  • Remove a stop: type its name as shown by the status (Oslo S (L1)) or its identifier. Its device stays in Gladys until you delete it.
  • Show what is watched: the stops, whether their device exists, the last read from Entur and the last error.

Devices​

FeatureTypeContent
Next departureduration (min)minutes before the next departure that runs (0 = leaving now)
Following departureduration (min)minutes before the one after
Delayduration (min)delay of the next departure (0 when on time or early)
Line and destinationtextL1 → Spikkestad
Disruptionbinary (yes/no)a traffic message touches the departures of the device

Cancelled departures are skipped by the countdowns. With no departure in the next 24 hours, the countdowns show 1440 minutes. Only the departures kept by the filters count.

Dashboard widget​

Next departures: choose a stop. The widget shows its next eight departures (line, destination, expected time, minutes, delay): green when the vehicle is tracked in real time, orange when two minutes late or more, red when cancelled, grey for a timetable time. The caption shows the traffic messages of the stop.

Scene triggers​

Each trigger can be limited to a stop and to a line (as written on the vehicle, upper case).

  • Time to leave: a departure leaves in the chosen number of minutes (1 to 20). Fires once per departure, when its countdown reaches the number. A departure first seen inside the window does not fire.
  • Departure delayed: a departure is late by the chosen number of minutes or more (1 to 60). Once per departure and threshold.
  • Departure cancelled: a departure is cancelled. Once per departure.
  • New disruption: a new traffic message touches the departures of a stop. Once per message.

Variables passed to the scene: stop, line, mode, destination, platform, scheduled and expected times, minutes, delay; for a disruption, its summary and details. What is already there when the integration starts is not announced; cancellations and messages already announced are not announced again after a restart.

Scene actions​

Read the next Entur departures: choose a stop, optionally a line. Outputs: a sentence (Train L1 to Spikkestad at Oslo S: in 3 and 18 min), the stop, line, destination, minutes to wait, minutes to the following one, delay, expected time, platform, real time (1/0), disruption (1/0). The sentence follows the language of the configuration.

Scene examples​

  • Leave for the train: trigger "Time to leave", stop Oslo S (L1), 7 min → send "Your L1 leaves in {{minutes}} min from platform {{platform}}" and blink the hall light.
  • Morning briefing: at 7:00 on weekdays, action "Read the next Entur departures" → send its sentence to the kitchen speaker.
  • Warn of a cancelled bus: trigger "Departure cancelled", stop Jernbanetorget (31) → send a message with the destination and the scheduled time.

Data, refresh and quotas​

Entur's APIs are free and open (NLOD licence). Entur asks every client to identify itself: the integration sends the ET-Client-Name: guim31-gladys header and reads all your stops in a single request, every 30 seconds at the most, and only for the devices created in Gladys. The data is the operators' real time when they publish it, else their timetable.

Troubleshooting​

  • No device in Discover: add the stop first, with "Add a stop".
  • "Entur cannot be reached": the Gladys host has no internet access, or Entur is down. The integration retries at each refresh and says when it is back.
  • A line filter is refused: the answer lists the lines that serve the stop; type the line as written there.
  • A trigger does not fire: check the line (exact, upper case) and that the device exists in Gladys: only created devices are read.

Limits​

  • Developed without living in Norway, against the real Entur API: feedback welcome.
  • Feature names are set when the device is created.
  • Traffic messages are in Norwegian and often English, never translated.
  • Departures are read for the next 24 hours: the next 40 of the stop's lines and mode (Entur filters them), 100 with a direction filter. At a busy hub without filter, 40 departures may cover only half an hour.

Credits​

Data: Entur, NLOD licence. Inspired by the Home Assistant entur_public_transport integration (Apache 2.0) and by the gladys-tisseo and gladys-gtfs integrations.

Configuration settings​

These are the settings Entur asks for in its configuration screen in Gladys.

SettingTypeRequiredDescription
How it workssectionNoFind your stops with the actions below, add them (with an optional line, direction or mode filter), then create their devices in the Discover tab. Everything comes from Entur open data: no account, no key.
Language of the textsselectNoLanguage of the feature names, of the sentences sent to your scenes and of the traffic messages when Entur has them in it (else English, else Norwegian). Feature names are set when a device is created.
Refresh intervalselectNoHow often the departures of your created devices are read: one request for all of them.

How to install Entur in Gladys​

  1. In Gladys, open Integrations: Entur appears in the catalog, next to the native integrations, with a community badge.
  2. Click Install. Gladys pulls the Docker image (ghcr.io/guim31/gladys-entur:1.0.0), starts it in a sandbox isolated from the core, and generates the integration's interface (devices, discovery and configuration).
  3. Open the Configuration screen of the integration, fill in the settings, and save.
  4. You can also install it directly from its repository URL: https://github.com/guim31/gladys-entur.

Entur requires Gladys >=5.1.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​

Entur 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 guim31, not by the Gladys core team.

Subscribe to the Gladys Assistant newsletter

A few emails per month about new releases and project news. Sent by Pierre-Gilles Leymarie, founder of the project. Unsubscribe anytime 🙂