mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 05:06:33 +01:00
@@ -307,6 +307,7 @@ Waste collection schedules in the following formats and countries are supported.
|
||||
- [Gais](/doc/source/a_region_ch.md) / a-region.ch
|
||||
- [Gaiserwald](/doc/source/a_region_ch.md) / a-region.ch
|
||||
- [Goldach](/doc/source/a_region_ch.md) / a-region.ch
|
||||
- [Grosswangen](/doc/source/grosswangen_ch.md) / grosswangen.ch
|
||||
- [Grub](/doc/source/a_region_ch.md) / a-region.ch
|
||||
- [Heiden](/doc/source/a_region_ch.md) / a-region.ch
|
||||
- [Herisau](/doc/source/a_region_ch.md) / a-region.ch
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import logging
|
||||
import requests
|
||||
from datetime import datetime
|
||||
from bs4 import BeautifulSoup
|
||||
from waste_collection_schedule import Collection
|
||||
|
||||
TITLE = "Grosswangen, CH"
|
||||
DESCRIPTION = " Source for 'Grosswangen, CH'"
|
||||
URL = "https://www.grosswangen.ch"
|
||||
TEST_CASES = {"TEST": {}}
|
||||
|
||||
ICON_MAP = {
|
||||
"Grüngutabfuhr": "mdi:leaf",
|
||||
"Kehricht-Aussentour": "mdi:trash-can-outline",
|
||||
"Kartonsammlung": "mdi:recycle",
|
||||
"Altpapiersammlung":"newspaper-variant-multiple-outline",
|
||||
"Häckselservice":"mdi:leaf-off",
|
||||
"Alteisensammlung und Sammlung elektronischer Geräte":"desktop-classic",
|
||||
"Zusätzliche Gratis-Laubabfuhr":"mdi:leaf",
|
||||
}
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class Source:
|
||||
def __init__(self,args=None):
|
||||
self = None
|
||||
|
||||
def fetch(self):
|
||||
|
||||
r = requests.get("https://www.grosswangen.ch/institution/details/abfallsammlungen")
|
||||
|
||||
r.raise_for_status()
|
||||
|
||||
soup = BeautifulSoup(r.text, "html.parser")
|
||||
|
||||
entries = []
|
||||
|
||||
for tag in soup.find_all(class_="InstList-institution InstDetail-termin"):
|
||||
for typ in tag.find_all("strong"):
|
||||
#print(typ.string)
|
||||
waste_type=typ.string
|
||||
for date in tag.find_all("span", class_="mobile"):
|
||||
#print(date.string[-8:])
|
||||
waste_date=datetime.strptime(date.string[-8:],"%d.%m.%y").date()
|
||||
|
||||
entries.append(Collection(waste_date,waste_type,ICON_MAP.get(waste_type)))
|
||||
|
||||
return entries
|
||||
30
doc/source/grosswangen_ch.md
Normal file
30
doc/source/grosswangen_ch.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Grosswangen, CH
|
||||
|
||||
Support for schedules provided by [https://www.grosswangen.ch/institution/details/abfallsammlungen](https://www.grosswangen.ch/institution/details/abfallsammlungen).
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: grosswangen_ch
|
||||
args:
|
||||
args: None
|
||||
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
*(no args required)*
|
||||
but use args as shown in example.
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: grosswangen_ch
|
||||
args:
|
||||
args: None
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user