mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 04:06:03 +01:00
Merge pull request #321 from steffenrapp/master
Add Landkreis Schwäbisch Hall
This commit is contained in:
@@ -103,6 +103,7 @@ Currently the following service providers are supported:
|
||||
- [Jumomind.de](./doc/source/jumomind_de.md)
|
||||
- [KWB-Goslar.de](./doc/source/kwb_goslar_de.md)
|
||||
- [Landkreis-Wittmund.de](./doc/source/landkreis_wittmund_de.md)
|
||||
- [Landkreis Schwäbisch Hall](./doc/source/lrasha_de.md)
|
||||
- [Muellmax.de](./doc/source/muellmax_de.md)
|
||||
- [MyMuell App](./doc/source/jumomind_de.md)
|
||||
- [Rhein-Hunsrück Entsorgung (RHE)](./doc/source/rh_entsorgung_de.md)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import datetime
|
||||
import requests
|
||||
from waste_collection_schedule import Collection
|
||||
from waste_collection_schedule.service.ICS import ICS
|
||||
|
||||
|
||||
TITLE = "Landkreis Schwäbisch Hall"
|
||||
DESCRIPTION = "Source for lrasha.de - Landkreis Schwäbisch Hall"
|
||||
URL = "http://exchange.cmcitymedia.de/landkreis-schwaebisch-hallt3/wasteCalendarExport.php?location="
|
||||
# https://www.lrasha.de/de/buergerservice/abfallwirtschaft/abfallkalender
|
||||
|
||||
TEST_CASES = {
|
||||
"Ilshofen": {"location": "114"}
|
||||
}
|
||||
|
||||
HEADERS = {"user-agent": "Mozilla/5.0 (xxxx Windows NT 10.0; Win64; x64)"}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, location):
|
||||
self._location = location
|
||||
self._ics = ICS()
|
||||
|
||||
def fetch(self):
|
||||
# get ics file
|
||||
full_url = URL + str(self._location)
|
||||
r = requests.get(full_url, headers=HEADERS)
|
||||
r.raise_for_status()
|
||||
|
||||
# parse ics file
|
||||
r.encoding = "utf-8"
|
||||
dates = self._ics.convert(r.text)
|
||||
|
||||
entries = []
|
||||
for d in dates:
|
||||
entries.append(Collection(d[0], d[1]))
|
||||
return entries
|
||||
22
doc/source/lrasha_de.md
Normal file
22
doc/source/lrasha_de.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Landkreis Schwäbisch Hall
|
||||
|
||||
Support for schedules provided by [Landkreis Schwäbisch Hall](https://www.lrasha.de) located in Baden-Württemberg, Germany.
|
||||
|
||||
## Configuration via configuration.yaml
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: lrasha_de
|
||||
args:
|
||||
location: "97"
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**location**<br>
|
||||
*(string) (required)*
|
||||
|
||||
## How to get the source arguments
|
||||
|
||||
Visit [Abfallkalender](https://www.lrasha.de/de/buergerservice/abfallwirtschaft/abfallkalender), select your location and click on search. Now copy the download link and paste it somewhere to see it. The number after `location=` has to be entered in the configuration.
|
||||
1
info.md
1
info.md
@@ -89,6 +89,7 @@ Currently the following service providers are supported:
|
||||
- [Jumomind.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/jumomind_de.md)
|
||||
- [KWB-Goslar.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/kwb_goslar_de.md)
|
||||
- [Landkreis-Wittmund.de](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/landkreis_wittmund_de.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)
|
||||
- [Rhein-Hunsrück Entsorgung (RHE)](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/rh_entsorgung_de.md)
|
||||
|
||||
Reference in New Issue
Block a user