Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Bug]: was_wolfsburg_de stopped fetching data
### I Have A Problem With:

A specific source

### What's Your Problem

The Source was_wolfsburg_de stopped fetching data for 2024. I suspect because the request link is no longer accurate.
I have experimented a bit, and with the following address I receive current data: 

https://was-wolfsburg.de/subabfuhrtermine/php/abfuhrtermine.php

It only concerns "Restmüll, Bioabfall und Papierabfall". "Gelber Sack" is still functioning.

### Source (if relevant)

was_wolfsburg_de

### Logs

_No response_

### Relevant Configuration

_No response_

### Checklist Source Error

- [ ] Use the example parameters for your source (often available in the documentation) (don't forget to restart Home Assistant after changing the configuration)
- [ ] Checked that the website of your service provider is still working
- [ ] Tested my attributes on the service provider website (if possible)
- [X] I have tested with the latest version of the integration (master) (for HACS in the 3 dot menu of the integration click on "Redownload" and choose master as version)

### Checklist Sensor Error

- [ ] Checked in the Home Assistant Calendar tab if the event names match the types names (if types argument is used)

### Required

- [X] I have searched past (closed AND opened) issues to see if this bug has already been reported, and it hasn't been.
- [X] I understand that people give their precious time for free, and thus I've done my very best to make this problem as easy as possible to investigate.


Discussion:
Moin,

I can confirm, but for me, it looks that it stop working some days ago, only the `yellow bag` in German `Gelber Sack` is shown.
Actual `Restabfall` is not shown anymore
![grafik](https://github.com/mampfes/hacs_waste_collection_schedule/assets/71387331/d46ed7a9-8585-4e9f-9462-1f7ea07ce16e)

Version is 1.44.0

My simple configuration
```
# Abfallkallender
waste_collection_schedule:
  sources:
    - name: was_wolfsburg_de
      args:
        city: Ortsteil
        street: Strassenname
  fetch_time: "04:00"
  day_switch_time: "10:00"
sensor:
  # ------- Garbage Collection -------
  # next collection
  - platform: waste_collection_schedule
    name: "Nächste Abholung"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
  # Nächste Restabfall-Abholung
  - platform: waste_collection_schedule
    name: "Restabfall"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Restabfall
  # Nächste Bioabfall Abholung
  - platform: waste_collection_schedule
    name: "Bioabfall"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Bioabfall
  # Nächste gelber-Sack Abholung
  - platform: waste_collection_schedule
    name: "Gelber Sack"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Gelber Sack
  # Nächste Papierabfall Abholung
  - platform: waste_collection_schedule
    name: "Altpapier"
    value_template: '{{value.types|join(", ")}}{% if value.daysTo == 0 %} Heute{% elif value.daysTo == 1 %} Morgen{% else %} in {{value.daysTo}} tagen{% endif %}'
    types:
      - Altpapier
```
The types are shown at the calendar
![grafik](https://github.com/mampfes/hacs_waste_collection_schedule/assets/71387331/4a87d588-e48e-4932-889d-8fcbea155f6b)

with kind regards and happy new year
Bernd

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/was_wolfsburg_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/was_wolfsburg_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/was_wolfsburg_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/was_wolfsburg_de.py
@@ -12,6 +12,14 @@
     "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
@@ -37,16 +45,21 @@ def fetch(self):
         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"))
+            entries.append(
+                Collection(date, "Gelber Sack", icon=ICON_MAP["Gelber Sack"])
+            )
 
         # fetch remaining collections
-        args = {"ortabf": self._street}
-        r = requests.post(
-            "https://was-wolfsburg.de/subabfuhrtermine/ics_abfuhrtermine3.php",
-            data=args,
+        args = {"k": self._street}
+        r = requests.get(
+            "https://was-wolfsburg.de/subabfuhrtermine/php/abfuhrtermine.php",
+            params=args,
+        )
+        match = re.findall(
+            r"(\d{2})\.(\d{2})\.(\d{4}).*?<em>\s*([A-Za-z- ]+)\s*</em>", r.text
         )
-        dates = self._ics.convert(r.text)
-        for d in dates:
-            entries.append(Collection(d[0], d[1]))
+        for m in match:
+            date = datetime.date(day=int(m[0]), month=int(m[1]), year=int(m[2]))
+            entries.append(Collection(date, m[3], icon=ICON_MAP[m[3]]))
 
         return entries


Test patch: