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

[Bug]: Realtime update for local stops with query string authentication raises error #122

Open
1 task done
filmkorn opened this issue Jan 21, 2025 · 5 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@filmkorn
Copy link

filmkorn commented Jan 21, 2025

Own Analysis

  • I cannot find my issue in the documentation

A clear and concise description of what the bug is.

I'm trying to setup local stops realtime information through the query string. (Since I'm getting 403 error when I try to provide the API key via the header).

Image

This raises a TypeError on my end:

...
File "/config/custom_components/gtfs2/coordinator.py", line 205, in _async_update_data
self._vehicle_position_url = self._vehicle_position_url + "?" + options[CONF_API_KEY_NAME] + "=" + options[CONF_API_KEY]
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

From my minimal understanding of the code, the _vehicle_position_url is not used for the location based departures, thus it may be None in the config entry.

Apologies if I missed something in the docs.

Provide details on the data source(s)

https://gtfs-static.translink.ca/gtfs/History/2025-01-17/google_transit.zip
https://gtfsapi.translink.ca/v3/gtfsrealtime

Config in case of setup using start / stop station

Config in case of setup using location based departures

49.28704505614792, -123.1269839692587
bus stops

Info on your installed version

gtfs2: 0.5.5
HA type: docker

Relevant log output

2025-01-21 05:29:43.452 ERROR (MainThread) [custom_components.gtfs2.coordinator] Unexpected error fetching 01JJ3JH1BDP9S6SJDHMDJKWF90 data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 379, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/gtfs2/coordinator.py", line 205, in _async_update_data
    self._vehicle_position_url = self._vehicle_position_url + "?" + options[CONF_API_KEY_NAME] + "=" + options[CONF_API_KEY]
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
2025-01-21 05:29:43.457 ERROR (MainThread) [homeassistant.helpers.entity_platform] gtfs2 raises exception ConfigEntryNotReady in forwarded platform sensor; Instead raise ConfigEntryNotReady before calling async_forward_entry_setups
@filmkorn filmkorn added the bug Something isn't working label Jan 21, 2025
@vingerha
Copy link
Owner

Cannot reproduce, please add a screenshot of the realtime setup of this entity

@vingerha
Copy link
Owner

Forget it... looked at the wrong setup, I will fix it

@vingerha vingerha self-assigned this Jan 21, 2025
@filmkorn
Copy link
Author

Thanks Arjan for taking a look! I've added a screenshot.

@vingerha
Copy link
Owner

Please check release https://github.com/vingerha/gtfs2/releases/tag/0.5.6b1

@filmkorn
Copy link
Author

Works!

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