Giter Site home page Giter Site logo

ha-gtfs-rt's People

Contributors

augs avatar buckbanzai avatar corneels avatar inthedaylight14 avatar kapji avatar phardy avatar raman325 avatar tdickman avatar xe138 avatar zacs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-gtfs-rt's Issues

NYCT GTFS stopped working after recent update

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.

Unable to set up with NYC MTA or Austin feeds, entities not created

I am trying to configure gtfs_rt f6f260c on Home Assistant 2022.4.0, running on Home Assistant OS. I don't see any integration, device or entity getting created, and don't see any relevant messages in the debug logs. What am I doing wrong?

My config is copy-pasted from the README for troubleshooting:

logger:
  logs:
    custom_components.gtfs_rt: debug
sensor:
  - platform: gtfs_rt
    trip_update_url: "https://api-endpoint.mta.info/Dataservice/mtagtfsfeeds/nyct%2Fgtfs-bdfm"
    x_api_key: (my key from https://api.mta.info/#/AccessKey)
    departures:
      - name: "Brooklyn F"
        route: "F"
        stopid: "F16S"

The log entries containing that look relevant are:

2022-04-06 23:53:23 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.gtfs_rt
2022-04-06 23:53:28 DEBUG (MainThread) [homeassistant.bootstrap] Integration remaining: { […] 'sensor.gtfs_rt': 4.80698, […]}
2022-04-06 23:53:40 DEBUG (MainThread) [homeassistant.helpers.translation] Cache miss for en-GB: binary_sensor.hassio, input_number, binary_sensor.ble_monitor, sensor.gtfs_rt, weather, input_datetime, media_player, sensor.thermal_comfort
2022-04-06 23:53:41 DEBUG (SyncWorker_0) [homeassistant.util.json] JSON file not found: /config/custom_components/gtfs_rt/translations/sensor.en-GB.json
2022-04-06 23:53:41 DEBUG (SyncWorker_6) [homeassistant.util.json] JSON file not found: /config/custom_components/gtfs_rt/translations/sensor.en.json
2022-04-06 23:54:10 DEBUG (MainThread) [homeassistant.bootstrap] Integration setup times: {[…] 'gtfs_rt': 8.659741, […]}
2022-04-06 23:54:39 DEBUG (MainThread) [custom_components.hacs] <Integration zacs/ha-gtfs-rt> Getting repository information
2022-04-06 23:54:43 DEBUG (MainThread) [custom_components.hacs] <Integration zacs/ha-gtfs-rt> Running checks against master

I have:

  • verified manually with curl that my api key and trip update url are valid.
  • setting the trip_update_url to an URL I control, to make sure that the http requests are being made.
  • setting the config to the Austin, Texas example in the README
  • Trying the gtfs_realtime_pb2 example code to make sure it can get trip_updates from both the Austin and the NYC feeds
  • I am not sure what to do next. Puzzled, really.

See following departures

Hello!

Would it be possible to have multiple entities for one route/stop combination to show the next and following departure? This is very useful for "I won't make the train coming in 2 minutes, but I will make the one coming in 10 minutes."

There could possibly be an offset options that is 0 by default but will show the following arrival when set to 1 or the third arrival when set to 2.

Question or Issue ? attrib naming

Hi, I am retuning on this one as my provider now finally (!) uses the protobuf format.
However, I see some attribute issues with me wrt to gtfs, stop_id became stopId, stop_time_update became stopTimeUpdate, etc.
Would you possibly know if this is a local choice, e.g. could it be that the French provider uses his own attrib names?

I am asking because I would like to try to align your work with what I have but not sure if this is provider-specific.
Alternative is that I just convert the protobuf to a json and people can work from there on

Installation with Docker container doesn't want to co-operate #Beginner

Hello,
I'd like to ask your advice how to get this running with HA Docker container.
I've listed details from my setup below.

The ERROR I can't get solved is
'ERROR (MainThread) [homeassistant.components.homeassistant] Platform error sensor.gtfs_rt - Integration 'gtfs_rt' not found.'

Files in my container

bash-5.0# ls -la /config/custom_components/gtfs_rt
total 20
drwxrwxrwx 2 1000 10000 4096 Dec 12 18:43 .
drwxrwxr-x 5 1000 10000 4096 Dec 12 17:41 ..
-rwxrwxrwx 1 1000 10000 0 Dec 12 18:11 init.py
-rwxrwxr-x 1 1000 1000 262 Dec 12 18:43 manifest.json
-rwxrwxrwx 1 1000 10000 7213 Sep 29 08:46 sensor.py
bash-5.0#

Part of my configuration.yaml

sensor:
  - 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

System Health

version 2020.12.1
installation_type Home Assistant Container
dev false
hassio false
docker true
virtualenv false
python_version 3.8.6
os_name Linux
os_version 5.4.0-91-generic
arch x86_64
timezone Europe/Helsinki

Please, any recommendations how can I solve this mystery?

Montréal STM agency only publish partial updates

The Montréal agency (STM) only publish partial updates in their GTFS-RT feed.

Consequence: some trips will disappear in an update and reappear in the next one.
After talking to their data analyst, they do this to make the API lighter, they will only publish data that has changed in the source system (I find this explanation hard to believe as I found the updates quite arbitrary). But this has the effect of trips disappearing for short times since it does not retain trips and start with a clean sheet when pulling new data.

Here’s the effect observed :
next trip --> the trip after --> next trip --> the trip after
Here’s a visual representation :
image

How can we handle this issue? Would it be by retaining trips?
Thank you for your help.

Not working for (French based) region

For the departures, I tried with/out quotes, error remains

HA 2022.09
gtfs_rt : latest
Config:

  - platform: gtfs_rt
    trip_update_url: "https://www.data.gouv.fr/fr/datasets/r/0261a9ae-4874-4d87-8a92-6ae1c9fa68c7"
    departures:
    - name: Stop 530 Test RT
      route: LR530|20181213
      stopid: STOPPOINT:00812

Error without quotes in 'departures'

Error while setting up gtfs_rt platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, 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 168, in update
    self._update_route_statuses(positions, vehicles_trips, occupancy)
  File "/config/custom_components/gtfs_rt/sensor.py", line 184, in _update_route_statuses
    feed.ParseFromString(response.content)
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/message.py", line 202, in ParseFromString
    return self.MergeFromString(serialized)
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/internal/python_message.py", line 1128, in MergeFromString
    if self._InternalParse(serialized, 0, length) != length:
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/internal/python_message.py", line 1181, in InternalParse
    (data, new_pos) = decoder._DecodeUnknownField(
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/internal/decoder.py", line 961, in _DecodeUnknownField
    (data, pos) = _DecodeUnknownFieldSet(buffer, pos)
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/internal/decoder.py", line 940, in _DecodeUnknownFieldSet
    (data, pos) = _DecodeUnknownField(buffer, pos, wire_type)
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/internal/decoder.py", line 965, in _DecodeUnknownField
    raise _DecodeError('Wrong wire type in tag.')
google.protobuf.message.DecodeError: Wrong wire type in tag.

Error with quotes

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, 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 168, in update
self._update_route_statuses(positions, vehicles_trips, occupancy)
File "/config/custom_components/gtfs_rt/sensor.py", line 184, in _update_route_statuses
feed.ParseFromString(response.content)
File "/usr/local/lib/python3.10/site-packages/google/protobuf/message.py", line 202, in ParseFromString
return self.MergeFromString(serialized)
File "/usr/local/lib/python3.10/site-packages/google/protobuf/internal/python_message.py", line 1131, in MergeFromString
raise message_mod.DecodeError('Unexpected end-group tag.')
google.protobuf.message.DecodeError: Unexpected end-group tag.

Optional route configuration variable

Thanks for developing this component.

I'm trying to retrieve the next departure for a stop, regardless of route. This is for a train station served by 6 routes. At the moment I have to create 6 sensors (1 per route) in the destination list, and create a template sensor in HA to determine the next departure.

Would it be possible to make the route configuration variable optional? Or alternatively, allow a single destination to accept an array of routes?

Unable to setup integration with Transperth GTFS feed

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.

Cleanup Old Entities

Hello,

It seems that if you rename a sensor, then the old one is not removed.

Thanks!

Montreal Metro

Hi,

i'm using your application for Montreal Bus & Metro. For buses it is working perfetly, but i have hard time with metro. I can't get any information.

please find my config below:

sensor:

could you please let me know what i'm doing wrong?

thank you,

Laurent

Vehicle_position_url required or optional?

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

Google protobuf decode error

I am receiving an error google.protobuf.message.DecodeError: Error parsing message. This is my first time setting up ha-gtfs-rt and have not had it working before. I followed the steps in the readme and tried adding information for Pittsburgh. Below is my config and log.

Config:

- platform: gtfs_rt
  trip_update_url: "https://truetime.portauthority.org/gtfsrt-bus/trips?debug"
  vehicle_position_url: "https://truetime.portauthority.org/gtfsrt-bus/vehicles?debug"
  departures:
    - name: "61A to Pitt"
      route: "61A"
      stopid: 7233

Log:

2023-11-15 09:25:38.904 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration gtfs_rt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-15 09:25:38.905 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration icloud3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-15 09:25:38.905 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-15 09:25:38.906 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration frigate which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-11-15 09:25:41.922 ERROR (MainThread) [homeassistant.components.sensor] gtfs_rt: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 959, in async_device_update
    await hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/gtfs_rt/sensor.py", line 141, in update
    self.data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/gtfs_rt/sensor.py", line 156, in update
    positions, vehicles_trips, occupancy = self._get_vehicle_positions() if self._vehicle_position_url else [{}, {}, {}]
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/gtfs_rt/sensor.py", line 214, in _get_vehicle_positions
    feed.ParseFromString(response.content)
google.protobuf.message.DecodeError: Error parsing message
2023-11-15 09:25:47.078 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for spare-esp @ 10.69.69.220: Error connecting to ('10.69.69.220', 6053): [Errno 113] Connect call failed ('10.69.69.220', 6053) (SocketAPIError)
2023-11-15 09:26:25.492 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode 'xy' received for entity light.porch_light

Train Time Adding 240 After Updating Home Assistant

I just updated Home Assistant (running on a RPi 4 in a Docker container) from 2022.6 to 2022.10 and it looks like right when I did that, the entity is returning the number of minutes until the train arrives + 240? (ex. if a train is scheduled in 5 minutes, it will show 245).
Screenshot 2022-10-11 183256

Edit: It seems like the issue has gotten worse, with the Next Due At times completely breaking and not returning accurate times at all. I tried deleting and readding all of the sensors and updating the custom component all to no avail - am I the only one with this issue?

Unique id support?

Is it possible to add support for unique IDs to this so that we can assign the sensor to an area using the UI?

Protobuf parsing error

I'm struggling to track down an error with the integration using Auckland Transport's GTFS-RT feed. This API is provided by free of charge (account registration required) by Auckland Transport, who recently revamped their API portal and started offering GTFS V3. However, I noticed I need to provide V2 feeds to this integration, which AT also provides under the legacy/ path.

I've been trying to set up a sensor for a ferry route using the following config:

- platform: gtfs_rt
  trip_update_url: 'https://api.at.govt.nz/realtime/legacy/tripupdates?tripid=514-96011-39600-2-91e07bcd,514-96012-54300-2-f085c4f3'
  headers:
    Cache-Control: none
    Ocp-Apim-Subscription-Key: !secret at_api_key
  departures:
    - name: Hobsonville to Downtown
      route: "HOBS-209"
      stopid: "21779-d98fae38"

But it appears to be failing at parsing the protobuf response:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 938, in async_device_update
await hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gtfs_rt/sensor.py", line 141, in update
self.data.update()
File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
result = method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/gtfs_rt/sensor.py", line 157, in update
self._update_route_statuses(positions, vehicles_trips, occupancy)
File "/config/custom_components/gtfs_rt/sensor.py", line 173, in _update_route_statuses
feed.ParseFromString(response.content)
google.protobuf.message.DecodeError: Error parsing message

I can get the results manually through Insomnia:

{
	"status": "OK",
	"response": {
		"header": {
			"timestamp": 1696387755.058,
			"gtfs_realtime_version": "1.0",
			"incrementality": 0
		},
		"entity": [
			{
				"id": "7012303965-20230928120550_v106.29",
				"trip_update": {
					"trip": {
						"trip_id": "514-96012-54300-2-f085c4f3",
						"start_time": "15:05:00",
						"start_date": "20231004",
						"schedule_relationship": 3,
						"route_id": "HOBS-209",
						"direction_id": 1
					},
					"timestamp": 1696384892,
					"delay": 0
				},
				"is_deleted": false
			}
		]
	},
	"error": null
}

Logging is already set to debug for this component. What other info can I gather to help me diagnose this?

Update of sensor is taking over 10 seconds

Hello,

I'm trying to setup the gtfs-rt for the first time in my HA.
It can obviously fetch some data from the API but the information it shows is late

  • I have checked the system time is correct
  • it shows 'due at' and 'next bus' time stamps correctly but 'due at' is in history
  • 'due in' is always +/- 60 min though the line has bus every +/- 10 min.

Log shows me following warning

WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.570_at_airport is taking over 10 seconds

sensor config

sensor:
  - platform: gtfs_rt
    trip_update_url: 'https://realtime.hsl.fi/realtime/trip-updates/v2/hsl'
    vehicle_position_url: 'https://realtime.hsl.fi/realtime/vehicle-positions/v2/hsl'
    departures:
    - name: "570 at airport"
      route: 4570
      stopid: 4530259

Any idea how to fix this? All ideas would be appreciated.

FR: support trip update feeds that only specify delay but not time

The spec for StopTimeEvent says it can contain delay and/or time. The feed I'm trying to integrate only specifies the delay, and it seems ha-gtfs-rt only looks at the time.

Presumably, ha-gtfs-rt would need to load the base/static GTFS in conjunction with the GTFS RT feed in this situation.

For reference, the base/static GTFS I'm looking at is https://www.rtl-longueuil.qc.ca/CMS/MediaFree/file/GTFS/20230821.zip. An API token for the GTFS RT feed can be obtained by requesting one here (free), after which the feed will be at https://opendata.exo.quebec/ServiceGTFSR/TripUpdate.pb?token=<token>&agency=RTL.

Error after upgrading to Release 2023.4.5 - Protocol Buffers Error?

After upgrading to 2023.4.5 I am getting the following error in my home-assistant.log file.

2023-04-18 11:56:23.726 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 304, 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 190, 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 [{}, {}, {}]
  File "/config/custom_components/gtfs_rt/sensor.py", line 220, in _get_vehicle_positions
    from google.transit import gtfs_realtime_pb2
  File "/usr/local/lib/python3.10/site-packages/google/transit/gtfs_realtime_pb2.py", line 50, in <module>
    _descriptor.EnumValueDescriptor(
  File "/usr/local/lib/python3.10/site-packages/google/protobuf/descriptor.py", line 796, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Prior to this it has been working without issue. I have not changed my gtfs_rt configuration at all. I just noticed that sensors that normally are populated with realtime data do not exist.

Following the link at the bottom of the message indicates changes with Python Updates of Protocol Buffers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.