vingerha / gtfs2

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

[FEATURE]: Don't assume 'None' for agency_id when column is missing from route table #19

Closed CityDweller closed 9 months ago

CityDweller commented 9 months ago

I see this entry in my log and it is causing me to miss other issues that may be present:

2024-02-19 18:28:55.982 WARNING (MainThread) [custom_components.gtfs2.sensor] Agency ID 'None' was not found in agency table, you may want to update the routes database table to fix this missing reference

In my case, the agency.txt file has "CATS" as the agency_id value and it is the only entry in the file. The routes.txt file doesn't have a column for agency_id--and I don't believe it is required when there is only a single agency represented--my opinion only.

Can this message be scaled back to maybe only written upon start up of the service?

vingerha commented 9 months ago

The agency is used to select the timezone for the data-set it belongs to and can indeed be missing/incorrect.... I cannot tell why this is the case in your situation as the loading of that info is done by the external pygtfs library (out of my control). At the moment it indeed runs every time when the sensor collects data and I have no 1-time-only setting for that. What I can do is to change the log level to 'debug'. EDIT: I donot really want to create some less simple code-stuff 'just-for-this' :)

CityDweller commented 9 months ago

The agency table is present, it is just the agency_id value doesn't match what is assumed from the routes table what that table doesn't have an agency_id colunn.

If 'debug' can keep the message from showing up twice a minute, that would be great.

vingerha commented 9 months ago

Changed it but will await more changes before creating a new release. If you are in a hurry you can update sensor.py yourselves :)

vingerha commented 9 months ago

Fixed in 035