internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
customer: awb-ak - city: VG Daaden-Herdorf - Kernstadt Herdorf - Wrong values
I am currently trying to integrate the waste calendar into Home Assistant via “Waste Collection Schedule”. I now get entries displayed, but unfortunately they are the wrong values. I find the entry on the page: 
https://awido.cubefour.de/Customer/awb-ak/v2/Calendar2.aspx

Config:
`waste_collection_schedule:
  sources:
    - name: awido_de
      args:
        customer: awb-ak
        city: VG Daaden-Herdorf - Kernstadt Herdorf`

![1](https://user-images.githubusercontent.com/93226293/222974726-5836727b-6ce6-4553-9606-723406e5533c.png)
![2](https://user-images.githubusercontent.com/93226293/222974731-24009729-bf6c-438e-8879-2919acac17b5.png)



Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/awido_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/awido_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/awido_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/awido_de.py
@@ -226,6 +226,10 @@ def EXTRA_INFO():
         "street": "Ahornweg",
         "housenumber": 1,
     },
+    "Daaden-Herdorf": {
+        "customer": "awb-ak",
+        "city": "VG Daaden-Herdorf - Kernstadt Herdorf",
+    }
 }
 
 _LOGGER = logging.getLogger(__name__)
@@ -265,12 +269,7 @@ def fetch(self):
             streets = r.json()
 
             # create street to key map from retrieved places
-            street_to_oid = {
-                street["value"].strip(): street["key"] for (street) in streets
-            }
-
-            if self._street in street_to_oid:
-                oid = street_to_oid[self._street]
+            oid = streets[0]["key"]
 
         else:
             # street specified


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
Source Request: Rotherham Council. 
If possible please add Rotherham Council many thanks

https://www.rotherham.gov.uk/homepage/333/bin-collection-dates?address=


Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/rotherham_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/rotherham_gov_uk.py
new file mode 100644
--- /dev/null
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/rotherham_gov_uk.py
@@ -0,0 +1,54 @@
+import requests
+from waste_collection_schedule import Collection  # type: ignore[attr-defined]
+from datetime import datetime
+from bs4 import BeautifulSoup
+
+TITLE = "Rotherham Metropolitan Borough Council"
+DESCRIPTION = "Source for Rotherham Metropolitan Borough Council."
+URL = "www.rotherham.gov.uk"
+TEST_CASES = {
+    "374 Kimberworth Park Rd": {"uprn": 100050846673},
+    "76 Dovedale Road": {"uprn": 100050831650},
+    "12 Bosville St, Rotherham": {"uprn": "100050818634"},
+    "40 Spring St, Rotherham": {"uprn": "100050869740"},
+}
+
+
+ICON_MAP:dict[str, str] = {
+    "Pink lid bin": "mdi:trash-can",
+    "Brown bin": "mdi:leaf",
+    "Green bin": "mdi:package-variant",
+    "Black bin": "mdi:recycle",
+}
+
+
+API_URL = "https://www.rotherham.gov.uk/homepage/333/bin-coll"
+
+
+class Source:
+    def __init__(self, uprn: str | int):
+        self._uprn: str | int = uprn
+
+    def fetch(self):
+        args = {
+            "address": self._uprn
+        }
+
+        # get json file
+        r = requests.get(API_URL, params=args)
+        r.raise_for_status()
+
+        soup = BeautifulSoup(r.text, "html.parser")        
+        rows = soup.find("div", class_="widget-bin-collection").find("table").find("tbody").find_all("tr")
+
+        entries = []
+        for row in rows:
+            columns = row.find_all("td")
+            bin_type = columns[0].text.strip()
+            date_str = columns[1].text.strip()
+
+            date = datetime.strptime(date_str, "%A, %d %B %Y").date()
+            icon = ICON_MAP.get(bin_type) # Collection icon
+            entries.append(Collection(date=date, t=bin_type, icon=icon))
+
+        return entries


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
fixing abki_de recycling
fix for #891


