Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Bug]: abfallwirtschaft_pforzheim_de has change the URL.
### I Have A Problem With:

A specific source

### What's Your Problem

The URL changes from "https://www.abfallwirtschaft-pforzheim.de/kundenportal/abfallkalender" to "https://www.abfallwirtschaft-pforzheim.de/abfallkalender". On the new Site you need to select a checkbox for the year. I think this option would disappear on the beginning of the next year. But the addon doesnt show me the calendar for 2023 anymore. Its complete empty.

### Source (if relevant)

abfallwirtschaft_pforzheim_de

### Logs

```Shell
no relevant logs
```


### Relevant Configuration

```YAML
abfallwirtschaft_pforzheim_de
```


### 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:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfallwirtschaft_pforzheim_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfallwirtschaft_pforzheim_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfallwirtschaft_pforzheim_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfallwirtschaft_pforzheim_de.py
@@ -1,3 +1,4 @@
+from datetime import datetime
 from html.parser import HTMLParser
 
 import requests
@@ -63,12 +64,21 @@ def __init__(self, street: str, house_number: int, address_suffix: str = ""):
         self._ics = ICS()
 
     def fetch(self):
+        now = datetime.now()
+        entries = self.get_data(now.year)
+        if now.month == 12:
+            try:
+                entries += self.get_data(now.year + 1)
+            except Exception:
+                pass
+        return entries
+
+    def get_data(self, year):
         session = requests.session()
 
         r = session.get(
             API_URL,
-            params={"SubmitAction": "wasteDisposalServices",
-                    "InFrameMode": "TRUE"},
+            params={"SubmitAction": "wasteDisposalServices", "InFrameMode": "TRUE"},
         )
         r.raise_for_status()
         r.encoding = "utf-8"
@@ -82,6 +92,7 @@ def fetch(self):
         args["Hausnummer"] = str(self._hnr)
         args["Hausnummerzusatz"] = self._suffix
         args["SubmitAction"] = "CITYCHANGED"
+        args["Zeitraum"] = f"Jahresübersicht {year}"
         r = session.post(
             API_URL,
             data=args,
@@ -113,9 +124,5 @@ def fetch(self):
 
         entries = []
         for d in dates:
-            entries.append(
-                Collection(
-                    d[0], d[1], ICON_MAP.get(d[1].split(" ")[0])
-                )
-            )
+            entries.append(Collection(d[0], d[1], ICON_MAP.get(d[1].split(" ")[0])))
         return entries


Test patch: