Skip to content

Commit

Permalink
Merge branch 'mampfes:master' into fix_rushcliffe
Browse files Browse the repository at this point in the history
  • Loading branch information
ribz authored Dec 14, 2024
2 parents 138bb3f + 973f2d0 commit 660e872
Show file tree
Hide file tree
Showing 20 changed files with 410 additions and 96 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ If your service provider is not listed, feel free to open a [source request issu
- [Hagenberg im Mühlkreis](/doc/source/citiesapps_com.md) / hagenberg.at
- [Hannersdorf](/doc/source/citiesapps_com.md) / hannersdorf.at
- [Hartberg](/doc/source/citiesapps_com.md) / hartberg.at
- [Hausmannstätten](/doc/source/hausmannstaetten_gv_at.md) / hausmannstaetten.gv.at
- [Heiligenblut am Großglockner](/doc/ics/muellapp_com.md) / muellapp.com
- [Heiligenkreuz](/doc/source/citiesapps_com.md) / heiligenkreuz.at
- [Heiligenkreuz am Waasen](/doc/source/citiesapps_com.md) / heiligenkreuz-waasen.gv.at
Expand Down Expand Up @@ -758,7 +759,8 @@ If your service provider is not listed, feel free to open a [source request issu
- [Abfallwirtschaft Ortenaukreis](/doc/source/abfall_io.md) / abfallwirtschaft-ortenaukreis.de
- [Abfallwirtschaft Pforzheim](/doc/source/abfallwirtschaft_pforzheim_de.md) / abfallwirtschaft-pforzheim.de
- [Abfallwirtschaft Potsdam-Mittelmark (APM)](/doc/ics/apm_de.md) / apm-niemegk.de
- [Abfallwirtschaft Rems-Murr](/doc/source/awido_de.md) / abfallwirtschaft-rems-murr.de
- [Abfallwirtschaft Rems-Murr (AWRM) - AWIDO Version](/doc/source/awido_de.md) / abfallwirtschaft-rems-murr.de
- [Abfallwirtschaft Rems-Murr (AWRM) - ICS Version](/doc/ics/abfallwirtschaft_rems_murr_de.md) / abfallwirtschaft-rems-murr.de
- [Abfallwirtschaft Rendsburg](/doc/source/awr_de.md) / awr.de
- [Abfallwirtschaft Rheingau-Taunus-Kreis](/doc/source/c_trace_de.md) / eaw-rheingau-taunus.de
- [Abfallwirtschaft Sonneberg](/doc/ics/abfallwirtschaft_sonneberg_de.md) / abfallwirtschaft-sonneberg.de
Expand Down
14 changes: 13 additions & 1 deletion custom_components/waste_collection_schedule/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,12 @@
"default_params": {},
"id": "citiesapps_com"
},
{
"title": "Hausmannst\u00e4tten",
"module": "hausmannstaetten_gv_at",
"default_params": {},
"id": "hausmannstaetten_gv_at"
},
{
"title": "Heiligenblut am Gro\u00dfglockner",
"module": "ics",
Expand Down Expand Up @@ -4392,13 +4398,19 @@
"id": "ics_apm_de"
},
{
"title": "Abfallwirtschaft Rems-Murr",
"title": "Abfallwirtschaft Rems-Murr (AWRM) - AWIDO Version",
"module": "awido_de",
"default_params": {
"customer": "rmk"
},
"id": "awido_de"
},
{
"title": "Abfallwirtschaft Rems-Murr (AWRM) - ICS Version",
"module": "ics",
"default_params": {},
"id": "ics_abfallwirtschaft_rems_murr_de"
},
{
"title": "Abfallwirtschaft Rendsburg",
"module": "awr_de",
Expand Down
60 changes: 60 additions & 0 deletions custom_components/waste_collection_schedule/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,24 @@
},
"data_description": {}
},
"args_hausmannstaetten_gv_at": {
"title": "Quelle konfigurieren",
"description": "Konfiguriere deinen Service Provider. Mehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hausmannstaetten_gv_at.md",
"data": {
"calendar_title": "Kalender Titel"
},
"data_description": {
"calendar_title": "Ein lesbarerer oder benutzerfreundlicherer Name für den Müllkalender. Wenn nichts angegeben wird, wird der Name der Quelle verwendet."
}
},
"reconfigure_hausmannstaetten_gv_at": {
"title": "Quelle Neu Konfigurieren",
"description": "Konfiguriere deinen Service Provider. Mehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hausmannstaetten_gv_at.md",
"data": {
"calendar_title": "Kalender Titel"
},
"data_description": {}
},
"args_infeo_at": {
"title": "Quelle konfigurieren",
"description": "Konfiguriere deinen Service Provider. Mehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/infeo_at.md",
Expand Down Expand Up @@ -3786,6 +3804,48 @@
},
"data_description": {}
},
"args_ics_abfallwirtschaft_rems_murr_de": {
"title": "Quelle konfigurieren",
"description": "Konfiguriere deinen Service Provider. \n\n- Gehen Sie zu https://www.abfallwirtschaft-rems-murr.de/muell-entsorgen/ihr-abfallkalender und wählen Sie Ihren Ort, Straße und Hausnummer aus.\n- Wählen Sie die gewünschten Abfallarten aus.\n- Die Auswahl des Jahres kann ignoriert werden, falls sie angezeigt wird. Klicken Sie auf `Weiter`.\n- Unter `ical-Kalenderabo`, lassen Sie sich die URL anzeigen und kopieren Sie diese, oder klicken auf `URL in die Zwischenablage kopieren`.\n- Ersetzen Sie die `url` in der Beispielkonfiguration durch diesen Link.\n\n\nMehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/ics/abfallwirtschaft_rems_murr_de.md",
"data": {
"calendar_title": "Kalender Titel",
"file": "Datei",
"headers": "Headers",
"method": "Methode",
"offset": "Offset",
"params": "Parameter",
"regex": "Regulärer Ausdruck",
"split_at": "Trennen bei",
"title_template": "Titelvorlage",
"url": "URL",
"verify_ssl": "SSL-Verifizierung aktivieren",
"version": "Version",
"year_field": "Jahresfeld"
},
"data_description": {
"calendar_title": "Ein lesbarerer oder benutzerfreundlicherer Name für den Müllkalender. Wenn nichts angegeben wird, wird der Name der Quelle verwendet."
}
},
"reconfigure_ics_abfallwirtschaft_rems_murr_de": {
"title": "Quelle Neu Konfigurieren",
"description": "Konfiguriere deinen Service Provider. \n\n- Gehen Sie zu https://www.abfallwirtschaft-rems-murr.de/muell-entsorgen/ihr-abfallkalender und wählen Sie Ihren Ort, Straße und Hausnummer aus.\n- Wählen Sie die gewünschten Abfallarten aus.\n- Die Auswahl des Jahres kann ignoriert werden, falls sie angezeigt wird. Klicken Sie auf `Weiter`.\n- Unter `ical-Kalenderabo`, lassen Sie sich die URL anzeigen und kopieren Sie diese, oder klicken auf `URL in die Zwischenablage kopieren`.\n- Ersetzen Sie die `url` in der Beispielkonfiguration durch diesen Link.\n\n\nMehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/ics/abfallwirtschaft_rems_murr_de.md",
"data": {
"calendar_title": "Kalender Titel",
"file": "Datei",
"headers": "Headers",
"method": "Methode",
"offset": "Offset",
"params": "Parameter",
"regex": "Regulärer Ausdruck",
"split_at": "Trennen bei",
"title_template": "Titelvorlage",
"url": "URL",
"verify_ssl": "SSL-Verifizierung aktivieren",
"version": "Version",
"year_field": "Jahresfeld"
},
"data_description": {}
},
"args_awr_de": {
"title": "Quelle konfigurieren",
"description": "Konfiguriere deinen Service Provider. Mehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/awr_de.md",
Expand Down
60 changes: 60 additions & 0 deletions custom_components/waste_collection_schedule/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,24 @@
},
"data_description": {}
},
"args_hausmannstaetten_gv_at": {
"title": "Configure Source",
"description": "Configure your service provider. More details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hausmannstaetten_gv_at.md.",
"data": {
"calendar_title": "Calendar Title"
},
"data_description": {
"calendar_title": "A more readable, or user-friendly, name for the waste calendar. If nothing is provided, the name returned by the source will be used."
}
},
"reconfigure_hausmannstaetten_gv_at": {
"title": "Reconfigure Source",
"description": "Configure your service provider. More details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hausmannstaetten_gv_at.md.",
"data": {
"calendar_title": "Calendar Title"
},
"data_description": {}
},
"args_infeo_at": {
"title": "Configure Source",
"description": "Configure your service provider. More details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/infeo_at.md.",
Expand Down Expand Up @@ -3795,6 +3813,48 @@
},
"data_description": {}
},
"args_ics_abfallwirtschaft_rems_murr_de": {
"title": "Configure Source",
"description": "Configure your service provider. \n\n- Go to https://www.abfallwirtschaft-rems-murr.de/muell-entsorgen/ihr-abfallkalender and select your town, street name and number.\n- Select the waste types that should be included in the waste calendar.\n- You can ignore the year selection, if present. Click `Weiter`.\n- In the `ical-Kalenderabo` section, show and copy the URL or press `URL in die Zwischenablage kopieren`.\n- Replace the `url` in the example configuration with this link.\n\n\nMore details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/ics/abfallwirtschaft_rems_murr_de.md.",
"data": {
"calendar_title": "Calendar Title",
"file": "File",
"headers": "Headers",
"method": "Method",
"offset": "Offset",
"params": "Parameters",
"regex": "Regex",
"split_at": "Split At",
"title_template": "Title Template",
"url": "Url",
"verify_ssl": "Verify Ssl",
"version": "Version",
"year_field": "Year Field"
},
"data_description": {
"calendar_title": "A more readable, or user-friendly, name for the waste calendar. If nothing is provided, the name returned by the source will be used."
}
},
"reconfigure_ics_abfallwirtschaft_rems_murr_de": {
"title": "Reconfigure Source",
"description": "Configure your service provider. \n\n- Go to https://www.abfallwirtschaft-rems-murr.de/muell-entsorgen/ihr-abfallkalender and select your town, street name and number.\n- Select the waste types that should be included in the waste calendar.\n- You can ignore the year selection, if present. Click `Weiter`.\n- In the `ical-Kalenderabo` section, show and copy the URL or press `URL in die Zwischenablage kopieren`.\n- Replace the `url` in the example configuration with this link.\n\n\nMore details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/ics/abfallwirtschaft_rems_murr_de.md.",
"data": {
"calendar_title": "Calendar Title",
"file": "File",
"headers": "Headers",
"method": "Method",
"offset": "Offset",
"params": "Parameters",
"regex": "Regex",
"split_at": "Split At",
"title_template": "Title Template",
"url": "Url",
"verify_ssl": "Verify Ssl",
"version": "Version",
"year_field": "Year Field"
},
"data_description": {}
},
"args_awr_de": {
"title": "Configure Source",
"description": "Configure your service provider. More details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/awr_de.md.",
Expand Down
60 changes: 60 additions & 0 deletions custom_components/waste_collection_schedule/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,24 @@
},
"data_description": {}
},
"args_hausmannstaetten_gv_at": {
"title": "Configurazione Sorgente",
"description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. Maggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hausmannstaetten_gv_at.md.",
"data": {
"calendar_title": "Nome Calendario"
},
"data_description": {
"calendar_title": "Puoi cambiare il nome del calendario della raccolta dei rifiuti, altrimenti di default verra' utilizzato il nome del tuo fornitore di servizi."
}
},
"reconfigure_hausmannstaetten_gv_at": {
"title": "Riconfigurazione Sorgente",
"description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. Per maggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hausmannstaetten_gv_at.md.",
"data": {
"calendar_title": "Nome Calendario"
},
"data_description": {}
},
"args_infeo_at": {
"title": "Configurazione Sorgente",
"description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. Maggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/infeo_at.md.",
Expand Down Expand Up @@ -3786,6 +3804,48 @@
},
"data_description": {}
},
"args_ics_abfallwirtschaft_rems_murr_de": {
"title": "Configurazione Sorgente",
"description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. \n\n- Go to https://www.abfallwirtschaft-rems-murr.de/muell-entsorgen/ihr-abfallkalender and select your town, street name and number.\n- Select the waste types that should be included in the waste calendar.\n- You can ignore the year selection, if present. Click `Weiter`.\n- In the `ical-Kalenderabo` section, show and copy the URL or press `URL in die Zwischenablage kopieren`.\n- Replace the `url` in the example configuration with this link.\n\n\nMaggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/ics/abfallwirtschaft_rems_murr_de.md.",
"data": {
"calendar_title": "Nome Calendario",
"file": "Nome File",
"headers": "Headers",
"method": "Metodo",
"offset": "Offset",
"params": "Parametri",
"regex": "Regex",
"split_at": "Split At",
"title_template": "Title Template",
"url": "Url",
"verify_ssl": "Verifica SSL",
"version": "Versione",
"year_field": "Year Field"
},
"data_description": {
"calendar_title": "Puoi cambiare il nome del calendario della raccolta dei rifiuti, altrimenti di default verra' utilizzato il nome del tuo fornitore di servizi."
}
},
"reconfigure_ics_abfallwirtschaft_rems_murr_de": {
"title": "Riconfigurazione Sorgente",
"description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. \n\n- Go to https://www.abfallwirtschaft-rems-murr.de/muell-entsorgen/ihr-abfallkalender and select your town, street name and number.\n- Select the waste types that should be included in the waste calendar.\n- You can ignore the year selection, if present. Click `Weiter`.\n- In the `ical-Kalenderabo` section, show and copy the URL or press `URL in die Zwischenablage kopieren`.\n- Replace the `url` in the example configuration with this link.\n\n\nPer maggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/ics/abfallwirtschaft_rems_murr_de.md.",
"data": {
"calendar_title": "Nome Calendario",
"file": "Nome File",
"headers": "Headers",
"method": "Metodo",
"offset": "Offset",
"params": "Parametri",
"regex": "Regex",
"split_at": "Split At",
"title_template": "Title Template",
"url": "Url",
"verify_ssl": "Verifica SSL",
"version": "Versione",
"year_field": "Year Field"
},
"data_description": {}
},
"args_awr_de": {
"title": "Configurazione Sorgente",
"description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. Maggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/awr_de.md.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from html.parser import HTMLParser

import requests
from bs4 import BeautifulSoup
from waste_collection_schedule import Collection # type: ignore[attr-defined]
from waste_collection_schedule.service.ICS import ICS

Expand Down Expand Up @@ -74,7 +75,49 @@ def __init__(
self._suffix = address_suffix
self._ics = ICS()

def get_zeitraum_values(self):
try:
session = requests.session()

response = session.get(
SERVLET,
params={"SubmitAction": "wasteDisposalServices"},
)
response.raise_for_status()

# Parse the HTML content
soup = BeautifulSoup(response.text, "html.parser")

# Find all input elements with the name "Zeitraum"
input_elements = soup.find_all("input", {"name": "Zeitraum"})

# Extract values
values = [
input_elem.get("value")
for input_elem in input_elements
if input_elem.get("value")
]
return values

except requests.exceptions.RequestException:
return []

def fetch(self):
available_years = self.get_zeitraum_values()

if available_years:
values = []

for year in available_years:
result = self.fetch_year(year)
values.extend(result)

return values

else:
return self.fetch_year()

def fetch_year(self, year=None):
session = requests.session()

r = session.get(
Expand All @@ -93,6 +136,10 @@ def fetch(self):
args["Hausnummer"] = str(self._hnr)
args["Hausnummerzusatz"] = self._suffix
args["SubmitAction"] = "CITYCHANGED"

if year:
args["Zeitraum"] = year

r = session.post(
SERVLET,
data=args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def EXTRA_INFO():

SERVICE_MAP = [
{
"title": "Abfallwirtschaft Rems-Murr",
"title": "Abfallwirtschaft Rems-Murr (AWRM) - AWIDO Version",
"url": "https://www.abfallwirtschaft-rems-murr.de/",
"service_id": "rmk",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def fetch(self) -> list[Collection]:
entries = []
for item in containers:
dates = item.findAll("p", {"class": "font11 text-center"})
if " " not in dates[0].text:
continue
entries.append(
Collection(
date=datetime.strptime(
Expand Down
Loading

0 comments on commit 660e872

Please sign in to comment.