transportation.trafiklab.departureBoard

Fetches a public transport departure board from Resrobot (Trafiklab), for the timestamp the screen is being rendered at.

sources:
  bus:
    source: transportation.trafiklab.departureBoard
    params:
      stopId: "740000001"
      direction: "740000002"
      passlist: 0
      accessId: <your Trafiklab API key>

Params

The request’s date/time parameters come from the source’s own timestamp — the render time set by the Runner (or by the CLI’s -t flag, see Designing screens), not from datetime.now() — so a departure board renders “as of” whenever the screen it’s on was rendered, consistent with the rest of that render.

Returns

A list of departure dicts as returned by Resrobot’s Departure array, with each departure’s time (and any Stops.Stop[].arrTime) parsed into datetimes.

{% for departure in source("bus") %}
    <text>{{ departure.time.strftime('%H:%M') }} {{ departure.get('name') }}</text>
{% endfor %}