When i configure the service "GTFS 2 (General Transit Feed Specification): Collects GTFS Realtime data" to call the url i get
"Failed to call service gtfs2.update_gtfs_rt_local. Unknown error"
In the logs i get:
2024-06-04 09:07:59.781 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script
2024-06-04 09:07:59.782 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service
2024-06-04 09:08:00.354 INFO (SyncWorker_24) [custom_components.gtfs2.gtfs_rt_helper] Ìssues with converting GTFS RT data to JSON, output to string
2024-06-04 09:08:00.358 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: cannot access local variable 'file_all' where it is not associated with a value
Traceback (most recent call last):
File "/config/custom_components/gtfs2/gtfs_rt_helper.py", line 413, in get_gtfs_rt
open(os.path.join(gtfs_dir, file_all), "w").write(json.dumps(feed_entities, indent=4))
^^^^^^^^
UnboundLocalError: cannot access local variable 'file_all' where it is not associated with a value
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
return await long_task
The rt data is not in a proper format, it links to a zip file with a 'bin' in it. The link should be to the actual protobuf or json file having the rt data.... maybe try to search for this in another location ?
Hi,
im pulling the GTFS feed from here: https://gtfs.pro/en/uk/Department-for-Transport-UK/east-midlands-dft
This successfully brings in my local stop data and im able to set up the sensors with schedule data correctly.
However when i try to set up the RT date im encountering an error.
The real time data is provided here "https://data.bus-data.dft.gov.uk/avl/download/gtfsrt"
When i configure the service "GTFS 2 (General Transit Feed Specification): Collects GTFS Realtime data" to call the url i get "Failed to call service gtfs2.update_gtfs_rt_local. Unknown error"
In the logs i get:
2024-06-04 09:07:59.781 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Running websocket_api script 2024-06-04 09:07:59.782 INFO (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Executing step call service 2024-06-04 09:08:00.354 INFO (SyncWorker_24) [custom_components.gtfs2.gtfs_rt_helper] Ìssues with converting GTFS RT data to JSON, output to string 2024-06-04 09:08:00.358 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: cannot access local variable 'file_all' where it is not associated with a value Traceback (most recent call last): File "/config/custom_components/gtfs2/gtfs_rt_helper.py", line 413, in get_gtfs_rt open(os.path.join(gtfs_dir, file_all), "w").write(json.dumps(feed_entities, indent=4)) ^^^^^^^^ UnboundLocalError: cannot access local variable 'file_all' where it is not associated with a value During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 501, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action return await long_task