Home Assistant National Rail Times Card by @crismc
A custom Home Assistant card for the Lovelace theme to show next available trains to specific stops through the National Rail Darwin API. 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 |
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/crismc/homeassistant_nationalrailtimes_lovelace'
- Choose 'Lovelace' as the category
- Add
- Restart your HomeAssistant
- 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 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)