mampfes / hacs_waste_collection_schedule

Home Assistant integration framework for (garbage collection) schedules
MIT License
988 stars 631 forks source link

[Feature]: Add "Ammerland" or "Rastede" for Germany #1878

Open Acanis87 opened 6 months ago

Acanis87 commented 6 months ago

I propose a feature for:

Sources

Describe your wanted feature

Hey, Iam from Rastede in Germany and we have a service for showing the timings (https://www.appfuhr.de/) and there is an app (https://play.google.com/store/apps/details?id=com.vanrueschen.awbammerland). So there might be an API, too...

I couldnt find it in the sources you already support. And I did hear, that you could help someone with adding a new source :)

So I give it a shot ^^ Thank you! :)

5ila5 commented 6 months ago

The website returns an PDF which we generally do not parse. The app gets its data from https://firebasestorage.googleapis.com/v0/b/abfall-ammerland.appspot.com/o/and%2F5%2Fawbapp.json?alt=media

But I'm not quite sure how to correctly assemble this to a source yet. Needs further investigation

Acanis87 commented 6 months ago

Oh, that was a fast answer! I didn't even think anyone would really take a closer look at it. And it's amazing that you can even trace the source and get a JSON that way...

It would be cool if you could get to it at some point and add to it! :) Thank you!

z-master42 commented 6 months ago

The app generates an .ics file which you can then import into your existing calendar.

Acanis87 commented 6 months ago

Hey, yeah. Thats the way we do it. But we were looking for an api solution, so we dont have to do that manually. :)

sascha-hemi commented 4 months ago

Hey, a few months ago i also was looking for an Integration for Ammerland. I also found the Firebase Link as @5ila5

I think i know partially how to assemble it. For Example:


The first lines are the various Streets:

    {
        "id": 327,
        "ortid": 5,
        "bez": "Ammerlandallee",
        "abc": "A",
        "cstrgr": 2,
        "castgr": 1
    },

ID: ID of Street ortid: ID of City (3 for Edewecht and 5 for Westerstede for example) bez: Name of the Street abc: First letter of Streetname cstrgr: castgr:


If you choose for example the Ammerlandallee in Westerstede. Then the Waste Collection is splitted in two halfs (nördl.d. A28 and südl.d. A28). Therefor there are entrys like this:

    {
        "id": 9,
        "strid": 327,
        "grenze": "nördl.d. A 28"
    },
    {
        "id": 10,
        "strid": 327,
        "grenze": "südl.d. A 28"
    },

id: is the "strgrid" that you should look for strid: same as in the "first block" -> ID of Street grenze: i think you should now know what that meens.

So if you look for an entry with strid 327 then you find two entrys. One with "strgrid: 9" and one with "strgrid: 10" this correlates with ID in the "grenze" entrys.

    {
        "id": 1979,
        "strid": 327,
        "strgrid": 9,
        "resttag": 5,
        "restgu": true,
        "vier": true,
        "biotag": 5,
        "biogu": false,
        "werttag": 4,
        "wertgu": false,
        "papier": 2,
        "jahr": 18
    },
    {
        "id": 1980,
        "strid": 327,
        "strgrid": 10,
        "resttag": 4,
        "restgu": false,
        "vier": false,
        "biotag": 4,
        "biogu": true,
        "werttag": 4,
        "wertgu": false,
        "papier": 3,
        "jahr": 18
    },

So the first entry here is for "nördlich der A28" and the second entry is for "südlich der A28" on Ammerlandallee. Now you know, how to find your Street with ID and so on....


Now the tricky part, where i dont know everything... Lets start with "Altpapier":

From the Entrys above at "nördlich der A28" there is an entry for Papier that says 2. In the JSON you can find something like this:

    {
        "datum": "2024-05-28",
        "gu": false,
        "vier": true,
        "papier": 2
    },

That means all streets with entry "papier: 2" got their Altpapier collected on 2024-05-28 for Example. I dont know what the other entries at this date mean.


Now "Bioabfall", "Restabfall" and "Gelber Sack": resttag = "Restabfall" biotag = "Bioabfall" werttag = "Gelber Sack"

In the Entrys above there is a "jahr" Entry. This is the year where you have to start to count. So if "jahr" is 18. Then you have to count from 01.01.2018. And you have to look at the corresponding "gu" Entry. I assume GU stands for Gerade-Ungerade. if resttag is for example 5, jahr is 18 and restgu is false then you have to count from the 01.01.2018 plus 5 days. But if resttag is 5, jahr is 18 and restgu is true then you have to count from 01.01.2018 plus 5 days plus 7 days.

And now.... Good Morning 👍 it is 05:07 in the Morning

z-master42 commented 4 months ago

Not bad for "I don't know everything". I think the vier belongs to the residual waste, as there is a monthly, like all the others, emptying and a fortnightly.