National Rail Integration

In HACS I installed Lovelace HTML Jinja2 Template card and working now!

Thanks for your help!

Now I need to find an integration that will show me bus departures from stops near my house.

This is on my list to make. There is an goverment API for it, just havent gotten around to it. May have a look this weekend.

TFL also provide bus details 9n their API if youre in London.

1 Like

Hi @osalj

There’s a great API you can use if you are in Oxfordshire.

I made a quick and dirty integration for it a while back

I think I need to add one file to make it available in HACS. Maybe tonight

1 Like

Yes Im in London

I’m getting this error when I try to use this git, when i add the integration I get ā€˜unexpected error’ after pasting in the token and stations. - GitHub - plutomedia987/homeassistant_nationalrail

 File "/config/custom_components/nationalrailuk/client.py", line 384, in async_get_data
    raise NationalRailClientException("unexpected data from api") from err
custom_components.nationalrailuk.client.NationalRailClientException: unexpected data from api

@jfparis maybe we can expand on this one together or I can create a custom card for you?

David, please take this one over to my thread.

yes sure.

I want to add the HACS file when I have a moment and rework the config flow to enable bus stop lookup

There is a good existing London TFL integration here

I have combined that with this National Rail integration to make my departure board from my local train station (Putney) to Waterloo and also the buses from my nearest stop. It looks like this:

2 Likes

Their configuration workflow is way better (where I would like mine to be)

I’m using the HASL card (from HACS) with the London TFL integration. This works, but I can get the bus numbers or train station platform number to display. Are you able to advise on how you did this or share your code please?

I’m using the HASL card (from HACS) with the London TFL integration. This works, but I can get the bus numbers or train station platform number to display. Are you able to advise on how you did this or share your code please?

To clarify: the screenshot I posted is a custom stack-in-card, which has two parts:

  1. Top half: uses this topic’s National Rail Integration for my local train station (SWR) and my own hacked up html-template-card to show the trains, platforms etc. [just, saying this as you asked about train platforms]

  2. Bottom half: uses the TFL integration for my local bus stop and the HASL departure card. I have nothing fancy in the code, but I do recall having to play about with the sensor in the TFL integration and API to get the right sensor [in my case the sensor was under the 337 bus route, rather than any of the other bus routes]. Anyway the HASL card code is here if it helps:

      - type: custom:hasl-departure-card
        header: true
        departures: true
        deviations: false
        timeleft: true
        updated: false
        name: Departures
        adjust_times: false
        hide_departed: false
        language: en-EN
        entities:
          - sensor.london_tfl_337_490011287e

Thanks skinnypope

Trying to ad the latest HASL card. But cant seem to get the Bus numbers to display.at all. Even when trying your code above.

Wonder if anyone has any ideas what I could be doing wrong?
Example below

image

OK I just tried the new upgraded card you are using and get the same result. So the answer is to use the old one (for now)

@skinnypope What version of the card are you using that works for you? I’m using HA 2025.1.1. when downgrading to the lower version of the card the add on addon fails to load in HACS. Just wonders if this was a HA compatibility thing maybe with the older card?

v2.6.2 of the HASL card is the one that works for me

First time posting here, but i was looking to practice making custom cards and this seemed like a good project to start with. I think some of the other cards here are better than mine, but i hope at least a few people can make use of my version as i do. I’m keen to improve it too or maybe roll in some of the other variants/cards that people have made.

3 Likes