Discussion:
There is another occurance of the test data in the source:
https://github.com/mampfes/hacs_waste_collection_schedule/blob/996b43dc51d18a766589b77b96c027c0ef04917a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abki_de.py#L93

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abki_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/abki_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/abki_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/abki_de.py
@@ -90,7 +90,7 @@ def fetch(self):
             try:
                 r = session.get("https://abki.de/abki-services/leerungen-data", params={
                     "Zeitraum": now.year+1,
-                    "Strasse_input": "Aarhusstraße",
+                    "Strasse_input": self._street,
                     "Strasse": street_id,
                     "IDSTANDORT_input": 2,
                     "IDSTANDORT": standort_id,


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
(Berliner Stadtreinigung) BSR not working
Hi there, since about a day or two BSR integration isn't pulling data into HA. 
Any idea what might be wrong? Just FYI the data from abfall.io (ALBA Berlin) is working just fine. 

Sorry for not posting code / log, but I'm unsure, what I should be posting. 


Discussion:
Same Problem here. But I think it's an issue on their side.
Even when you visit the homepage directly you can't even search for streets. So maybe give them some time to fix the database. 
Yes. I tend to agree. Just wanted to flag, in case they are changing
something on the backend that would necessitate changes here.

:-)

chris1601 ***@***.***> schrieb am So., 9. Apr. 2023, 07:39:

> Same Problem here. But I think it's an issue on their side.
> Even when you visit the homepage directly you can't even search for
> streets. So maybe give them some time to fix the database.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/mampfes/hacs_waste_collection_schedule/issues/857#issuecomment-1501046892>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AXX2BYGPVOLRDAARFPUAWWDXAJDP5ANCNFSM6AAAAAAWXNIIWE>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>


Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/bsr_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/bsr_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/bsr_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/bsr_de.py
@@ -28,7 +28,7 @@ class Source:
     def __init__(self, abf_strasse, abf_hausnr):
         self._abf_strasse = abf_strasse
         self._abf_hausnr = abf_hausnr
-        self._ics = ICS()
+        self._ics = ICS(offset=1)
 
     def fetch(self):
         # get cookie


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
Ku-ring-gai Council doesn't work if there is a house number 1A
works - 1A Latona Street PYMBLE 2073
doesn't work - 1 Latona Street PYMBLE 2073

Both exist


Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/kuringgai_nsw_gov_au.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/kuringgai_nsw_gov_au.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/kuringgai_nsw_gov_au.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/kuringgai_nsw_gov_au.py
@@ -28,8 +28,21 @@
         "street_name": "Kitchener Street",
         "street_number": "99/2-8",
     },
+    "1 Latona St": {
+        "post_code": "2073",
+        "suburb": "PYMBLE",
+        "street_name": "Latona Street",
+        "street_number": "1",
+    },
+    "1A Latona St": {
+        "post_code": "2073",
+        "suburb": "PYMBLE",
+        "street_name": "Latona Street",
+        "street_number": "1A",
+    },
 }
 
