Recent days I worked on a Swiss Public Transport Card for the Home Assistant Lovelace UI. The card currently can display departures in a stationboard style:
At this point the card pretty much does what I wanted it to do. I am not entirely happy with the styling yet (e.g. the platform looks somewhat lost on the left corner). Ideas/feedback welcome!
There is some unique behavior with the backend/API: Zürich Hardbrücke (like most train station) are two stations in the transport.opendata.ch API, one for the Bus/Tram stop and one for the train stop. That is why I had to add stationboard as a list, so one can add both stations. The HA integration makes for each station an API request, combines the departures and sorts them by time. For each station the next 5 (or whatever limit is configured) departures get fetched. The problem with that approach is if the two stations have departures at different intervals it leads to a bit uneven stationboard (e.g. buses of the next 5 minutes are displayed but trains of the next 30 minutes…). It’s not a huge issue, just somewhat unfortunate.
I was also thinking to add support for the connection mode (maybe displaying similar to how Google Maps Direction mode does). Let me know what you think.
This looks very good! Will try this as soon as the other commits are merged. Currently the Swiss Transport API skips the next train even though the departure time has not passed yet, should be in 0.104.
Removed the dependency of moment.js as it seem to cause problems
HACS installation possible
TODO:
localize some strings
test delay visualization (doesn’t work?)
The final goal should be a proper update of the current swiss_public_transport sensor. So feel free to do a merge request again or to improve your own implementation.
Does anyone have a problem aswell with the lovlace showing (+1) on every Scheduled train?
It hits red and changes if the train is delayed, but if a train isnt. i have on every line this (+1).
Just configure it to your liking, click “Monitor in neuem Fenster anzeigen”, copy the URL from the pop up window and use this in a webpage card in lovelace.