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

Vehicle_position_url required or optional? #17

Closed
nrout-HA opened this issue Jul 6, 2022 · 1 comment
Closed

Vehicle_position_url required or optional? #17

nrout-HA opened this issue Jul 6, 2022 · 1 comment

Comments

@nrout-HA
Copy link

nrout-HA commented Jul 6, 2022

Hi,
While experimenting with the example yamls, I noticed they will break with the following error if the vehicle_position_url is removed. The wiki states that this should be optional. Looking at the code, I'm not sure I'm following why it is breaking...

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 231, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/gtfs_rt/sensor.py", line 78, in setup_platform
    sensors.append(PublicTransportSensor(
  File "/config/custom_components/gtfs_rt/sensor.py", line 97, in __init__
    self.update()
  File "/config/custom_components/gtfs_rt/sensor.py", line 145, in update
    self.data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 280, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/gtfs_rt/sensor.py", line 167, in update
    positions, vehicles_trips, occupancy = self._get_vehicle_positions() if self._vehicle_position_url else {}
ValueError: not enough values to unpack (expected 3, got 0)

For example, this will load, but if removing the vehicle position line, it errors out.

  - platform: gtfs_rt
    trip_update_url: 'https://data.texas.gov/download/rmk2-acnw/application%2foctet-stream'
    vehicle_position_url: 'https://data.texas.gov/download/eiei-9rpf/application%2Foctet-stream'
    departures:
      - name: Downtown to airport
        route: 100
        stopid: 514
@zacs
Copy link
Owner

zacs commented Aug 10, 2022

Fixed in #19

@zacs zacs closed this as completed Aug 10, 2022
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

No branches or pull requests

2 participants