-
-
Notifications
You must be signed in to change notification settings - Fork 678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: sbazv_de Not working anymore #2870
Comments
+1 |
The provider has completely changed the way in which the data can be retrieved. Instead of city, district and street, a location ID is now required. You can then use additional parameters to specify which waste you want to retrieve. You can choose between residual waste, paper, yellow bags, leaf bags and Christmas trees. I have temporarily solved the problem for myself by hard-coding the URL for the query at my address in the sbazv_en.py module. For the moment it works again, but I hope that the changes will soon be included in the official part. regards |
Can you provide a quick and dirty hack to get the integration working again until it is fixed? |
Go to the Website of sbazv, Look for your personal ics-file and copy the provided link. use this link in file sbazv_de.py and enter this in line 53. do Not forget to delete the additional Parameters in the line. start HA afterwards and everything should be working, ar least for the Moment. |
Thank you @reentier, it works again (for now and as a workaround at least). But not only the way the data is retrieved changed, also the wording of the entries. EDIT: Die "new" naming seems to only affect "Papier" and "Restmüll". |
Confirmed. I had to change my templates:
While this fixes my "next event" sensors (it displays the next date where each type of waste is collected), the calendar itself doesn't work for me. "Events for calendar could not be retrieved" -> calendar doesn't display any items. This doesn't make sense because the sensors can obviously display valid data which means that event data has been parsed from the received .ics I'm a bit stumped. I've changed Is there a way to debug/log the parsing within python module?
|
Calendar seems fine here and works as expected. |
My SolutionAs written before: The Solution-Steps:I've updated the sbazv_de.py script directly with an editor in Home Assistant (config/custom_components/waste_collection_schedule/waste_collection_schedule/source/sbazv_de.py) to use a new URL that works with StandortID and AboID parameters. This new approach uses the current URL format to retrieve ICS files, maintaining compatibility with the waste collection service. Steps for Workaround1. Edit sbazv_de.pyUse an editor such as "VS Code Server" in Home Assistant and completely replace the script with the provided updated version. import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]
from waste_collection_schedule.service.ICS import ICS
TITLE = "Südbrandenburgischer Abfallzweckverband"
DESCRIPTION = "SBAZV Brandenburg, Deutschland"
URL = "https://www.sbazv.de"
TEST_CASES = {
"Wildau": {"standort_id": "1448192001", "abo_id": "2978"},
# Additional test cases can be added here
}
ICON_MAP = {
"Restmülltonnen": "mdi:trash-can",
"Laubsäcke": "mdi:leaf",
"Gelbe Säcke": "mdi:sack",
"Papiertonnen": "mdi:package-variant",
"Weihnachtsbäume": "mdi:pine-tree",
}
class Source:
def __init__(self, standort_id, abo_id):
self._standort_id = standort_id
self._abo_id = abo_id
self._ics = ICS()
def fetch(self):
url = "https://fahrzeuge.sbazv.de/WasteManagementSuedbrandenburg/WasteManagementServiceServlet"
params = {
"ApplicationName": "Calendar",
"SubmitAction": "sync",
"StandortID": self._standort_id,
"AboID": self._abo_id,
"Fra": "P;R;WB;L;GS"
}
# GET request to retrieve ICS file
r = requests.get(url, params=params)
# Check if the response is successful
if r.status_code != 200:
raise ValueError(f"Error fetching ICS data. Status code: {r.status_code}")
# Parse ICS data
dates = self._ics.convert(r.text)
entries = []
for d in dates:
waste_type = d[1].strip()
next_pickup_date = d[0]
# Remove duplicates
if any(
e.date == next_pickup_date and e.type == waste_type for e in entries
):
continue
entries.append(
Collection(
date=next_pickup_date,
t=waste_type,
icon=ICON_MAP.get(waste_type),
)
)
return entries 2. Remove Manual ConfigurationRemove any manually added entries for Waste Collection Schedule from configuration.yaml, if available. 3. Restart Home AssistantRestart Home Assistant to apply the changes. 4. Find StandortID and AboIDa. Visit https://www.sbazv.de/entsorgungstermine/restmuell-papier-gelbesaecke-laubsaecke-weihnachtsbaeume/b. Fill in "Ort", "Straße", and "Hausnummer", then click "Weiter".c. Click "Kalenderexport".d. Scroll down and click "URL anzeigen". You will see a URL like: https://fahrzeuge.sbazv.de/WasteManagementSuedbrandenburg/WasteManagementServiceServlet?ApplicationName=Calendar&SubmitAction=sync&StandortID=1383362001&AboID=3001&Fra=P;R;WB;L;GSe. Note StandortID and AboID from the URL.5. Add IntegrationAdd the "Waste Collection Schedule" integration in Home Assistant and start the assistant. You will now see fields for StandortID and AboID. Enter the values noted in Step 4e. 6. Proceed with ConfigurationComplete the remaining configuration steps as before. This workaround is working well on my setup. I hope it will be helpful to all of you. If agreed by mampfes, it could also be included in the main code. Maybe someone else can investigate whether it's possible to find an API that builds the StandortID directly from the address details. So far, I haven’t found anything suitable for that. Fiiti |
Hmm that seems not fixing all for me how get i back my Sensors ? ` - platform: waste_collection_schedule Nächste Restmüll-Abholung
Nächste gelber-Sack Abholung
Nächste Papiermüll Abholung
` |
Thank you very much, it worked. I followed the instructions and created a new integration. There you can also rename the "Restmüll" and "Papier". The "value_template" can also be inserted so that you have a display like “Morgen” again. |
@rmi1974 thank you - that's fixing all my problems with sensors and so on ... still working again everything as before ! |
What other custom components do you have installed? I assume you made an update of ics_calendar to version 5.0.4? if yes, check here |
yes i have ics_calendar 5.0.4 since 2 months. Changed the sbazf_de.py and GUI of WCS is not working anymore. |
The "api" of SBAZV has changed (see mampfes#2870). I used @rmi1974 solution and changed it so the user can simply enter the URL he copied from the Website.
The "api" of SBAZV has changed (see mampfes#2870). Since its a simple url with ics data, we can use the ics source.
The "api" of SBAZV has changed (see #2870). Since its a simple url with ics data, we can use the ics source.
I Have A Problem With:
The integration in general
What's Your Problem
I only receive an error-Message from this Integration singe today.
While trying to reconfigure and double-checking with website of the provider it seems that they have changed the requested paramaters for the API-Call. In the past there asked for City, Part of the City and Street. But now there are asking for City, Street and Number of the House.
If there is any more Information i should provide to solve this issue, please ask.
Thanks in advance for looking into this.
Source (if relevant)
Sbazv_de
Logs
No response
Relevant Configuration
No response
Checklist Source Error
Checklist Sensor Error
Required
The text was updated successfully, but these errors were encountered: