Open dp20eic opened 5 months ago
Hello,
Yes, the WAS website has changed. Here are the new URL:
Gelber Sack: r = requests.post( "https://was-wolfsburg.de/wp-content/themes/astra-child/search_gelbersack/search.php", data={"loc": "MY_CITY"}, headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"}, )
Bioabfall,Restabfall,Altpapier: r = requests.post( "https://was-wolfsburg.de/wp-content/themes/astra-child/search_restabfall/search.php", data={"loc": "MY_STREET"}, headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"}, )
Yes, the WAS website has changed. Here are the new URL:
Hi,
ok, I try to change it local at was_wolfsburg_de.py
and for Gelber Sack
it works, but for the rest not.
VG
You can do a list like the Gelber Sack.
I´ve done :
r = requests.post( "https://was-wolfsburg.de/wp-content/themes/astra-child/search_restabfall/search.php", data={"loc": "YOUR_STREET"}, headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"}, )
entries = []
match = re.findall(r"(\d{2})\.(\d{2})\.(\d{4})", r.text)
match2 = re.findall(r"Bioabfall|Restabfall|Altpapier", r.text)
myit = iter(match2)
for m in match:
date = datetime.date(day=int(m[0]), month=int(m[1]), year=int(m[2]))
entries.append(Collection(date, next(myit)))
return entries
VG
Hi,
Yes, if I delete "entries = []" it works, but I need to change the city and street in the main source and couldn't configure it in "configuration.yaml, ..." like before and the icons are no more correctly. I'm not good at programming, but I think the source code needs to be completely rewritten so that everything can be used as before. Your preparatory work can contribute very well to this.
VG
I would also be very happy about an adjustment.
Me too (also where is the ics for the dates?)
Me too (also where is the ics for the dates?)
Good morning,
I don't understand that, it has nothing to do with the integration, the integration queries the data directly on the WAS page. If you want to save ICS data into a calendar and read it out, then WAS has to have an ICS calendar provide, or you enter the appointments yourself into a calendar, and then you have to make your adjustments in the .yaml
, which comes from the calendar you created.
As I know, there is no ICS file anymore you can download from the WAS page.
VG Bernd
Me too (also where is the ics for the dates?)
Good morning, I don't understand that, it has nothing to do with the integration, the integration queries the data directly on the WAS page. If you want to save ICS data into a calendar and read it out, then WAS has to have an ICS calendar provide, or you enter the appointments yourself into a calendar, and then you have to make your adjustments in the
.yaml
, which comes from the calendar you created. As I know, there is no ICS file anymore you can download from the WAS page.VG Bernd
The ics is coming
Moin,
Today I was offered an update of the hacs_waste_collection_schedule
, unfortunately I found that the error was not fixed :(
Ok, I change it again at original Source and wait if it changed next update.
VG
Moin,
Today I was offered an update of the
hacs_waste_collection_schedule
, unfortunately I found that the error was not fixed :) Ok, I change it again at original Source and wait if it changed next update.VG
Maybe i have an error in there. Could you upload your complete was_wolfsburg_de.py please?
Maybe i have an error in there. Could you upload your complete was_wolfsburg_de.py please?
Good morning,
I took the code from @ppk2000 and just adapted it to my street and city, so where ...={"loc": "MY_CITY"}
is written, the district comes in, e.g. E.g.: Barnstorf or Laagberg.
With ...={"loc": "YOUR_STREET"}
then just the appropriate street without house number, e.g. E.g.: Barnstorfer Weg or Heinrich-Nordhoff-Straße.
As I wrote above, the entries = [] have to be removed for leftover, organic or waste paper, then my code looks like this
import datetime
import re
import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]
from waste_collection_schedule.service.ICS import ICS
TITLE = "Wolfsburger Abfallwirtschaft und Straßenreinigung"
DESCRIPTION = "Source for waste collections for WAS-Wolfsburg, Germany."
URL = "https://was-wolfsburg.de"
TEST_CASES = {
"Barnstorf": {"city": "Barnstorf", "street": "Bahnhofspassage"},
"Sülfeld": {"city": "Sülfeld", "street": "Bärheide"},
}
ICON_MAP = {
"Gelber Sack": "mdi:recycle",
"Bioabfall": "mdi:leaf",
"Restabfall": "mdi:trash-can",
"Altpapier": "mdi:file-document-outline",
}
CHARACTER_MAP = {
ord("ü"): "u",
ord("ö"): "o", # doesn't appear to be needed
ord("ä"): "a", # doesn't appear to be needed
}
class Source:
def __init__(self, city: str, street: str):
self._city = city.translate(CHARACTER_MAP)
self._street = street.translate(CHARACTER_MAP)
self._ics = ICS()
def fetch(self):
# fetch "Gelber Sack"
args = {"g": self._city}
r = requests.post(
"https://was-wolfsburg.de/wp-content/themes/astra-child/search_gelbersack/search.php",
data={"loc": "MY_CITY"},
headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"},
)
entries = []
match = re.findall(r"(\d{2})\.(\d{2})\.(\d{4})", r.text)
for m in match:
date = datetime.date(day=int(m[0]), month=int(m[1]), year=int(m[2]))
entries.append(
Collection(date, "Gelber Sack", icon=ICON_MAP["Gelber Sack"])
)
# fetch remaining collections
args = {"k": self._street}
r = requests.post(
"https://was-wolfsburg.de/wp-content/themes/astra-child/search_restabfall/search.php",
data={"loc": "MY_STREET"},
headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"},
)
match = re.findall(r"(\d{2})\.(\d{2})\.(\d{4})", r.text)
match2 = re.findall(r"Bioabfall|Restabfall|Altpapier", r.text)
myit = iter(match2)
for m in match:
date = datetime.date(day=int(m[0]), month=int(m[1]), year=int(m[2]))
entries.append(Collection(date, next(myit)))
return entries
VG
Good morning,
I would like to bring this error up again, it would be nice if a developer would take a look at it and fix it.
With kind regards Bernd
Yeah, would be awesome if someone can fix this :-)
The URLs works fine for me. Maybe the problem are last changes in the integration??? Sorry but I use my own implementation and i can´t help.
Hey!
Is there any update to this issue?
I can't get it to work. Neither the master nor this code snippet are working in homeassistant or in my python environment. If I try to access the URL by hand, I get
{"status":true,"count":0,"string":null}
as a response.
Kind regards
Moin,
If I try to access the URL by hand, I get Das ist normal, da Du ja kein Ziel mit angegeben hast, im Python Skript, kommen ja noch
data={"loc": "MY_CITY"}, headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"},
Oder
data={"loc": "MY_STREET"}, headers={"content-type": "application/x-www-form-urlencoded; charset=UTF-8"},
Die, die Suche vervollständigen.
Sag mal, wo es klemmt, dann kann ich vielleicht unterstützen.
VG Bernd
I Have A Problem With:
A specific source
What's Your Problem
Since February 8th, 2024, I no longer see any appointments displayed in the calendar and therefore no more appointments are shown to me in the automations.
my configuration
Source (if relevant)
No response
Logs
No response
Relevant Configuration
Checklist Source Error
Checklist Sensor Error
Required