A custom Home Assistant card for the Lovelace theme to show next available trains to specific stops through the National Rail Darwin API.
Based upon previous work by @crismc (https://github.com/crismc/)
This version adds support for platform numbers and a countdown timer until you need to leave.
To be used with the Home Assistant custom component homeassistant_nationalrailtimes_integration (https://github.com/crismc/homeassistant_nationalrailtimes_integration)
Based on the community driven boilerplate of best practices for Home Assistant Lovelace custom cards (Boilerplate Card by @iantrich https://github.com/custom-cards/boilerplate-card)
Name | Type | Requirement | Description | Default |
---|---|---|---|---|
type | string | Required | custom:nationalrail-times-card |
|
name | string | Optional | Card name based on entity | none |
show_error | boolean | Optional | Show error message such as no service data | true |
show_warning | boolean | Optional | Show station alert messages | true |
show_via_destination | boolean | Optional | Show if train goes via an alternate route | true |
show_callingpoints | boolean | Optional | Show train service calling stops | true |
show_status | boolean | Optional | Show service status (e.g. On Time, Delayed etc) | true |
show_arrival_time | boolean | Optional | Show train service arrival time at destination | true |
show_departure_time | boolean | Optional | Show train service departure time from primary station | true |
show_lastupdated | boolean | Optional | Show when the service last communicated with the API | true |
show_offset | boolean | Optional | Show walking time to station offset | true |
show_offset_countdown | boolean | Optional | Show coundown until you need to leave calculated from walking time to station | true |
show_platform | boolean | Optional | Show platform number train is due to leave from | true |
entity | string | Optional | Home Assistant entity ID. | none |
The easiest way to install this frontend card is to install via HACS:
- Simply go to HACS in your Home Assistant
- Select 'Frontend'
- In the top right of the screen, select the 3 dots and choose 'Custom repositories'
- For the repository field enter 'https://github.com/dabc24/homeassistant_nationalrailtimes_lovelace'
- Choose 'Dashboard' as the type
- Add
- Restart your Home Assistant
- Explore & Download Repositories (depending on your version of Home Assistant)
- Search for 'National Rail Departure Times'
- Enjoy
Clone the repository to your machine
Install necessary modules (verified to work in node 8.x)
yarn install
or npm install
Do a test lint & build on the project. You can see available scripts in the package.json
npm run build
Copy content of <project_dir>/dist to your Home Assistant instance /www/nationalrailtimes-card If directories do not exist, create them.
Go to Settings > Dashboards, click the three dots menu in the top right and select Manage Resources. If you do not have the three dots, you will need to temporarily enable "Advanced Mode" within Profile
Choose "Add Resource" and enter the following: URL: /local/nationalrailtimes-card/nationalrailtimes-card.js Resource Type: JavaScript Module
If you created the /www directory, restart Home Assistant (Developer Tools > Restart)