mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 03:04:09 +01:00
fix stadtreinigung.hamburg
This commit is contained in:
@@ -6,23 +6,22 @@ TITLE = "Stadtreinigung Hamburg"
|
||||
DESCRIPTION = "Source for Stadtreinigung Hamburg waste collection."
|
||||
URL = "https://www.stadtreinigung.hamburg"
|
||||
TEST_CASES = {
|
||||
"Hamburg": {"asId": 5087, "hnId": 113084},
|
||||
"Zabelweg 1B": {"hnId": 53814},
|
||||
}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, asId, hnId):
|
||||
self._asId = asId
|
||||
def __init__(self, hnId, asId=None):
|
||||
self._hnId = hnId
|
||||
self._ics = ICS(offset=1, regex="Erinnerung: Abfuhr (.*) morgen")
|
||||
self._ics = ICS()
|
||||
|
||||
def fetch(self):
|
||||
args = {"asId": self._asId, "hnId": self._hnId, "adresse": "MeineAdresse"}
|
||||
args = {"hnIds": self._hnId, "adresse": "MeineAdresse"}
|
||||
|
||||
# get ics file
|
||||
r = requests.post(
|
||||
"https://www.stadtreinigung.hamburg/privatkunden/abfuhrkalender/Abfuhrtermin.ics",
|
||||
data=args,
|
||||
r = requests.get(
|
||||
"https://backend.stadtreinigung.hamburg/kalender/abholtermine.ics",
|
||||
params=args,
|
||||
)
|
||||
|
||||
dates = self._ics.convert(r.text)
|
||||
|
||||
@@ -9,15 +9,11 @@ waste_collection_schedule:
|
||||
sources:
|
||||
- name: stadtreinigung_hamburg
|
||||
args:
|
||||
asId: ASID
|
||||
hnId: HNID
|
||||
```
|
||||
|
||||
### Configuration Variables
|
||||
|
||||
**asId**<br>
|
||||
*(string) (required)*
|
||||
|
||||
**hnId**<br>
|
||||
*(string) (required)*
|
||||
|
||||
@@ -28,14 +24,17 @@ waste_collection_schedule:
|
||||
sources:
|
||||
- name: stadtreinigung_hamburg
|
||||
args:
|
||||
asId: 5087
|
||||
hnId: 113084
|
||||
```
|
||||
|
||||
## How to get the source arguments
|
||||
|
||||
There is a script with an interactive command line interface which generates the required source configuration:
|
||||
Open [stadtreinigung.hamburg](https://www.stadtreinigung.hamburg/abfuhrkalender/) and search for schedules for your location.
|
||||
|
||||
[https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/custom_components/waste_collection_schedule/waste_collection_schedule/wizard/stadtreinigung_hamburg.py](https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/custom_components/waste_collection_schedule/waste_collection_schedule/wizard/stadtreinigung_hamburg.py).
|
||||
Check the URL and extract the number after field `housenumber%5D`.
|
||||
|
||||
First, install the Python module `inquirer`. Then run this script from a shell and answer the questions.
|
||||
Example:
|
||||
|
||||
`https://www.stadtreinigung.hamburg/abfuhrkalender/?tx_srh_pickups%5Bstreet%5D=2586&tx_srh_pickups%5Bhousenumber%5D=53814`
|
||||
|
||||
The resulting `hnId` is `53814`.
|
||||
Reference in New Issue
Block a user