akloeckner / hacs-hafas

Port of kilimnik's HAFAS client for HACS
4 stars 1 forks source link

Bring HAFAS to HACS #1

Open akloeckner opened 1 year ago

akloeckner commented 1 year ago

Hey @kilimnik,

I felt so free to take your work from https://github.com/home-assistant/core/pull/78839 and cast it into a very preliminary HACS repository. You should be able to add this custom repository (https://github.com/akloeckner/hacs-hafas) to HACS (following this guide) and create a working Deutsche Bahn sensor (yeay): grafik

However, I found a severe issue, that I wouldn't want to discuss in the HA PR. I noticed that my local Kölner Verkehrsbetriebe (KVB) was not available as a profile. So, I investigated how to add it as a profile. And it seems, that requires changing the pyhafas library. Which has several open PRs, partly dating way back to 2021. So, I got the feeling that this library might not be really maintained anymore. Even if it is maintained, every new company would require a code change. Do you think, that will be usable by the regular HA user?

Then again, if you think, that is doable, we could be close to having a working HACS integration. :-) Maybe polish the readme, fix some minor bugs on the way and advertise. ;-)

kilimnik commented 1 year ago

Oh, wow. I will check this out. Thank you for the work

I saw that the library is not greatly maintained. Unfortunately it's the best/only one out there. It would be possible to write the integration to use all the profiles, the library supports. But I am not sure, if that's needed. Most Trains and Busses in Germany are also queryable via the DB profile. I haven't seen any that are not.

akloeckner commented 1 year ago

Most Trains and Busses in Germany are also queryable via the DB profile.

Yes, that's a good argument. It will be sufficient for most users to just use the DB interface. In my case, I have noticed that DB is not as up-to-date as the local app is. But that might be an edge case. Which I should be able to fix with a single new profile.

I saw that the library is not greatly maintained.

Maybe, that will change once the user base becomes bigger through your integration. ;-)

enjoysimpson commented 1 year ago

Great work! I was able to install the integration via HACS. But unfortunatly, when trying to add a connection, I only get a message "unknown". I tried it with different towns (e.g. Berlin to Hannover) and the DB profile. Do I miss anything? image

akloeckner commented 1 year ago

That's maybe something @kilimnik can help with. I remember to have seen a "non-speaking" error message like that, too. Then, I spelled the stations differently and it worked. So, I guess the "unknown" refers to the station name?

akloeckner commented 1 year ago

@kilimnik, I have invited you as an collaborator. But if you feel this project should live in your account, let's migrate it. I'm fine with either location.