Coder Social home page Coder Social logo

swiss-public-transport-card's Introduction

Lovelace Swiss Public Transport Card

Custom card for the Swiss Public Transport integration for Home Assistant Lovelace UI.

swiss-public-transport-card

⚠️ The card currently needs a swiss-public-transport integration still in development (see home-assistant/core#30715).

Installation

  1. Download and copy swiss-public-transport-card.js from this repository into your config/www directory.

  2. Add a reference to swiss-public-transport-card.js inside your ui-lovelace.yaml or at the top of the raw config editor UI:

  resources:
  - type: js
    url: 'https://unpkg.com/[email protected]/min/moment.min.js'
  - type: js
    url: /local/swiss-public-transport-card.js?v=0.0.1

Using the card

Make sure you have an Swiss public transport stationboard sensor setup as follows:

- platform: swiss_public_transport
  name: Zürich Hardbrücke
  limit: 6
  stationboard:
  - Zürich Hardbrücke, Bahnhof
  - Zürich Hardbrücke

Add a manual card with the following configuration to your Lovelace UI:

type: 'custom:swiss-public-transport-card'
entity:
  - sensor.zurich_hardbrucke

Card options

The card has the following additional options:

  • entity (mandatory): the entity name of the sensor providing stationboard entries.

  • departure_countdown: time in minutes before departure when a remaining time value is displayed. Use 0 to disable remaining time display. Default: 15

  • show_last_changed: Show when the sensor last changed its data

  • show_seconds: Show remaining time with second accuracy

Troubleshooting

Check "States" in Developer Tools if your entity name is correctly setup. Also make sure the backend was able to fetch departures (verify that Objects are in the departures attribute).

If the card sometimes is not displayed on first load and/or your browsers JavaScript console displays ReferenceError: moment is not defined errros, make sure to include moment.js first. You might also try to download it locally into your conf/www directory and reference it as follows:

  resources:
  - type: js
    url: /local/moment.min.js?v=2.22.2

Supporting Development

BMC

swiss-public-transport-card's People

Contributors

agners avatar

Stargazers

Lukas Bauer avatar  avatar Colin Avrech avatar  avatar RogueThorn avatar  avatar François Bianco avatar Jeremy Seitz avatar wapishoper avatar Stef avatar  avatar

Watchers

James Cloos avatar  avatar

swiss-public-transport-card's Issues

Hide departures in a certain time window in the future.

Over here I have a relatively lengthy walk to the train station closest to me (displayed in the stationboard at home). 9 minutes to be exact.

I would like an option to hide all departures right after now until 9 minutes from now, since I know for a fact I will not be catching these trains no matter how hard I try, so why show them?

Thanks.

Configuration Problems

I've setup the sensors listed below.
The To/From sensor works, but the Stationboard sensor never appears in HA. I can configure the card and use the From/To sensor without error, but it doesn't display any information.

I'd like to have a card that shows the next X departures from Y to Z and if there are any delays. In the future Id also like to have an alert if a train is delayed in a normal commute. Is this possible with these plugins? What am I missing since the Stationboard example no longer works?

sensor:

  • platform: swiss_public_transport
    name: Zürich Hardbrücke
    limit: 6
    stationboard:
    • Zürich Hardbrücke, Bahnhof
    • Zürich Hardbrücke

sensor:

  • platform: swiss_public_transport
    from: Y (actual stops taken out for privacy)
    to: Z
    name: Y-Z

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.