Repository: mampfes/hacs_waste_collection_schedule

Issue:
missing file or path in source: aha_region_de.py
Hi,
I recently installed Version 1.42.0 using HACS and cant get it to run.
Changed the adress to one of the test-adresses, but same issue.

That home directory '/home/silas/tmp/test.html' seems like debug file for some server-responds. But thats not going to work :)

Any ideas?

Thanks for your help!

configuration.yaml
```
waste_collection_schedule:
  sources:
    - name: aha_region_de
      args:
        gemeinde: "Hannover"
        strasse: "Voltastr. / Vahrenwald"
        hnr: "25"
        zusatz: ""
```

```
Logger: waste_collection_schedule.source_shell
Source: custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py:136
Integration: waste_collection_schedule (documentation)
First occurred: 20:08:22 (2 occurrences)
Last logged: 20:09:05

fetch failed for source Zweckverband Abfallwirtschaft Region Hannover: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py", line 134, in fetch entries = self._source.fetch() ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/aha_region_de.py", line 85, in fetch with open("/home/silas/tmp/test.html", "w") as f: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/home/silas/tmp/test.html'`
```


Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/aha_region_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/aha_region_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/aha_region_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/aha_region_de.py
@@ -1,8 +1,7 @@
-from waste_collection_schedule import Collection  # type: ignore[attr-defined]
-from waste_collection_schedule.service.ICS import ICS
-
 import requests
 from bs4 import BeautifulSoup
+from waste_collection_schedule import Collection  # type: ignore[attr-defined]
+from waste_collection_schedule.service.ICS import ICS
 
 TITLE = "Zweckverband Abfallwirtschaft Region Hannover"
 DESCRIPTION = "Source for Zweckverband Abfallwirtschaft Region Hannover."
@@ -14,9 +13,9 @@
         "hnr": 1,
     },
     "Isernhagen, Am Lohner Hof / Isernhagen Fb, 10": {
-       "gemeinde": "Isernhagen",
-       "strasse": "Am Lohner Hof / Isernhagen Fb",
-       "hnr": "10",
+        "gemeinde": "Isernhagen",
+        "strasse": "Am Lohner Hof / Isernhagen Fb",
+        "hnr": "10",
     },
     "Hannover, Voltastr. / Vahrenwald, 25": {
         "gemeinde": "Hannover",
@@ -28,7 +27,7 @@
         "strasse": "Melanchthonstr.",
         "hnr": "10",
         "zusatz": "A",
-    }
+    },
 }
 
 ICON_MAP = {
@@ -41,8 +40,11 @@
 
 API_URL = "https://www.aha-region.de/abholtermine/abfuhrkalender"
 
+
 class Source:
-    def __init__(self, gemeinde: str, strasse: str, hnr: str | int, zusatz: str | int = ""):
+    def __init__(
+        self, gemeinde: str, strasse: str, hnr: str | int, zusatz: str | int = ""
+    ):
         self._gemeinde: str = gemeinde
         self._strasse: str = strasse
         self._hnr: str = str(hnr)
@@ -51,18 +53,31 @@ def __init__(self, gemeinde: str, strasse: str, hnr: str | int, zusatz: str | in
 
     def fetch(self):
         # find strassen_id
-        r = requests.get(API_URL, params={"gemeinde": self._gemeinde, "von": "A", "bis": "["})
+        r = requests.get(
+            API_URL, params={"gemeinde": self._gemeinde, "von": "A", "bis": "["}
+        )
         r.raise_for_status()
 
         strassen_id = None
-        selects = BeautifulSoup(r.text, "html.parser").find("select", {"id": "strasse"}).find_all("option")
+        selects = (
+            BeautifulSoup(r.text, "html.parser")
+            .find("select", {"id": "strasse"})
+            .find_all("option")
+        )
         for select in selects:
-            if select.text.lower().replace(" ", "") == self._strasse.lower().replace(" ", ""):
+            if select.text.lower().replace(" ", "") == self._strasse.lower().replace(
+                " ", ""
+            ):
                 strassen_id = select["value"]
                 break
 
         if not strassen_id:
-            raise Exception("Street not found for gemeinde: " + self._gemeinde + " and strasse: " + self._strasse)
+            raise Exception(
+                "Street not found for gemeinde: "
+                + self._gemeinde
+                + " and strasse: "
+                + self._strasse
+            )
 
         # request overview page
         args = {
@@ -82,9 +97,9 @@ def fetch(self):
         download_buttons = soup.find_all("button", {"name": "ical_apple"})
 
         if not download_buttons:
-            with open("/home/silas/tmp/test.html", "w") as f:
-                f.write(r.text)
-            raise Exception("Invalid response from server, check you configuration if it is correct.")
+            raise Exception(
+                "Invalid response from server, check you configuration if it is correct."
+            )
 
         entries = []
 


Test patch: