zacs / ha-gtfs-rt

Real-time transit information for Home Assistant
MIT License
69 stars 29 forks source link

NYCT GTFS stopped working after recent update #18

Closed Madelena closed 2 years ago

Madelena commented 2 years ago

A few days ago the plugin stopped working for NYCT GTFS after updating.

Here's my settings:

- platform: gtfs_rt
  trip_update_url: "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs"
  x_api_key: <my api key>
  scan_interval: 60
  entity_namespace: gtfs_mta_subway
  departures:
    - name: "Times Sq (Northbound)"
      route: "7"
      stopid: "725N"
    - name: "Times Sq (Southbound)"
      route: "7"
      stopid: "725S"

And here's the error:

2022-07-10 08:21:09 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up gtfs_rt platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/gtfs_rt/sensor.py", line 78, in setup_p…ne 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 192, 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)

I tried grabbing the GTFS file manually, it works fine: nyct-gtfs.txt So I don't think it's my API key or the feed.

Madelena commented 2 years ago

I think it's the same bug as #17

chintito4ever commented 2 years ago

I'm also getting same error. Is there any fix for this?

Logger: homeassistant.components.sensor Source: custom_components/gtfs_rt/sensor.py:167 Integration: Sensor (documentation, issues) First occurred: 8:52:17 PM (1 occurrences) Last logged: 8:52:17 PM

Error while setting up gtfs_rt platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform await asyncio.shield(task) File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, 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 192, 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)

atrain2009 commented 2 years ago

New to Github, so apologies if I'm not crediting someone appropriately, but another user submitted a Commit to a similar issue here that fixes the issue. I had been having the same issue and went into the sensor.py file and made the adjustment (adding three sets of {} where there is currently only one) and that fixed the issue for me.

chintito4ever commented 2 years ago

Thank you. It worked!

zacs commented 2 years ago

Yes, thank you to the community for solving the issue, and apologies for missing the PR when it was submitted. It has been merged. Also @Madelena love your dashboards!