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

Add support for simple trip query with optional destination ID #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

koenigderorangen
Copy link

This pull request implements a new feature to enhance the Trip Query functionality by allowing an optional destination_id parameter. This parameter filters departures to only show those heading towards the specified destination. The following changes and improvements have been made:

Changes:

  • Added support for destination_id using new API_ENDPOINT_TRIP and CONF_DEPARTURES_DESTINATION_ID
  • Added function fetch_departures_directional and from_dict_dir for changed API request format of trip query

Improvements Needed/Future Work:

  • Additional Information: Implement displaying additional trip information such as the duration of the trip, number of transfers, etc.
  • Currently, only direct trips and the first stop are shown. The destination_id acts primarily as a filter to ignore unnecessary departures.
  • only the next 3 departures are queried

@LordSexy
Copy link

LordSexy commented Oct 4, 2024

Hey.
Just to make things clear "I am super bad at coding and I could get the DVB Plugin setup in the way I wanted! This is not criticism. Im curios and would like to understand this better, to help myself!"

My usecase:
I live near the end of a Tram. When it drives from point A to B, im not interested in the direction to point A, just to point B.

With that out of the way. Firstly I tried to get "directions" running like the original DVB plugin.
But this just crashed the plugin and I could not figure out what I would have to adopt from the BVG plugin "update" this plugin. There are too many commits and was to dumb to do this. I would actually love to also use "walking time" etc. Why cant this be used in the plugin? There are even some lines of code still refering to this function?!?

This PR does not work for me. I entered a destiation_id for tram which starts next to my place and it still showed other busses and trams. So Ill go back to the plugin, but I would love to see, how this would work out.

Cant this function be implemented by the same API @VDenisyuk is using? https://github.com/kiliankoe/vvo/blob/main/documentation/webapi.md#departure-monitor In this documetation the same API can be used for trips and simple requests.

And another idea would be to load e.g. 30 results for the departure at "stop_id" and allow filtering in the lovelace card. The correct destinations are shown in HA, why not using those?

  • check every result; if destination =! point A (and others) -> display,
  • otherwise skip
  • after displaying 10 valid results -> finish

Hope my idea is not too stupid.
I would love to hear your ideas, even if you dont work with them.
I hope I can learn something from this project.
Best wishes,
Lord

@LordSexy
Copy link

LordSexy commented Oct 4, 2024

Or why are we not filtering by platformnumber.

I want bus A from platform 1 and 2, but bus B just from platform 2

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

Successfully merging this pull request may close these issues.

2 participants