home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.68k stars 30.8k forks source link

Trafikverket Train - Can't add departures "No train found" #100260

Closed rillekille closed 1 year ago

rillekille commented 1 year ago

The problem

When trying to add the departures from Jönköping C to Mullsjö at 16:03 and 16:37 on weekdays it's not possible eventhough they are listed on trafikverket.se. The error message is "No train found". I have a departure from Mullsjö to Jönköping C in the morning that's working as it should.

What version of Home Assistant Core has the issue?

2023.9.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Trafikverket Train

Link to integration documentation on our website

https://github.com/home-assistant/core

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

I don't see any errors regarding trafikverket in the logs.

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @endor-force, @gjohansson-st, mind taking a look at this issue as it has been labeled with an integration (trafikverket_train) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `trafikverket_train` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign trafikverket_train` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


trafikverket_train documentation trafikverket_train source (message by IssueLinks)

Tobbe82 commented 1 year ago

I see the same issue trying to add Kalmar C to Trekanten with HA 2023.9.2

image

Tobbe82 commented 1 year ago

I do believe I found something here, both Mullsjö and Trekanten is smaller stations, not listed in the first view: image But visible once clicked in. Is it so that only stations listed in the first view is addable?

gjohansson-ST commented 1 year ago

I looked into it and the api only provides what is visible on signs etc. so it would not be the full list of stations the train passes. It works if you are departing from them but not the other way around. So you need to select another station or the end-station that's matching what's published so for Trekanten you might want to just select Emmaboda even if that's not where you're going.

Will close this now as there is nothing we can do about it as Trafikverket does not publish the complete data.

Tobbe82 commented 1 year ago

Just a follow-up, would it be possible that the api provides the operator of the train? Like SJ, Krösatåg, Öresundståg? As all departures from kalmar stops in Emmaboda but only Krösatåg stops in Trekanten would be a nice feature to filter out the correct departures

edit: ProductInformation[].Description in the api would do that

gjohansson-ST commented 1 year ago

Not the operator but the product description you can filter on so if you put Krösatågen as the filter you should be able to filter it out. See the documentation

Tobbe82 commented 1 year ago

Not the operator but the product description you can filter on so if you put Krösatågen as the filter you should be able to filter it out. See the documentation

Thanks, I see it mentioned there now, but I really don’t know what to do to get it. To be able to filter on that information. None of my sensors provide the product of the departure. A simple example or screenshot would help me on the way 🙂 is it when creating a new departure sensor in the integration?

gjohansson-ST commented 1 year ago

You can add it as a filter when you set it up or even afterwards by clicking "Configure" on your integration and add the required info

Screenshot from when you set it up image

Tobbe82 commented 1 year ago

Great help, thanks!