Transport NSW Troubleshooting

I am using the Transport NSW configuration. I have tried looking at the Transport NSW thread here but I was not able to determine what if anything I am doing wrong. I have added a configuration to get a the next train to add to my dashboard. I have tried using the following three blocks of code (not all at the same time)

- platform: transport_nsw
  name: Next train
  stop_id: "201710"
  destination: "Central Station"
  route: "Airport & South Line"
  api_key: !secret trip_planner_api

- platform: transport_nsw
  name: Next train
  stop_id: "201710"
  destination: "Central Station"
  api_key: !secret trip_planner_api

- platform: transport_nsw
  name: Next train
  stop_id: "201710"
  route: "Airport & South Line"
  api_key: !secret trip_planner_api

I also posted this question in the Transport NSW / Sydney Bus, Ferry and Train schedule thread, however the thread no longer seems active.

If there is anyone who can help me debug this I would greatly appreciate it.

I only get n/a response on the module. I have tried looking at the API itself, however, the API doesn’t seem to work in the same way as the module (there must be something in the module that converts or something maybe)

Thank you in advanced for any assistance you can provide!

I just did a little bit of debugging of the library and its API call:

  • If you do not specify route or destination then the library will only check the first entry of the response and if the departure time is not in the future (which often appears to be the case for the first 1-2 entries), then the entry is discarded, and no other entries are checked. That is probably a bug in the library.
  • The route apparently needs to include the number, i.e. in your case “T8 Airport & South Line”.
  • And the destination needs to be an exact match of the final destination, not the destination you are actually going to. For example, the results just now contained “City Circle via Museum” or “Revesby via Airport” or “Macarthur via Airport” as their destinations.
2 Likes

Thank you @exxamalte

I was able to get this up and running. For anyone looking for similar the end result I got was

- platform: transport_nsw
  name: Next Train
  stop_id: "201710"
  route: "T8 Airport & South Line"
  api_key: !secret trip_planner_api

I then used this to compile a list of all the destination options for the direction I was trying to create for

1 Like