Added hubert schmid gmbh (#1924)

* Added hubert schmid gmbh

* fixed review feedback and added test cases

* reformatting

---------

Co-authored-by: 5ila5 <5ila5@users.noreply.github.com>
This commit is contained in:
Michael Alt
2024-04-04 18:15:29 +02:00
committed by GitHub
parent ada82e6d5f
commit a71e2e1fbf
4 changed files with 117 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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.

File diff suppressed because one or more lines are too long