+
 API_URLS = {
     "session":"https://www.krg.nsw.gov.au" ,
     "search": "https://www.krg.nsw.gov.au/api/v1/myarea/search?keywords={}",
@@ -77,16 +90,12 @@ def fetch(self):
         address = "{} {}, {} NSW {}".format(self.street_number, self.street_name, self.suburb, self.post_code)
         q = requote_uri(str(API_URLS["search"]).format(address))
         r1 = s.get(q, headers = HEADERS)
-        data = json.loads(r1.text)
+        data = json.loads(r1.text)["Items"]
 
         # Find the geolocation for the address
-        for item in data["Items"]:
+        for item in data:
             if address in item['AddressSingleLine']:
                 locationId = item["Id"]
-            break
-
-        if locationId == 0:
-            return []
 
         # Retrieve the upcoming collections for location
         q = requote_uri(str(API_URLS["schedule"]).format(locationId))


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
South Glos UK doesn't return all Recycling / Food Bin dates
The South Gloucester UK source is only returning the Food Bin and Recycling bins every other week, when they should be every week.

Calendar in HA shows like this for me:
![image](https://github.com/mampfes/hacs_waste_collection_schedule/assets/4178651/ac283ac4-584a-429d-a20b-3f0dcf3a28c6)

The South Glos webpage shows:
![image](https://github.com/mampfes/hacs_waste_collection_schedule/assets/4178651/9ec0502d-0fc9-48a5-a16b-a44d69409f5f)

And the service endpoint that you are querying replies with:
![image](https://github.com/mampfes/hacs_waste_collection_schedule/assets/4178651/5f7dc0ec-762f-40a1-93a7-8824ac8c91e9)

I could put a PR in to treat the Rx dates as Recycling and Food as well?


Discussion:
Is this a problem with all addresses or just yours (your neighbourhood)? 
If it's a problem for all addresses feel free to make a PR

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/southglos_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/southglos_gov_uk.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/southglos_gov_uk.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/southglos_gov_uk.py
@@ -32,8 +32,11 @@ def fetch(self):
         r.raise_for_status()
         output = r.text.strip('[]')
         output = json.loads(output)
-        recycling_and_food_bin_dates = [output['C1'], output['C2'], output['C3']]
+        # Recycling and food are fields starting with C and R
+        recycling_and_food_bin_dates = [output['C1'], output['C2'], output['C3'], output['R1'], output['R2'], output['R3']]
+        # Black bin dates are fields starting R
         black_bin_dates = [output['R1'], output['R2'], output['R3']]
+        # Garden bin dates are fields starting G
         garden_bin_dates = [output['G1'], output['G2'], output['G3']]
         entries = []  # List that holds collection schedule
 


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Feature]: Add support for Christchurch (NZ) special date overrides
### I propose a feature for:

Sources

### Describe your wanted feature

The API for collection dates for Christchurch City Council does not automatically apply any special date overrides (for example, when your collection day falls near a public holiday and is moved).
A separate URL provides a list of these potential overrides, it needs to be called separately and the results merged.

The URL is [https://ccc.govt.nz/api/kerbsidedateoverrides](https://ccc.govt.nz/api/kerbsidedateoverrides)
It responds to HTTP GET with no authentication requirements and will return an array of overrides dates in this format:
```
{
    ID: 32,
    Title: "New Year Friday 2024",
    OriginalDate: "2024-01-05",
    NewDate: "2024-01-06",
    Expired: 0
}
```
If your collection date falls on `OriginalDate` it needs to be moved to `NewDate`.


Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/ccc_govt_nz.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/ccc_govt_nz.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/ccc_govt_nz.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/ccc_govt_nz.py
@@ -54,6 +54,16 @@ def fetch(self):
         # Deduplicate the Bins in case the Rating Unit has more than one of the same Bin type
         bins = {each["material"]: each for each in bins["bins"]["collections"]}.values()
 
+        # Get the list of Overrides for any special dates
+        # It will be an array of these: { ID: 32, Title: "New Year Friday 2024", OriginalDate: "2024-01-05", NewDate: "2024-01-06", Expired: 0 }
+        overrides = requests.get("https://ccc.govt.nz/api/kerbsidedateoverrides").json()
+
+        # Process each Override
+        for bin in bins:
+            for override in overrides:
+                if override["OriginalDate"] == bin["next_planned_date_app"]:
+                    bin["next_planned_date_app"] = override["NewDate"]
+
         # Process each Bin
         for bin in bins:
             entries.append(


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Feature]: paper dates are not in the complete date-file
### I propose a feature for:

Sources

### Describe your wanted feature

Hi,
right now I saw that the homepage "https://www.geoport-nwm.de/de/abfuhrtermine-geoportal.html" describes 3 ics files for paper-dates: 
Please can you add them to the integrsation, because I need to add them manually now.

Kalenderdatei AltpapiertonneGER Umweltschutz GmbH | downloaden (ICS)
Kalenderdatei AltpapiertonneGollan Recycling GmbH | downloaden (ICS)
Kalenderdatei AltpapiertonneVeolia Umweltservice Nord GmbH | downloaden (ICS)



Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/geoport_nwm_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/geoport_nwm_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/geoport_nwm_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/geoport_nwm_de.py
@@ -16,6 +16,8 @@
     "kl. Bünsdorf": {"district": "Klein Bünsdorf"},
 }
 
+API_URL = "https://www.geoport-nwm.de/nwm-download/Abfuhrtermine/ICS/{year}/{arg}.ics"
+
 
 class Source:
     def __init__(self, district):
@@ -45,22 +47,35 @@ def fetch(self):
 
     def fetch_year(self, year):
         arg = convert_to_arg(self._district)
-        r = requests.get(
-            f"https://www.geoport-nwm.de/nwm-download/Abfuhrtermine/ICS/{year}/{arg}.ics"
-        )
+        r = requests.get(API_URL.format(year=year, arg=arg))
         r.raise_for_status()
-        return self._ics.convert(r.text)
+        entries = self._ics.convert(r.text)
+        for prefix in (
+            "Schadstoffmobil",
+            "Papiertonne_GER",
+            "Papiertonne_Gollan",
+            "Papiertonne_Veolia",
+        ):
+            try:
+                r = requests.get(API_URL.format(year=year, arg=f"{prefix}_{arg}"))
+                r.raise_for_status()
+                new_entries = self._ics.convert(r.text)
+                entries.extend(new_entries)
+            except (ValueError, requests.exceptions.HTTPError):
+                pass
+        return entries
 
 
-def convert_to_arg(district):
+def convert_to_arg(district, prefix=""):
     district = district.replace("(1.100 l Behälter)", "1100_l")
     district = district.replace("ü", "ue")
     district = district.replace("ö", "oe")
     district = district.replace("ä", "ae")
     district = district.replace("ß", "ss")
     district = district.replace("/", "")
-    district = district.replace("- ", "-")
+    # district = district.replace("- ", "-") failed with Seefeld/ Testorf- Steinfort
     district = district.replace(".", "")
     district = district.replace(" ", "_")
-    arg = urllib.parse.quote("Ortsteil_" + district)
+    prefix = prefix + "_" if prefix else ""
+    arg = urllib.parse.quote(f"{prefix}Ortsteil_{district}")
     return arg


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Source Request]: 
### Municipality / Region

Bedburg

### Collection Calendar Webpage

https://buerger-portal-bedburg.azurewebsites.net/calendar/

### Example Address

Am Schirkerhof 2, Bedburg, Broich

### Collection Data Format

Something different (add to additional information)

### Additional Information

The city of Bedburg change its Waste Collection Provider. Thus the old Abfall+ Source doesn't work anymore. The new provider is Drekopf. Unfortunately they do not use the existing Drekopf API. The Webpage provided by Drekopf has multiple outputs. You can download the calendar via PDF, XLS, CSV and ICS, but i can't find the url. The underlying API seems to be C-Trace, but when calling this API, credentials are requested. Maybe i am missing something...


Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/buergerportal_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/buergerportal_de.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/buergerportal_de.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/buergerportal_de.py
@@ -77,6 +77,12 @@ def EXTRA_INFO():
         "api_url": "https://biedenkopfmzv.buergerportal.digital/api",
         "operator": "biedenkopf",
     },
+    {
+        "title": "Bürgerportal Bedburg",
+        "url": "https://www.bedburg.de/",
+        "api_url": "https://buerger-portal-bedburg.azurewebsites.net",
+        "operator": "bedburg",
+    },
 ]
 
 


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
Braintree error when selecting address
I have had the follow error for the past couple of months:

