fix errors and implement review improvements

This commit is contained in:
Random-Cow
2022-10-19 16:38:26 +02:00
parent a69865b130
commit 31117b1432
4 changed files with 14 additions and 9 deletions

View File

@@ -105,7 +105,7 @@ Currently the following service providers are supported:
- [KAEV Niederlausitz](./doc/source/kaev_niederlausitz_de.md)
- [KWB-Goslar.de](./doc/source/kwb_goslar_de.md)
- [Landkreis-Wittmund.de](./doc/source/landkreis_wittmund_de.md)
- [Landkreis Rhön Grabfeld"](./doc/source/landkreis_rhoen_grabfeld.md)
- [Landkreis Rhön Grabfeld](./doc/source/landkreis_rhoen_grabfeld.md)
- [Landkreis Schwäbisch Hall](./doc/source/lrasha_de.md)
- [Muellmax.de](./doc/source/muellmax_de.md)
- [MyMuell App](./doc/source/jumomind_de.md)

View File

@@ -6,6 +6,15 @@ from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE = "Source for Rhön Grabfeld"
DESCRIPTION = "Source for Rhönn Grabfeld uses service by offizium."
URL = 'https://fs-api-rg.offizium.com/abfalltermine'
ICON_MAP = {
"Restmüll/Gelber Sack/Biotonne": "mdi:trash-can",
"Papiersammlung": "mdi:package-variant",
"Problemmüllsammlung": "mdi:biohazard"
}
EVENT_BLACKLIST = ['Wertstoffhof Mellrichstadt',
'Wertstoffhof Bad Königshofen', 'Wertstoffzentrum Bad Neustadt',
'Wertstoffsammelstelle Ostheim',
'Wertstoffsammelstelle Bischofsheim']
TEST_CASES = {
"City only": {"city": "Ostheim"},
"City + District": {"city": "Ostheim", "district": "Oberwaldbehrungen"},
@@ -18,11 +27,6 @@ class Source:
def __init__(self, city: str = None, district: str = None):
self._city = city
self._district = district
self._iconMap = {
"Restmüll/Gelber Sack/Biotonne": "mdi:trash-can",
"Papiersammlung": "mdi:package-variant",
"Problemmüllsammlung": "mdi:biohazard"
}
def fetch(self):
now = datetime.datetime.now().date()
@@ -37,13 +41,13 @@ class Source:
entries = []
for event in r.json():
# filter out Sammelstellen, Wertstoffhof and Wertstoffzentrum
if event["muellart"] in self._iconMap:
if event["muellart"] not in EVENT_BLACKLIST:
entries.append(
Collection(
date=datetime.datetime.fromisoformat(
event["termin"]).date(),
t=event["muellart"],
icon=self._iconMap.get(
icon=ICON_MAP.get(
event["muellart"], "mdi:trash-can")
)
)

View File

@@ -1,4 +1,4 @@
# Abfallkalender Würzburg
# Landkreis Rhön Grabfeld
Support for schedules provided by [AbfallInfo Rhön Grabfeld](https://www.abfallinfo-rhoen-grabfeld.de/service/abfuhr-wecker), serving the rural district of Rhön Grabfeld.

View File

@@ -91,6 +91,7 @@ Currently the following service providers are supported:
- [KWB-Goslar.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/kwb_goslar_de.md)
- [KAEV Niederlausitz](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/kaev_niederlausitz_de.md)
- [Landkreis-Wittmund.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/landkreis_wittmund_de.md)
- [Landkreis Rhön Grabfeld](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/landkreis_rhoen_grabfeld.md)
- [Landkreis Schwäbisch Hall](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/lrasha_de.md)
- [Muellmax.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/muellmax_de.md)
- [MyMuell App](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/jumomind_de.md)