Add Abfall Neunkirchen Siegerland DE

Add Abfall Neunkirchen Siegerland

Add Abfall Neunkirchen Siegerland

Add Abfall Neunkirchen Siegerland - update

Update abfall_neunkirchen_siegerland_de.md
This commit is contained in:
Benjamin
2022-12-08 13:00:22 +01:00
committed by bbr111
parent d0432cdab5
commit b37811b6c4
3 changed files with 90 additions and 0 deletions

View File

@@ -118,6 +118,7 @@ Currently the following service providers are supported:
- [Landkreis Schwäbisch Hall](./doc/source/lrasha_de.md)
- [Muellmax.de](./doc/source/muellmax_de.md)
- [MyMuell App](./doc/source/jumomind_de.md)
- [Neunkirchen Siegerland](./doc/source/abfall_neunkirchen_siegerland_de.md)
- [Rhein-Hunsrück Entsorgung (RHE)](./doc/source/rh_entsorgung_de.md)
- [Sector27.de](./doc/source/sector27_de.md)
- [Stadtreinigung Dresden](./doc/source/stadtreinigung_dresden_de.md)

View File

@@ -0,0 +1,51 @@
import logging
import requests
from waste_collection_schedule import Collection
from waste_collection_schedule.service.ICS import ICS
TITLE = "Abfall Neunkirchen Siegerland"
DESCRIPTION = " Source for 'Abfallkalender Neunkirchen Siegerland'."
URL = "https://www.neunkirchen-siegerland.de"
TEST_CASES = {
}
_LOGGER = logging.getLogger(__name__)
class Source:
def __init__(self, searchterm):
self._searchterm = searchterm
self._ics = ICS()
def fetch(self):
args = {"out":"json", "type": "abto", "select":"2", "refid": "3362.1", "term": self._searchterm }
header = {"referer": "https://www.neunkirchen-siegerland.de"}
r = requests.get("https://www.neunkirchen-siegerland.de/output/autocomplete.php", params=args,headers=header)
if r.status_code != 200:
_LOGGER.error("Error querying calender data")
return []
ids = r.json()
if len(ids) == 0:
raise Exception("no address found")
if len(ids) > 1:
raise Exception (" to many addresses found, specify more detailed search term")
args = {"ModID":48, "call": "ical", "pois": ids[0][0], "kat": 1, "alarm":0}
r = requests.get("https://www.neunkirchen-siegerland.de/output/options.php", params=args,headers=header)
if r.status_code != 200:
_LOGGER.error("Error querying calender data")
return []
dates = self._ics.convert(r.text)
entries = []
for d in dates:
entries.append(Collection(d[0],d[1]))
return entries

View File

@@ -0,0 +1,38 @@
# Neunkirchen Siegerland
Support for schedules provided by [Gemeinde Neunkirchen Siegerland](https://www.neunkirchen-siegerland.de/), Germany.
## Configuration via configuration.yaml
```yaml
waste_collection_schedule:
sources:
- name: abfall_neunkirchen_siegerland_de
args:
strasse: STRASSE
```
### Configuration Variables
**searchterm**<br>
*(string) (required)*
## Example
```yaml
waste_collection_schedule:
sources:
- name: abfall_neunkirchen_siegerland_de
args:
strasse: "Bahnhofst*"
```
## How to get the source arguments
1. Go to your calendar at (https://www.neunkirchen-siegerland.de/Rathaus-Politik/B%C3%BCrgerservice/Abfalltermine/)
2. Enter your Streen.
3. Copy the exact values from the textboxes streen in the source configuration.
*IMPORTANT* - only streetname or part of streetname without ()
the string as strasse must match only 1 entry