vingerha / gtfs2

Support GTFS in Home Assistant GUI-only
https://github.com/vingerha/gtfs2
MIT License
65 stars 4 forks source link

Sensor becoming unavailable when adding RT updates #65

Closed Sheepish2 closed 2 months ago

Sheepish2 commented 2 months ago

Describe the bug Finally got it working with an SQLite issue. My issue here now is that any RT info that I would like to enter into the system will update the sensor for it to become available. It may be the links I am using but these are provided by the developers.

image

URL Trip Data: https://gtfs.adelaidemetro.com.au/v1/realtime/trip_updates URL Veh Pos: https://gtfs.adelaidemetro.com.au/v1/realtime/vehicle_positions URL Alerts: https://gtfs.adelaidemetro.com.au/v1/realtime/service_alerts

Steps/data to reproduce the behavior, e.g.

Release used Main and latest Home Assistant

Additional Logger: custom_components.gtfs2.coordinator Source: helpers/update_coordinator.py:315 integration: GTFS 2 (General Transit Feed Specification) (documentation, issues) First occurred: 11:50:00 AM (1 occurrences) Last logged: 11:50:00 AM

Unexpected error fetching 9d58c5a1802150e1ee33b170a5673874 data: name 'err' is not defined Traceback (most recent call last): File "/config/custom_components/gtfs2/coordinator.py", line 159, in _async_update_data self._get_rt_alerts = await self.hass.async_add_executor_job(get_rt_alerts, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/gtfs2/gtfs_rt_helper.py", line 309, in get_rt_alerts if entity.HasField("alert"): ^^^^^^^^^^^^^^^ AttributeError: 'dict' object has no attribute 'HasField'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 315, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/gtfs2/coordinator.py", line 166, in _async_update_data raise UpdateFailed(f"Error in getting start/end stop data: {err}") ^^^ NameError: name 'err' is not defined

other log below

Logger: custom_components.gtfs2.coordinator Source: custom_components/gtfs2/coordinator.py:165 integration: GTFS 2 (General Transit Feed Specification) (documentation, issues) First occurred: 11:50:00 AM (1 occurrences) Last logged: 11:50:00 AM

Error getting gtfs realtime data, for origin: redacted for privacy with error: 'dict' object has no attribute 'HasField'

Sheepish2 commented 2 months ago

If it helps, There is also a curl link to each of these

curl -X GET "https://gtfs.adelaidemetro.com.au/v1/realtime/vehicle_positions" -H "accept: application/x-google-protobuf"

Sheepish2 commented 2 months ago

Update - Just adding trip updates is giving real time info, I'm specifically aiming for vehicle locations. *** Further Update - Testing with only trip updates works but also adding vehicle location updates will "unavailable" the entity. Cheers!

vingerha commented 2 months ago

Fixed in 0.4.5.2 ... please note that for Alerts I have only been able to do very basic testing as it is quite a job to first find one and then tie it to a stop-in-use....