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

"No Data" for station with "?hafas=1" #8

Closed
BagelBeef opened this issue Jan 21, 2025 · 1 comment
Closed

"No Data" for station with "?hafas=1" #8

BagelBeef opened this issue Jan 21, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@BagelBeef
Copy link

The problem

First of all. Thank you for creating a successor to ha-deutschebahn.

This is my first time reporting an issue on GitHub and I'm an absolute beginner in programming.

It seems that some stations need an additional information in the url "?hafas=1".
(For example: https://dbf.finalrewind.org/Frankenforst%20Kippekausen,%20Bergisch%20Gladbach.json?hafas=1)

Otherwise this error comes up:

Data fetched successfully: {'api_version': '1.98', 'error': 'Ambiguous station name'}

What version of Home Assistant Core has the issue?

2025.1.2

What version of this Integration has the issue?

2025.01.0

What type of installation are you running?

Home Assistant OS

Example YAML snippet

Anything in the logs that might be useful for us?

2025-01-21 22:09:16.057 DEBUG (MainThread) [custom_components.db_infoscreen] Coordinator initialized for station Frankenforst Kippekausen, Bergisch Gladbach with update interval 3 minutes
2025-01-21 22:09:16.057 DEBUG (MainThread) [custom_components.db_infoscreen] Fetching data for station: Frankenforst Kippekausen, Bergisch Gladbach
2025-01-21 22:09:16.058 DEBUG (MainThread) [custom_components.db_infoscreen] Url: https://dbf.finalrewind.org/Frankenforst Kippekausen, Bergisch Gladbach.json?hafas=1
2025-01-21 22:09:16.165 DEBUG (MainThread) [custom_components.db_infoscreen] Data fetched successfully: {'departures': [{'delay': 0, 'destination': 'Bensberg, Bergisch Gladbach', 'direction': 'Bensberg, Bergisch Gladbach', 'isCancelled': None, 'messages': [], 'platform': None, 'route': [], 'scheduledPlatform': None, 'scheduledTime': 1737493680, 'time': 1737493680, 'train': 'STR 1', 'trainNumber': '54187', 'via': []}, {'delay': 0, 'destination': 'Weiden West, Köln', 'direction': 'Weiden West, Köln', ...
2025-01-21 22:09:16.166 DEBUG (MainThread) [custom_components.db_infoscreen] Finished fetching DB Info Frankenforst Kippekausen, Bergisch Gladbach data in 0.108 seconds (success: True)
2025-01-21 22:09:16.166 DEBUG (MainThread) [custom_components.db_infoscreen.sensor] Setting up DBInfoSensor for station: Frankenforst Kippekausen, Bergisch Gladbach
2025-01-21 22:09:16.166 DEBUG (MainThread) [custom_components.db_infoscreen.sensor] DBInfoSensor initialized for station: Frankenforst Kippekausen, Bergisch Gladbach
2025-01-21 22:09:16.166 DEBUG (MainThread) [custom_components.db_infoscreen.sensor] Sensor added to Home Assistant for station: Frankenforst Kippekausen, Bergisch Gladbach
2025-01-21 22:09:16.166 DEBUG (MainThread) [custom_components.db_infoscreen.sensor] Listener attached for station: Frankenforst Kippekausen, Bergisch Gladbach
2025-01-21 22:09:16.166 WARNING (MainThread) [custom_components.db_infoscreen.sensor] No data received for station: Frankenforst Kippekausen, Bergisch Gladbach

Additional information

I edited the init.py like this because it seems to me, that the information "hafas=1" doesn't cause any errors on urls which do not really need it in the first place:

if data_source == "MVV": url += f"?efa=MVV" if "?" not in url else "&efa=MVV" elif data_source == "ÖBB": url += f"?hafas=ÖBB" if "?" not in url else "&hafas=ÖBB" else: url += f"?hafas=1" if "?" not in url else "&hafas=1"

And I added an extra logger line for checking the url.

But still "no data"...

@FaserF
Copy link
Owner

FaserF commented Jan 22, 2025

I have fixed it, will be working with release 2025.01.2
I plan to release it today evening or tomorrow with some more improvements and fixes.

@FaserF FaserF added the bug Something isn't working label Jan 22, 2025
@FaserF FaserF self-assigned this Jan 22, 2025
@FaserF FaserF closed this as completed Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants