Bouni / abfallplus

AbfallPlus component for Home Assistant
MIT License
13 stars 1 forks source link

[Request] Support for Abfallkalender Landkreis Göttingen (Niedersachsen) #10

Open uherting opened 2 years ago

uherting commented 2 years ago

Is it possible to add support for the Abfallkalender Landkreis Göttingen (Niedersachsen)?

https://www.abfallplus.de/fuer-buerger/ states "Kreis Göttingen wird unterstützt".

I tried to find out the parameters with the help of the proxy app "postman" and the recommended Android App from https://www.abfallplus.de/, but failed so far.

uherting commented 2 years ago

BTW: I filed the same request for the other HA integration at https://github.com/mampfes/hacs_waste_collection_schedule/issues/230 .

The method of how to extract seem to be outdated or not available. If I get any hint how to extract the needed parameters I (software engineer and Linux user) am more than willing to work on this. So far I could not get them from the traffic generated by the Android app though.

Bouni commented 2 years ago

Unfortunately I never found a semi automatic way for getting the parameters. I also attempted to reverse the Android app but without any luck (would be nice if you could figure that out 🤩)

For the parameters you must search for the Abfall Kalender of your municipality and extract the parameters from there using the developer tools of your browser:

https://www.landkreisgoettingen.de/themen-leistungen/abfall-entsorgung/abfallwirtschaft-goettingen/beratung-und-entsorgung/abfallkalender

Hope that helps!

uherting commented 2 years ago

The Landkreis Göttingen has two keys: One for its core (the city and towns around it) and another for the former Landkreis Osterode which got merged into the Landkreis Göttingen. The URL you provided would have been great to analyse the old core, but does not help me as I need the other key and parameters.

I used the program "Postman" which can act as a proxy. I could intercept the HTTP traffic and from what I got I failed to get the HTTPS traffic where the Android app communicates. The problem was likely that a certificate needs to be installed in order to use Postman 100%.

Which tools did you use?

Bouni commented 2 years ago

It seems that "Landkreis Göttingen" is using Abfall.io, they are listet on their website:

image

But "Stadt Göttingen" GEB Göttingen / Göttinger Entsorgungsbetriebe don't! They are not listed and their website does not feature the usual dropdown for area selection.

Where did you get th einfo that GEP is using Abfall.io?

I tried to decompile the Android App but it seems that is kind of ofuscated and I never took the time to analyze the traffic due to the lack of a setup taht allows me to inject a SSL cert in order to decrypt the HTTPS traffic ...

If we could get that traffic analyzed, that would be awesome but I fear that the underlaying requests are as fucked up as that what they use via the websites. They use arbitrary IDs which to look like database indexes for the lookup of data. I asked them a few years ago for API access and they declined. That smells like the do not have a real API and they put their service togehther from Stackoverflow copy & pastes 😆

uherting commented 2 years ago

You are right, there is no support by Abfall.io for the entire Landkreis! There was a misunderstanding on my side which is explained in the "long story".

As I live in the area of "Abfallwirtschaft Altkreis Osterode am Harz" I am interested to analyse the traffic by the app with postman. The main problem is likely the HTTPS certificate within postman.

Short story about the support(in case TL;DR): Abfall.io supports only "Abfallwirtschaft Altkreis Osterode am Harz" (via app) and towns near Göttingen via a webpage. The city of Göttingen is not supported at all by Abfall.io.


Here the long story:

Proof of no support for the entire Landkreis: The result of the "Verfügbarkeit prüfen" test on the webpage https://www.abfallplus.de/fuer-buerger/ gives a different impression on first glance. There you can check it whether an app is availabe for your Landkreis. After selecting "Niedersachen" and Göttingen one gets the feedback "Ergebnis: Kreis Göttingen wird unterstützt" plus buttons with links to the app store and google play. The google play link is https://play.google.com/store/apps/details?id=de.k4systems.lkgoettingen . After registering and removing my location I could only select "Abfallwirtschaft Altkreis Osterode am Harz" for the location of a new "Standort" which is not the same at all as promised on the "Verfügbarkeit prüfen" page.

Interface for towns near Göttingen: https://www.landkreisgoettingen.de/themen-leistungen/abfall-entsorgung/abfallwirtschaft-goettingen/beratung-und-entsorgung/abfallkalender . This provides a webpage where one can select towns which are located in the Landkreis Göttingen but are not located in the area of Abfallwirtschaft Altkreis Osterode am Harz. The page connects to api.abfall.io and the key plus other parameters are visible in the network traffic.

The city of Göttingen The city of Göttingen has got an UI at https://www.geb-goettingen.de/index.php?id=29 which is not supported by Abfall.io.

Bouni commented 2 years ago

Thanks for your detailed feedback!

I currently work on a config flow that allows easy setup of this component. At the moment It works by pasting the URL of the waste management website that shows the drop down but I think I'll go for a curated list of URLs that lets a user choose his Bundesland + city and from there gets the rest of the data via the API ...

ottosax commented 10 months ago

Any news about this?

Bouni commented 10 months ago

No, had no time to look into this any further. As always PRs are highly appreciated 😅