Closed mguaylam closed 1 day ago
Hi, as per the documentation the default API key header is "Authorization". According to the swagger file published by STM on their developer portal (extract below) the API key header needs to be "apiKey".
"securityDefinitions" : {
"portal_api_key" : {
"in" : "header",
"name" : "apiKey",
"type" : "apiKey"
}
},
Please add the following line to your configuration
api_key_header: 'apiKey'
I completely missed that. Thank you so much for your support.
Hey there! Thank you for maintaining this repository. I'm trying to migrate from https://github.com/zacs/ha-gtfs-rt but I seem to have issues doing so. I get this error which I did not with the previous project using the STM API :
Here's my configuration :
Here's my setup :
Here's my log
```BASH 2024-10-20 20:34:50.076 INFO (SyncWorker_1) [custom_components.gtfs_rt.sensor] trip_update_url: https://api.stm.info/pub/od/gtfs-rt/ic/v2/tripUpdates 2024-10-20 20:34:50.076 INFO (SyncWorker_1) [custom_components.gtfs_rt.sensor] vehicle_position_url: https://api.stm.info/pub/od/gtfs-rt/ic/v2/vehiclePositions 2024-10-20 20:34:50.076 INFO (SyncWorker_1) [custom_components.gtfs_rt.sensor] route_delimiter: None 2024-10-20 20:34:50.077 INFO (SyncWorker_1) [custom_components.gtfs_rt.sensor] header: {'Authorization': 'X'} 2024-10-20 20:34:50.130 ERROR (SyncWorker_1) [custom_components.gtfs_rt.sensor] Updating vehicle positions got: 400: b'Invalid API Key' 2024-10-20 20:34:50.131 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 361, in _async_setup_platform await asyncio.shield(awaitable) File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/gtfs_rt/sensor.py", line 115, in setup_platform PublicTransportSensor( File "/config/custom_components/gtfs_rt/sensor.py", line 162, in __init__ self.update() File "/config/custom_components/gtfs_rt/sensor.py", line 228, in update self.data.update() File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 184, in wrapper result = method(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/gtfs_rt/sensor.py", line 305, in update self._get_vehicle_positions() File "/config/custom_components/gtfs_rt/sensor.py", line 437, in _get_vehicle_positions feed_entities = get_gtfs_feed_entities( ^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/gtfs_rt/sensor.py", line 146, in get_gtfs_feed_entities feed.ParseFromString(response.content) google.protobuf.message.DecodeError: Error parsing message ```Thank you for your help and for this integration.