diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/c_trace_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/c_trace_de.py index 9ba8af0f..26e0d02f 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/c_trace_de.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/c_trace_de.py @@ -160,7 +160,14 @@ BASE_URL = "https://{subdomain}.c-trace.de" class Source: def __init__( - self, strasse, hausnummer, gemeinde="", ort="", ortsteil="", service=None + self, + strasse, + hausnummer, + gemeinde="", + ort="", + ortsteil="", + service=None, + abfall="", ): # Compatibility handling for Bremen which was the first supported # district and didn't require to set a service name. @@ -192,6 +199,9 @@ class Source: self._base_url = BASE_URL.format(subdomain=subdomain) self.ical_url_file = ical_url_file self._ics = ICS(regex=r"Abfuhr: (.*)") + if not abfall: + abfall = "|".join(str(i) for i in range(0, 99)) + self._abfall = abfall def fetch(self): session = requests.session() @@ -213,7 +223,7 @@ class Source: "Gemeinde": self._gemeinde, "Strasse": self._strasse, "Hausnr": self._hausnummer, - "Abfall": "|".join(str(i) for i in range(0, 99)), # return all waste types + "Abfall": self._abfall, } if self._ortsteil: args["Ortsteil"] = self._ortsteil diff --git a/doc/source/c_trace_de.md b/doc/source/c_trace_de.md index 474e80af..c5be83c3 100644 --- a/doc/source/c_trace_de.md +++ b/doc/source/c_trace_de.md @@ -15,32 +15,37 @@ waste_collection_schedule: ortsteil: ORTSTEIL strasse: STRASSE hausnummer: HAUSNUMMER + abfall: ABFALLARTEN ``` ### Configuration Variables -**service** -*(string) (required)* +**service** +*(string) (required)* Name of the service which is specific to your municipality. See the table below to get the right value for your location. -**ort** +**ort** *(string) (optional)* Needed for most municipalities but no all -**gemeinde** +**gemeinde** *(string) (optional)* Needed for some municipalities but not all (can be left empty if same as `ort` or unneeded) -**ortsteil** +**ortsteil** *(string) (optional)* Needed only for some municipalities but not all (can be left empty if unneeded) -**strasse** +**strasse** *(string) (required)* -**hausnummer** +**hausnummer** *(string) (required)* +**abfall** +*(string) (optional)* +Needed only to filter waste types (if empty you get all waste types). Separator between waste types is '|'. + ## Example ```yaml @@ -122,4 +127,4 @@ Link for above image: https://web.c-trace.de/segebergwzv-abfallkalender/(S(ebi2z From this Link you can extract the following parameters: -`web|app`.c-trace.de/`(web.)service`/some-id/abfallkalender/`cal|downloadcal` `/year|`?Ort=`ort`&Ortsteil=`ortsteil`&Strasse=`strasse`&Hausnr=`hausnummer`... +`web|app`.c-trace.de/`(web.)service`/some-id/abfallkalender/`cal|downloadcal` `/year|`?Ort=`ort`&Ortsteil=`ortsteil`&Strasse=`strasse`&Hausnr=`hausnummer`&abfall='abfallarten'...