Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion custom_components/waste_collection_schedule/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -12235,6 +12235,12 @@
"default_params": {},
"id": "ics_bettembourg_lu"
},
{
"title": "Betzdorf",
"module": "betzdorf_lu",
"default_params": {},
"id": "betzdorf_lu"
},
{
"title": "Esch-sur-Alzette",
"module": "esch_lu",
Expand Down Expand Up @@ -16683,4 +16689,4 @@
"id": "ics_recollect"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

"""
Support for Betzdorf waste collection schedule.

For more details about this platform, please refer to the documentation at
https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/betzdorf_lu.md
"""

from datetime import datetime

import requests
from waste_collection_schedule import Collection

TITLE = "Betzdorf"
DESCRIPTION = "Source for Betzdorf, Luxembourg waste collection."
URL = "https://www.betzdorf.lu"
TEST_CASES = {
"Betzdorf": {},
}

ICON_MAP = {
"centre-de-ressources-recyclingpark-superdreckskescht": "mdi:recycle",
"dechets-menagers-hausmull-exception": "mdi:trash-can",
"dechets-biodegradables-biomull-exception": "mdi:leaf",
"valorlux": "mdi:package-variant",
"verre-papiers-altglas-altpapier": "mdi:bottle-wine",
}

API_URL = "https://www.betzdorf.lu/fr/waste"


class Source:
def __init__(self):
pass

def fetch(self):
# Fetch data from API with SSL verification disabled
# (due to certificate issues with betzdorf.lu website)
r = requests.get(API_URL, verify=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You say disabled but you set verify=Ture and I get a ssl error when testing

r.raise_for_status()

data = r.json()

entries = []

for waste_type in data:
slug = waste_type.get("slug", "")
title = waste_type.get("title", "")
dates = waste_type.get("dates", [])

# Get icon based on slug
icon = ICON_MAP.get(slug, "mdi:trash-can")

# Process each date
for date_entry in dates:
date_start = date_entry.get("dateStart")
if date_start:
# Parse the date (format: 2025-11-08T00:00:00)
collection_date = datetime.fromisoformat(date_start).date()

entries.append(
Collection(
date=collection_date,
t=title,
icon=icon,
)
)

return entries
15 changes: 15 additions & 0 deletions doc/source/betzdorf_lu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Support for schedules provided by [[https://www.betzdorf.lu/waste](https://www.betzdorf.lu/fr/waste)](https://www.betzdorf.lu/fr/waste).


### Configuration Variables

*(no args required)*

## Example

```yaml
waste_collection_schedule:
sources:
- name: betzdorf_lu
args: {}
```