Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is National Rail integration not working? #31

Open
mohakkataria opened this issue Jul 24, 2024 · 6 comments
Open

Is National Rail integration not working? #31

mohakkataria opened this issue Jul 24, 2024 · 6 comments

Comments

@mohakkataria
Copy link
Contributor

I see the sensor as "None" with occasional value as Cannot reach TFL

Screenshot 2024-07-24 at 2 36 38 PM

These are the logs:

Logger: custom_components.london_tfl.sensor
Source: custom_components/london_tfl/sensor.py:184
integration: London TfL ([documentation](https://github.com/morosanmihail/HA-LondonTfL), [issues](https://github.com/morosanmihail/HA-LondonTfL/issues))
First occurred: 11:25:21 AM (8 occurrences)
Last logged: 1:51:50 PM

There was no reply from TfL servers.
@morosanmihail
Copy link
Owner

Yeah, not sure if thameslink would count as part of TfL. I have found that many stations show up in the api, but do not have any realtime data. But it should not be None, that hints at a connection problem to the TfL servers. They are quite finnicky.

@mohakkataria
Copy link
Contributor Author

I think the data is available but at different endpoint for Elizabeth, national-rail and overground https://api.tfl.gov.uk/swagger/ui/index.html?url=/swagger/docs/v1#!/StopPoint/StopPoint_ArrivalDepartures

e.g. the station I was looking at : https://api.tfl.gov.uk/StopPoint/910GLBGHJN/ArrivalDepartures?lineIds=thameslink but if you try to find it in the arrivals URL: https://api.tfl.gov.uk/Line/thameslink/Arrivals/910GLBGHJN?direction=all, it returns empty

@morosanmihail
Copy link
Owner

Ah, I see! So thameslink operates more like a Bus than an underground train. I might have some time later this week to explore, but I don't think it's too difficult to fix.

@mohakkataria
Copy link
Contributor Author

Awesome. Thanks so much :) I wish I had time otherwise I would raised an MR already. But thanks thanks so much. :)

@morosanmihail
Copy link
Owner

Sadly, said 'some amount of time' has disappeared, but was still able to take a look this morning.

So I'll document what I found out for future me, or any future someone else.

Buses use /StopPoint/<>/Arrivals.
Thameslink (and maybe other lines) need /StopPoint/<>/ArrivalDepartures?lineIds=<>.
Which is obviously different from /Line/<>/Arrivals/<>.

So it's not as simple as turning "is_bus" into checking if line is part of a new const that would start with ["bus", "thameslink"]. and needs a bit more attention.

@benmarriner20
Copy link

I would be so grateful if someone with much more technical nouse than me could take up the challenge of making the National Rail arrivals work. I'm on a Southeastern line and getting this into Home Assistant would be a game changer for my morning routine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants