Unable to setup integration with Transperth GTFS feed
adub08 opened this issue · comments
I have been having issues getting the custom integration to function with my local GTFS feed, which is Transperth (link below). I found the link through transitfeeds.com, which reports that the GTFS feed is working completely fine. I've tried several variations of quotations around the route and stopid. My guess is maybe Transperth is producing a slightly non-standard GTFS feed? Although it's possible I'm just doing something wrong. Any help appreciated.
System config:
Home Assistant OS 6.4 (running in a VM)
supervisor-2021.10.0
core-2021.10.3
configuration.yaml:
- platform: gtfs_rt
trip_update_url: 'http://www.transperth.wa.gov.au/TimetablePDFs/GoogleTransit/Production/google_transit.zip'
departures:
- name: "30BusToCity"
route: PAT-KAL-2706
stopid: 11862
- name: "31BusToCity"
route: PAT-KAL-2707
stopid: 11862
Errors in log:
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 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/gtfs_rt/sensor.py", line 61, in setup_platform
sensors.append(PublicTransportSensor(
File "/config/custom_components/gtfs_rt/sensor.py", line 80, in __init__
self.update()
File "/config/custom_components/gtfs_rt/sensor.py", line 125, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 277, in wrapper
result = method(*args, **kwargs)
File "/config/custom_components/gtfs_rt/sensor.py", line 146, in update
self._update_route_statuses(positions)
File "/config/custom_components/gtfs_rt/sensor.py", line 161, in _update_route_statuses
feed.ParseFromString(response.content)
File "/usr/local/lib/python3.9/site-packages/google/protobuf/message.py", line 199, in ParseFromString
return self.MergeFromString(serialized)
File "/usr/local/lib/python3.9/site-packages/google/protobuf/internal/python_message.py", line 1128, in MergeFromString
if self._InternalParse(serialized, 0, length) != length:
File "/usr/local/lib/python3.9/site-packages/google/protobuf/internal/python_message.py", line 1178, in InternalParse
raise message_mod.DecodeError('Field number 0 is illegal.')
google.protobuf.message.DecodeError: Field number 0 is illegal.
I think you need to use the API endpoint of your provider, not the zip. For instance mine is https://api.stm.info/pub/od/gtfs-rt/ic/v2/
I think you need to use the API endpoint of your provider, not the zip. For instance mine is https://api.stm.info/pub/od/gtfs-rt/ic/v2/
@thi-baut is correct. I'm currently looking at using transit.land as my source for Transperth, but I'm yet to get it working.
Closing as zip files aren't supported (hence the protobuf error). Unfortunately it looks like the Transperth feed on transit.land is GTFS only, not GTFS-RT.