alex-jung / home-assistant-vgn-component

Home Assistant custom component to get information about VGN departures like Bus, Train etc.
MIT License
1 stars 0 forks source link
custom-component home-assistant homeassistant homeassistant-integration vgn-nuremberg

"VGN Departures" integration

hacs_badge Static Badge GitHub Release GitHub Downloads (all assets, all releases) GitHub License Static Badge Static Badge

This integration provides information about next departure(s) for different transport types like Bus, Train, Tram etc. in Verkehrsverbund Großraum Nürnberg (VGN)

The GTFS data used in this integration is provided by VGN Open Data.

The currently release uses only static time plans extracted from GTFS files. Implementation of real time departures (e.g. via REST-API) is ongoing and will be available first in releases greater 2.0.0


Installation

HACS Installation (recommended)

HACS integration is ongoing!

Until it's finished you can install the integration by adding this repository as a custom repository in HACS, and install as normal.

Manual Installation

  1. Using the tool of choice open the directory (folder) for your HA configuration (where you find configuration.yaml).
  2. If you do not have a custom_components directory (folder) there, you need to create it.
  3. In the custom_components directory (folder) create a new folder called vgn_departures.
  4. Download all the files from the custom_components/vgn_departures/ directory (folder) in this repository.
  5. Place the files you downloaded in the new directory (folder) you created.
  6. Restart Home Assistant

Configuration

Start integration dialog

The configuration of integration is made via Home Assistant GUI

  1. Open Settings / Devices & services
  2. Click on Add Integration button
  3. Search for VGN Departures
  4. Click on integration to start configuration dialog

Configure a new station

Integration will load all available stations from GTFS data source.

NOTE: if your station is not present in the station list, integration will unfortunately not work

Start enter your station name in field to reduce the list and then choose station you are interesting in from the list:\ image

In the next step you can select directions splitted by transport types and trip names: image

As result new sensor(s) will be created: image

Reconfigure an entry

The directions you choosen in the previous step can be reconfigured via GUI: image

Here you can remove obsolete directions or add new by selection them in dialog.

Usage in dashboard

Option 1 (show departure time)

Add a custom template sensor in your configuration.yaml

sensor:
  - platform: template
    sensors:
      furth_197:
        friendly_name: 'Fürth Hauptbahnhof - Bus 179 - Fürth Süd(only time)'
        value_template: "{{ (as_datetime(states('sensor.furth_hauptbahnhof_bus_179_furth_sud'))).strftime('%H:%m') }}"

Add entity (or entites) card to your Dashboars(don't forget to reload yaml before)\

type: entities
entities:
  - entity: sensor.furth_197
    name: Fürth Hauptbahnhof - Bus 179 - Fürth Süd
    icon: mdi:bus

image

Option 2 (with time-bar-card)

To get more fancy stuff, you can use e.g. time-bar-card to visualize remaining time to next departure: yaml conifuguration:

type: custom:timer-bar-card
name: Abfahrten Fürth-Hbf
invert: true
entities:
  - entity: sensor.furth_hauptbahnhof_u_bahn_u1_furth_hardhohe
    bar_width: 30%
    name: U1 - Hardhöhe
    guess_mode: true
    end_time:
      state: true
  - entity: sensor.furth_hauptbahnhof_bus_179_furth_sud
    bar_width: 30%
    name: 179 - Fürth Süd
    guess_mode: true
    end_time:
      state: true

Result looks like there:\ ezgif-3-136a167cd5

Option 3 (vgn-departures-card)

Development is ongoing