Waste Collection Schedule Framework

I have a problem with the integration (Austria, Umweltprofis)
The integration worked perfectly until a month ago.
Now i get this error message:

Logger: waste_collection_schedule.scraper
Source: custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py:124
Integration: waste_collection_schedule ([documentation](https://github.com/mampfes/hacs_waste_collection_schedule#readme))
First occurred: 12:14:17 PM (1 occurrences)
Last logged: 12:14:17 PM

fetch failed for source UMWELTPROFIS: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/icalendar/parser.py", line 340, in parts validate_token(name) File "/usr/local/lib/python3.9/site-packages/icalendar/parser.py", line 128, in validate_token raise ValueError(name) ValueError: <?xml version="1.0" encoding="utf-8"?> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py", line 122, in fetch entries = self._source.fetch() File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/data_umweltprofis_at.py", line 29, in fetch dates = self._ics.convert(fixed_text) File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 28, in convert events = icalevents.events( File "/usr/local/lib/python3.9/site-packages/icalevents/icalevents.py", line 50, in events found_events += parse_events(content, start=start, end=end) File "/usr/local/lib/python3.9/site-packages/icalevents/icalparser.py", line 252, in parse_events calendar = Calendar.from_ical(content) File "/usr/local/lib/python3.9/site-packages/icalendar/cal.py", line 330, in from_ical name, params, vals = line.parts() File "/usr/local/lib/python3.9/site-packages/icalendar/parser.py", line 352, in parts raise ValueError( ValueError: Content line could not be parsed into parts: '<?xml version="1.0" encoding="utf-8"?>': <?xml version="1.0" encoding="utf-8"?>

The sensors show ā€œunknownā€
How can i resolve this issue?
I already tried to update the URL but it did not helpā€¦

thanks!

I am not able to integrate ā€œAbfall Kreis TĆ¼bingenā€ also I couldnā€™t find the py file for TĆ¼bingen in the source.

Use awido_de for Abfall Kreis TĆ¼bingen.

1 Like

Do you still have this issue? The source is working on my machine with a dummy address (Ebensee).

Since a few days I am having problems when querying Abfall Plus (Stadt Essen / EBE). The months ago everything was working fine. Now I see this error in the logs:

fetch failed for source AbfallPlus: Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/icalendar/parser.py", line 340, in parts validate_token(name) File "/usr/local/lib/python3.9/site-packages/icalendar/parser.py", line 128, in validate_token raise ValueError(name) ValueError: <br /> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py", line 122, in fetch entries = self._source.fetch() File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/abfall_io.py", line 130, in fetch dates = self._ics.convert(ics_file) File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/service/ICS.py", line 28, in convert events = icalevents.events( File "/usr/local/lib/python3.9/site-packages/icalevents/icalevents.py", line 50, in events found_events += parse_events(content, start=start, end=end) File "/usr/local/lib/python3.9/site-packages/icalevents/icalparser.py", line 252, in parse_events calendar = Calendar.from_ical(content) File "/usr/local/lib/python3.9/site-packages/icalendar/cal.py", line 330, in from_ical name, params, vals = line.parts() File "/usr/local/lib/python3.9/site-packages/icalendar/parser.py", line 352, in parts raise ValueError( ValueError: Content line could not be parsed into parts: '<br />': <br />

Anyone else having trouble when using Abfall Plus in the last couple of days?

My wcs is running correctly since I successfully set it up with your support.
Now I discovered that the local provider differs between two sizes of the paper trash bin. One they simply call ā€œPapiertonneā€ and the other ā€œPapiertonne 1100ā€.
My sensor makes no difference between the two and so in my calendar both show up.
How to setup the sensor to see only ā€œPapiertonneā€ in my calendar? I use it for an automation.

  • type: Papiertonne
    mdi: trash-can

Did you get this sorted out? Iā€™ve just installed hacs_waste_collection_schedule and trying to get my head around the sensors configuration for my rubbish and recycling.

No, I havenā€™t, but honestly I have not intensively working on it.
Do you need assistance around the sensor setup?

@Hohenloherin I stumbled across this and itā€™s all working now https://github.com/mampfes/hacs_waste_collection_schedule/issues/185#issuecomment-1080011948

Thank you for pointing me to this site. This site is dealing with different topics. I still struggle to make the difference in the definition of the sensor between ā€œPapiertonneā€ and ā€œPapiertonne 1100ā€.
I was looking at templates, but did not succeed yet.

Can someone point me in a direction where to look for a solution?

Hello,
is it possible to integrate also the service of AHA (aha Zweckverband Abfallwirtschaft Region Hannover: Abfuhrkalender)?

Would be glad.
Greetings
Marco

I just added support for regex to the ICS source. This might be a way to fix your issue.
regex: "(.*) 1100"

1 Like

Thanks a lot, this sounds very promising! Can you help me understanding please?

Do I get it right to change in line 3

class ICS_v1:
    def __init__(self, offset=None, regex=None, split_at=None):
        self._offset = offset
        self._regex = None
        if regex is not None:
            self._regex = re.compile(regex)
        self._split_at = split_at

self._regex: ā€œ(.*) 1100ā€.

If so, why are there two subfolders of ICS in service, one called ICS.py and the other ICS_v1.py?

Does this take place automatically after restart of HA? I just wonder why my folders contain regex already while you state you added it recently.

Ah, no. Just add s.th. like regex: "(.*) 1100" to your configuration.

See https://github.com/mampfes/hacs_waste_collection_schedule/blob/c9805b29b35a534e866d27fc82cc54386dafbfdf/doc/source/ics.md for details.

Have someone configured a notification a day before waste collection? Would be great if the automation can be shared!

Hi together,

I just forked a Blueprint vom @Tweak3D to make this Automation work with Waste Collection Schedule Framework.

Use this Blueprint:

Greets
Dominik

1 Like

Thanks for all the work on this integration. I have it up and mostly working as I would like. :sweat_smile:

One thing Iā€™m struggling with is parsing calendar entries.

Currently I have this configuration using the ā€˜split_atā€™ as follows:

waste_collection_schedule:
  sources:
    - name: ics
      customize:
        - type: Compost (Sign-Up Only)
          alias: Compost
      args:
        url: "https://recollect.a.ssl.fastly.net/api/places/E4C3C6D0-699F-11EC-900E-C7CD545EB3A5/services/248/events.en-US.ics?client_id=F84ADF56-BF3D-11EC-BEFB-C49F5FC1E5F7"
        split_at: "\\, [and ]*"

This works great to separate calendar events formatted similar to: ā€œTrash, recycle, and compostā€ to parse them to:
Trash
Recycle
Compost

Some of the calendar events donā€™t use a comma and instead are formatted like ā€œTrash and compostā€ which are then not parsing correctly with the above ā€˜split_atā€™ configuration and therefore not showing the correct number of days until they are due to be collected.

Can I modify the ā€˜split_atā€™ configuration to have both formats parsed correctly (i.e. events joined by commas as well as events joined only by ā€˜andā€™ statements) so that everything is parsed correctly? Or is there another easier solution Iā€™m not seeing.

Thanks in advance for any guidance.

Hello mampfes,

now I have played around with several expressions, but none of them worked. I checked the expressions and they give the desired result on https://regexr.com, but not in waste-collection-schedule. Actually I tried this in my configuration.yaml:

waste_collection_schedule:
  sources:
    - name: abfallnavi_de
      args:
        service: nuernberg
        ort: NĆ¼rnberg
        strasse: xyzstrasse
        hausnummer: xx
        regex: "[A-Za-z]{1,11}" 

Also your regex example gives me a mistake

Logger: homeassistant.setup
Source: setup.py:298
First occurred: 18:58:11 (2 occurrences)
Last logged: 18:58:11

Unable to prepare setup for platform waste_collection_schedule.sensor: Unable to set up component.

I donā€™t know what to do now to get it working.
I updated to the newest version of the app and now it works!!!
THANKS for the work.

1 Like

hello together,

i need your help. I changed may setup from Pi4 with SD card to same Pi4 with M2. i did a backup and restored it. Everything works except the Waste Collection Schedule Integration. It was working perfect in my old setting for months from the beginning.

i download the ics from my citys website and store it in www folder

configuration.yaml:

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/Leerungstermine.ics"
      customize:
        - type: Restabfallbehaelter
          alias: Restabfall
          icon: mdi:trash-can
        - type: Bioabfallbehaelter
          alias: Bioabfall
          icon: mdi:carrot
        - type: Wertstofftonne
          alias: Wertstoffabfall
          icon: mdi:recycle
        - type: Papierbehaelter 
          alias: Papierabfall
          icon: mdi:archive
      calendar_title: Abfallkalender
  fetch_time: "04:00"
  day_switch_time: "10:00"

sensor.yaml:

#Abfallkalender Sensoren Restabfall
  - platform: waste_collection_schedule
    name: SensorRestabfall
    details_format: "upcoming"
    value_template: '{{ value.daysTo }}'
    types:
      - Restabfall

#Abfallkalender Sensoren Bioabfall
  - platform: waste_collection_schedule
    name: SensorBioabfall
    details_format: "upcoming"
    value_template: '{{ value.daysTo }}'
    types:
      - Bioabfall

#Abfallkalender Sensoren Wertstoffabfall
  - platform: waste_collection_schedule
    name: SensorWertstoffabfall
    details_format: "upcoming"
    value_template: '{{ value.daysTo }}'
    types:
      - Wertstoffabfall

#Abfallkalender Sensoren Papierabfall
  - platform: waste_collection_schedule
    name: SensorPapierabfall
    details_format: "upcoming"
    value_template: '{{ value.daysTo }}'
    types:
      - Papierabfall

#Abfallkalender Sensoren nƤchster Abfalltermin
  - platform: waste_collection_schedule
    name: Sensornaechsterabfall
    details_format: "upcoming"
    value_template: '{{ value.daysTo }}'

So far i tried:

  • ics is still in www folder
  • configuration in yaml is the same as before
  • removed the plugin, removed the config, restart, installed the plugin, restart, set the code, restart
  • installed version 1.23 not 1.24

Nothing seems to work, as far as i can see my integration doesnt even read/find the ics file.

i get various red flags in my log for Waste Collection Schedule:

Logger: waste_collection_schedule.scraper
Source: custom_components/waste_collection_schedule/waste_collection_schedule/scraper.py:284
Integration: waste_collection_schedule (documentation)
First occurred: 11:47:46 (1 occurrences)
Last logged: 11:47:46

source not found: ics
Logger: homeassistant.components.calendar
Source: custom_components/waste_collection_schedule/calendar.py:28
Integration: Kalender (documentation, issues)
First occurred: 11:47:46 (1 occurrences)
Last logged: 11:47:46

Error while setting up waste_collection_schedule platform for calendar
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/config/custom_components/waste_collection_schedule/calendar.py", line 28, in async_setup_platform
    dedicated_calendar_types = scraper.get_dedicated_calendar_types()
AttributeError: 'NoneType' object has no attribute 'get_dedicated_calendar_types'
Logger: custom_components.waste_collection_schedule.sensor
Source: custom_components/waste_collection_schedule/sensor.py:124
Integration: waste_collection_schedule (documentation)
First occurred: 11:47:46 (5 occurrences)
Last logged: 11:47:46

source_index 0 out of range
Logger: homeassistant
Source: custom_components/waste_collection_schedule/__init__.py:204
Integration: waste_collection_schedule (documentation)
First occurred: 11:48:08 (1 occurrences)
Last logged: 11:48:08

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/waste_collection_schedule/__init__.py", line 204, in _fetch
    scraper.fetch()
AttributeError: 'NoneType' object has no attribute 'fetch'

I think there are some files missing. Check /custom_components/waste_collection_schedule/source. There has to be some .py files, including ics.py.
Probably itā€™s best to reinstall waste_collection_schedule.