Skip to content

Latest commit

 

History

50 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hacs_badge

swiss-stationboard

Custom lovelace card for Home Assistant Lovelace UI.
Swiss public transport stationboard. Shows connections from one or multiple stations.

Stationboard "Schüpfen"

Information

Warning: Requires https://github.com/neuhausf/swiss-public-transport-mod to be installed first.
Note that the current implementation is based on https://pypi.org/project/python-opendata-transport/ which currently doesn't return delays (property is there, but the underlying API-call to transport.opendata.ch may not always provide them).

Configuration

Add a new custom card to your Dashboard:

type: custom:swiss-stationboard
name: Abfahrt
hide_title: true
platform_filter: 21
category: B|^ICE$|S
destination_filter: Bern|Zürich
max_rows: 6
name_replacement:
  Aeroporto: Airprt
  Malpensa: Malp
platform_name: Gl.
entity:
  - sensor.schupfen

Card settings

  • name: overrides the friendly_name inferred from the corresponding entity. Used as title.
  • departure_offset: optional number of minutes (defaults to 0). Hides next departures within this window.
  • departure_countdown: optional minutes (defaults to 15). Departures in this window show a countdown.
  • show_seconds: show seconds in the countdown when true.
  • entity: the sensor (from swiss-public-transport-mod) used as data source.
  • hide_title: hides the card title when true.
  • vertical_title: forces a small, vertical title on the left side of the card. The vertical title is also applied, if the card is smaller than 400px (horizontally).
  • name_replacement: replace destination names (see examples below).
  • category: optional regex to filter by category (e.g. B|^ICE$|S).
  • platform_filter: optional regex to filter platforms (e.g. 3|21).
  • show_last_changed: shows when the underlying data last changed.
  • minutes_label: string for minutes in ETA (defaults to min/ mins).
  • seconds_label: string for seconds in ETA (defaults to ).
  • line_colors: mapping to override the line background color per line. Keys are the displayed line text (e.g. S3, IR68) or regex-keys written as strings starting and ending with / (for example /^S\\d+/). Values are CSS colors (#RRGGBB, rgb(), color names). Only background-color is overridden; other styles remain.
  • destination_filter: optional regex to filter by destination. Can be a single regex string (e.g. Bern|Zürich) or a list of regex strings (e.g. ["Bern", "Zürich", "^Basel"]). If a list is provided, a connection matches when any entry matches.
  • max_rows: optional number (defaults to 0). Limits the number of rows shown (0 = unlimited).

Short example:

type: 'custom:swiss-stationboard'
entity: sensor.sbb_stationboard_<id>
destination_filter:
  - Bern
  - Zürich
  - "^Basel"
max_rows: 8
line_colors:
  S3: "#1E90FF"
  IR68: "#FF8800"
  "/^S\\d+/": "#2d327d"

Text replacement

Exact text replacement

Replaces occurrences in the destination name (e.g., journey.to). Matching is literal.

type: custom:swiss-stationboard
name: Departures
hide_title: true
platform_filter: 21
category: B|^ICE$|S
platform_name: Pl.
name_replacement:
  Aeroporto: Airprt
  Malpensa: Malp
entity:
  - sensor.schupfen

Advanced format: list of replacement rules

Also supported as a list of rules (ordered):

name_replacement:
  - from: Aeroporto
    to: Airprt
  - from: Malpensa
    to: Malp

Notes

  • Replacements are applied globally (all occurrences).
  • Matching is case-sensitive by default.

Privacy

This integration uses:

About

Swiss public transport stationboard for Home Assistant dashboard

Resources

Stars

11 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors