Skip to content

Commit

Permalink
Merge pull request #75 from mampfes/was_wolfsburg_de
Browse files Browse the repository at this point in the history
add source WAS-Wolfsburg.de
  • Loading branch information
mampfes authored Sep 12, 2021
2 parents ad4135b + aff9bd0 commit 8c2d6dd
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Currently the following service providers are supported:
- [Rhein-Hunsrück Entsorgung (RHE)](./doc/source/rh_entsorgung_de.md)
- [Sector27.de](./doc/source/sector27_de.md)
- [Stadtreinigung.Hamburg](./doc/source/stadtreinigung_hamburg.md)
- [WAS Wolfsburg](./doc/source/was_wolfsburg_de.md)

### Netherlands

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import datetime
import re

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

TITLE = "Wolfsburger Abfallwirtschaft und Straßenreinigung"
DESCRIPTION = "Source for waste collections for WAS-Wolfsburg, Germany."
URL = "https://was-wolfsburg.de"
TEST_CASES = {"WAS": {"city": "Barnstorf", "street": "Bahnhofspassage"}}


class Source:
def __init__(self, city, street):
self._city = city
self._street = street
self._ics = ICS()

def fetch(self):
# fetch "Gelber Sack"
args = {"g": self._city}
r = requests.get(
"https://was-wolfsburg.de/subgelberweihgarten/php/abfuhrgelber.php",
params=args,
)

entries = []
match = re.findall(r"(\d{2})\.(\d{2})\.(\d{4})", r.text)
for m in match:
date = datetime.date(day=int(m[0]), month=int(m[1]), year=int(m[2]))
entries.append(Collection(date, "Gelber Sack"))

# fetch remaining collections
args = {"ortabf": self._street}
r = requests.post(
"https://was-wolfsburg.de/subabfuhrtermine/ics_abfuhrtermine3.php",
data=args,
)
dates = self._ics.convert(r.text)
for d in dates:
entries.append(Collection(d[0], d[1]))

return entries
43 changes: 43 additions & 0 deletions doc/source/was_wolfsburg_de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Wolfsburger Abfallwirtschaft und Straßenreinigung

Support for schedules provided by [WAS-Wolfsburg.de](https://was-wolfsburg.de).

Please note that WAS Wolfsburg provides 2 different schedules: One for "Restabfall - Bioabfall - Altpapier" and one for "Gelber Sack". This source fetches both schedules and merges it into one.

## Configuration via configuration.yaml

```yaml
waste_collection_schedule:
sources:
- name: was_wolfsburg_de
args:
city: CITY
street: STREET
```
### Configuration Variables
**city**<br>
*(string) (required)*
**street**<br>
*(string) (required)*
## Example
```yaml
waste_collection_schedule:
sources:
- name: was_wolfsburg_de
args:
city: Barnstorf
street: Bahnhofspassage
```
## How to get the source arguments
| Argument | Description |
| ----------- | ----------- |
| city | Full district name as shown in the `Gelber Sack` web page. |
| street | Full street name as shown in the `Restabfall/Bioabfall/Altpapier` web page. |
19 changes: 10 additions & 9 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,28 @@ Currently the following service providers are supported:
- [Abfallwirtschaft Stuttgart](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/stuttgart_de.md)
- [Abfallwirtschaft Zollernalbkreis](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/abfall_zollernalbkreis_de.md)
- [AWBKoeln.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/awbkoeln_de.md)
- [AWIDO-online.de](./doc/source/awido_de.md)
- [AWIDO-online.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/awido_de.md)
- [BSR.de / Berliner Stadtreinigungsbetriebe](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bsr_de.md)
- [Jumomind.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/jumomind_de.md)
- [Muellmax.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/muellmax_de.md)
- [MyMuell App](./doc/source/jumomind_de.md)
- [Rhein-Hunsrück Entsorgung (RHE)](./doc/source/rh_entsorgung_de.md)
- [Sector27.de](./doc/source/sector27_de.md)
- [MyMuell App](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/jumomind_de.md)
- [Rhein-Hunsrück Entsorgung (RHE)](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/rh_entsorgung_de.md)
- [Sector27.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/sector27_de.md)
- [Stadtreinigung.Hamburg](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/stadtreinigung_hamburg.md)
- [WAS Wolfsburg](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/was_wolfsburg_de.md)

### Netherlands

- [Ximmio](./doc/source/ximmio_nl.md)
- [HVCGroep](./doc/source/hvcgroep_nl.md)
- [Ximmio](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/ximmio_nl.md)
- [HVCGroep](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hvcgroep_nl.md)

### New Zealand

- [Wastenet.org.nz](./doc/source/wastenet_org_nz.md)
- [Aucklandcouncil.govt.nz](./doc/source/aucklandcouncil_govt_nz.md)
- [Wastenet.org.nz](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/wastenet_org_nz.md)
- [Aucklandcouncil.govt.nz](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/aucklandcouncil_govt_nz.md)

### Sweden
- [Lerum.se](./doc/source/lerum_se.md)
- [Lerum.se](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/lerum_se.md)

### United States of America

Expand Down

0 comments on commit 8c2d6dd

Please sign in to comment.