diff --git a/README.md b/README.md index 92761a37c..23c5f16fe 100644 --- a/README.md +++ b/README.md @@ -615,6 +615,7 @@ If your service provider is not listed, feel free to open a [source request issu
Belgium +- [Bep-Environnement](/doc/source/bep_environnement_be.md) / bep-environnement.be - [Hygea](/doc/source/hygea_be.md) / hygea.be - [Ittre](/doc/source/ittre_be.md) / ittre.be - [Limburg.net](/doc/ics/limburg_net.md) / limburg.net diff --git a/custom_components/waste_collection_schedule/sources.json b/custom_components/waste_collection_schedule/sources.json index 833f80ca1..7a3817119 100644 --- a/custom_components/waste_collection_schedule/sources.json +++ b/custom_components/waste_collection_schedule/sources.json @@ -3558,6 +3558,12 @@ } ], "Belgium": [ + { + "title": "Bep-Environnement", + "module": "bep_environnement_be", + "default_params": {}, + "id": "bep_environnement_be" + }, { "title": "Hygea", "module": "hygea_be", diff --git a/custom_components/waste_collection_schedule/translations/de.json b/custom_components/waste_collection_schedule/translations/de.json index 058b33003..af8fa0e69 100644 --- a/custom_components/waste_collection_schedule/translations/de.json +++ b/custom_components/waste_collection_schedule/translations/de.json @@ -2344,6 +2344,26 @@ }, "data_description": {} }, + "args_bep_environnement_be": { + "title": "Quelle konfigurieren", + "description": "Konfiguriere deinen Service Provider. \n\nHOW TO GET ARGUMENTS DESCRIPTION\n\nMehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bep_environnement_be.md", + "data": { + "calendar_title": "Kalender Titel", + "locality": "Locality" + }, + "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_bep_environnement_be": { + "title": "Quelle Neu Konfigurieren", + "description": "Konfiguriere deinen Service Provider. \n\nHOW TO GET ARGUMENTS DESCRIPTION\n\nMehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bep_environnement_be.md", + "data": { + "calendar_title": "Kalender Titel", + "locality": "Locality" + }, + "data_description": {} + }, "args_hygea_be": { "title": "Quelle konfigurieren", "description": "Konfiguriere deinen Service Provider. Mehr details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hygea_be.md", diff --git a/custom_components/waste_collection_schedule/translations/en.json b/custom_components/waste_collection_schedule/translations/en.json index e50ba0d74..bfb2bb777 100644 --- a/custom_components/waste_collection_schedule/translations/en.json +++ b/custom_components/waste_collection_schedule/translations/en.json @@ -2362,6 +2362,29 @@ }, "data_description": {} }, + "args_bep_environnement_be": { + "title": "Configure Source", + "description": "Configure your service provider. \n\nHOW TO GET ARGUMENTS DESCRIPTION\n\nMore details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bep_environnement_be.md.", + "data": { + "calendar_title": "Calendar Title", + "locality": "Locality" + }, + "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.", + "locality": "Name of the locality" + } + }, + "reconfigure_bep_environnement_be": { + "title": "Reconfigure Source", + "description": "Configure your service provider. \n\nHOW TO GET ARGUMENTS DESCRIPTION\n\nMore details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bep_environnement_be.md.", + "data": { + "calendar_title": "Calendar Title", + "locality": "Locality" + }, + "data_description": { + "locality": "Name of the locality" + } + }, "args_hygea_be": { "title": "Configure Source", "description": "Configure your service provider. More details: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/hygea_be.md.", diff --git a/custom_components/waste_collection_schedule/translations/it.json b/custom_components/waste_collection_schedule/translations/it.json index aff677a46..0b8a0bff8 100644 --- a/custom_components/waste_collection_schedule/translations/it.json +++ b/custom_components/waste_collection_schedule/translations/it.json @@ -2323,6 +2323,26 @@ }, "data_description": {} }, + "args_bep_environnement_be": { + "title": "Configurazione Sorgente", + "description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. \n\nHOW TO GET ARGUMENTS DESCRIPTION\n\nMaggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bep_environnement_be.md.", + "data": { + "calendar_title": "Nome Calendario", + "locality": "Locality" + }, + "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_bep_environnement_be": { + "title": "Riconfigurazione Sorgente", + "description": "Compila i campi per ottenere le informazioni sul tuo servizio di raccolta. \n\nHOW TO GET ARGUMENTS DESCRIPTION\n\nPer maggiori informazioni: https://github.com/mampfes/hacs_waste_collection_schedule/blob/master/doc/source/bep_environnement_be.md.", + "data": { + "calendar_title": "Nome Calendario", + "locality": "Locality" + }, + "data_description": {} + }, "args_hygea_be": { "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/hygea_be.md.", diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/bep_environnement_be.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/bep_environnement_be.py new file mode 100644 index 000000000..7c2f589e4 --- /dev/null +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/bep_environnement_be.py @@ -0,0 +1,129 @@ +from datetime import datetime +from typing import List +import requests +from bs4 import BeautifulSoup +import json +from waste_collection_schedule.exceptions import SourceArgumentException +from waste_collection_schedule import Collection + +TITLE = "Bep-Environnement" +DESCRIPTION = "Source for Bep Environnement garbage collection" # Describe your source +# Insert url to service homepage. URL will show up in README.md and info.md +URL = "https://www.bep-environnement.be" +TEST_CASES = { # Insert arguments for test cases to be used by test_sources.py script + "Dinant": {"locality": "Dinant"}, +} + +WASTE_MAP = { + # Déchers ménagers + organique + "dmorga": {"type": "DM & Organiques", "icon": "mdi:trash-can"}, + # PMC + "pmc": {"type": "PMC", "icon": "mdi:recycle"}, + # Papiers cartons + "papierscartons": {"type": "Papiers & Cartons", "icon": "mdi:leaf"} +} + +#### Arguments affecting the configuration GUI #### + +HOW_TO_GET_ARGUMENTS_DESCRIPTION = { # Optional dictionary to describe how to get the arguments, will be shown in the GUI configuration form above the input fields, does not need to be translated in all languages + "en": "HOW TO GET ARGUMENTS DESCRIPTION", +} + +PARAM_DESCRIPTIONS = { # Optional dict to describe the arguments, will be shown in the GUI configuration below the respective input field + "en": { + "locality": "Name of the locality" + } +} + + +def GetCitiesValue() -> List[dict]: + """Return id for each city available in calendar + + Returns: + List[dict]: key is the city, value is the id for the calendar + """ + response = requests.get(URL) + soup = BeautifulSoup(response.text, 'html.parser') + + # Find all