> fetch failed for source Braintree District Council: 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/braintree_gov_uk.py", line 45, in fetch id = next( ^^^^^ StopIteration

I am seeing address["value"] on line 43 having a length of 11.
Removing this line cures the problem for me, and I am not sure what this line is achieving?

https://github.com/mampfes/hacs_waste_collection_schedule/blob/73baeef472c5db4c85db3a7b725df68f3a15a101/custom_components/waste_collection_schedule/waste_collection_schedule/source/braintree_gov_uk.py#L43


Discussion:

Resolving patch:
diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/braintree_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/braintree_gov_uk.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/braintree_gov_uk.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/braintree_gov_uk.py
@@ -1,7 +1,7 @@
 import requests
 from bs4 import BeautifulSoup
 from dateutil import parser
-from waste_collection_schedule import Collection
+from waste_collection_schedule import Collection  # type: ignore[attr-defined]
 
 TITLE = "Braintree District Council"
 DESCRIPTION = "Braintree District Council, UK - Waste Collection"
@@ -40,7 +40,7 @@ def fetch(self):
         for address in BeautifulSoup(address_lookup.text, "html.parser").find_all(
             "option"
         ):
-            if len(address["value"]) == 12:
+            if len(address["value"]) > 5:  # Skip the first option
                 addresses[address["value"]] = address.text.strip()
         id = next(
             address


Test patch:
Repository: mampfes/hacs_waste_collection_schedule

Issue:
[Bug]: adur_worthing_gov_uk has changed format of address
### I Have A Problem With:

A specific source

### What's Your Problem

The Adur and Worthing council used to return my address as “12 Roadname”, so that’s what I had in my source args. But the format has recently changed to “12 ROADNAME”, causing the lookup in adur_worthing_gov_uk.py to fail. 

As the council is just as likely to change it back at some point can I suggest that the lookup is made case independent?

### Source (if relevant)

adur_worthing_gov_uk

### Logs

_No response_

### Relevant Configuration

_No response_

### Checklist Source Error

- [X] Use the example parameters for your source (often available in the documentation) (don't forget to restart Home Assistant after changing the configuration)
- [X] Checked that the website of your service provider is still working
- [X] 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

- [X] 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/adur_worthing_gov_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/adur_worthing_gov_uk.py
--- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/adur_worthing_gov_uk.py
+++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/adur_worthing_gov_uk.py
@@ -27,7 +27,6 @@ def __init__(self, postcode, address):
         self._address = address
 
     def fetch(self):
-
         if self._postcode is None or self._address is None:
             raise ValueError("Either postcode or address is None")
 
@@ -43,7 +42,7 @@ def fetch(self):
 
         found_address = None
         for address in addresses_select.find_all("option"):
-            if self._address in address.get_text():
+            if self._address.upper() in address.get_text().upper():
                 found_address = address
 
         if found_address is None:


Test patch: