mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 03:04:09 +01:00
Merge pull request #460 from bbr111/master
Add Abfall Neunkirchen Siegerland DE
This commit is contained in:
@@ -120,6 +120,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)
|
||||
- [RegioEntsorgung](./doc/source/regioentsorgung_de.md)
|
||||
- [Rhein-Hunsrück Entsorgung (RHE)](./doc/source/rh_entsorgung_de.md)
|
||||
- [Sector27.de](./doc/source/sector27_de.md)
|
||||
|
||||
@@ -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 = {
|
||||
"Waldstraße":{ "street":"Waldstr"}
|
||||
}
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
class Source:
|
||||
def __init__(self, strasse):
|
||||
self._strasse = strasse
|
||||
self._ics = ICS()
|
||||
|
||||
def fetch(self):
|
||||
|
||||
args = {"out":"json", "type": "abto", "select":"2", "refid": "3362.1", "term": self._strasse }
|
||||
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 street name")
|
||||
|
||||
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
|
||||
38
doc/source/abfall_neunkirchen_siegerland_de.md
Normal file
38
doc/source/abfall_neunkirchen_siegerland_de.md
Normal 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
|
||||
|
||||
**strasse**<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 [Gemeinde Neunkirchen Siegerland - Abfalltermine](https://www.neunkirchen-siegerland.de/Rathaus-Politik/B%C3%BCrgerservice/Abfalltermine/)
|
||||
2. Enter your street.
|
||||
3. Copy the exact values from the textboxes street in the source configuration.
|
||||
|
||||
*IMPORTANT* - only streetname or part of streetname without ()
|
||||
the string as strasse must match only 1 entry
|
||||
1
info.md
1
info.md
@@ -105,6 +105,7 @@ Currently the following service providers are supported:
|
||||
- [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)
|
||||
- [Neunkirchen Siegerland](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/abfall_neunkirchen_siegerland_de.md)
|
||||
- [RegioEntsorgung](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/regioentsorgung_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)
|
||||
|
||||
Reference in New Issue
Block a user