Skip to content

Commit

Permalink
Added hubert schmid gmbh (#1924)
Browse files Browse the repository at this point in the history
* Added hubert schmid gmbh

* fixed review feedback and added test cases

* reformatting

---------

Co-authored-by: 5ila5 <[email protected]>
  • Loading branch information
MichaelAlt and 5ila5 authored Apr 4, 2024
1 parent ada82e6 commit a71e2e1
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ Waste collection schedules in the following formats and countries are supported.
- [Hohenlohekreis](/doc/source/app_abfallplus_de.md) / Abfall+ App: hokwaste
- [Holtgast (MyMuell App)](/doc/source/jumomind_de.md) / mymuell.de
- [Höxter](/doc/source/jumomind_de.md) / abfallservice.kreis-hoexter.de
- [Hubert Schmid GmbH](/doc/source/api_hubert_schmid_de.md) / hubert-schmid.de
- [Ilm-Kreis](/doc/source/app_abfallplus_de.md) / Abfall+ App: abfallappik
- [Ingolstadt](/doc/source/jumomind_de.md) / in-kb.de
- [Insert IT Apps](/doc/source/insert_it_de.md) / insert-infotech.de
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from datetime import datetime

import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]

TITLE = "HubertSchmid Recycling und Umweltschutz GmbH"
DESCRIPTION = "Abfuhrtermine Blaue Tonne"
URL = "https://www.hschmid24.de/BlaueTonne/"
API_URL = "https://www.hschmid24.de/BlaueTonne/php/ajax.php"

TEST_CASES = {
"Albatsried(Seeg)": {"city": "Albatsried(Seeg)"},
"Nesselwang > Attlesee": {"city": "Nesselwang", "ortsteil": "Attlesee"},
"Buchloe > Hausen > Dorfstraße": {
"city": "Buchloe",
"ortsteil": "Hausen",
"strasse": "Dorfstraße",
},
}


class Source:
def __init__(
self,
city: str,
ortsteil: str | None = None,
strasse: str | None = None,
):
self._city = city
self._ortsteil = ortsteil
self._strasse = strasse

def fetch(self):
r = requests.post(
f"{API_URL}",
data={"l": 3, "p1": self._city, "p2": self._ortsteil, "p3": self._strasse},
)

r.raise_for_status()
calendarEntries = r.json()["cal"]

entries = []
for entry in calendarEntries:
if entry != "0000-00-00":
entries.append(
Collection(
date=datetime.strptime(entry, "%Y-%m-%d").date(),
t="Blaue Tonne",
icon="mdi:package-variant",
)
)

return entries
62 changes: 62 additions & 0 deletions doc/source/api_hubert_schmid_de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Hubert Schmid GmbH (Blaue Tonne) Landkreis Ostallgäu

Support for schedules provided by [Hubert Schmid GmbH](https://www.hschmid24.de/BlaueTonne/), serving in Ostallgäu, Bavaria, Germany.

## Configuration via configuration.yaml

```yaml
waste_collection_schedule:
sources:
- name: api_hubert_schmid_de
args:
city: STADT/KOMMUNE
ortsteil: ORTSTEIL
strasse: STRASSE

```
### Configuration Variables
**city**
*(String) (required)*
**strasse**
*(String) (optional)*
**ortsteil**
*(String) (optional)*
## Examples
```yaml
waste_collection_schedule:
sources:
- name: api_hubert_schmid_de
args:
city: Füssen
ortsteil: Eschach
strasse: Schorrenmoos
```
```yaml
waste_collection_schedule:
sources:
- name: api_hubert_schmid_de
args:
city: Emmenhausen(Waal)
strasse: Am Hofanger
```
```yaml
waste_collection_schedule:
sources:
- name: api_hubert_schmid_de
args:
app_id: de.k4systems.abfallappwug
city: Bergen
strasse: Alle Straßen
```
## How to get the source arguments
Use the website (https://www.hschmid24.de/BlaueTonne/) to find the exact notation of the city, street and optional district.
Loading

0 comments on commit a71e2e1

Please sign in to comment.