Waste Collection Schedule Framework

Hi,

there are a lot of integrations for various waste collection services available in Home Assistant. The downside of this approach is that common features are not consistently implemented or are missing. Therefore I tried to create a framework which can be easily enhanced for new services.

Curently, the framework supports the following services (more will be added over the time and on request):

  • Generic ICS File

Australia

  • Brisbane City Council
  • The Hills Council, Sidney

Germany

  • Abfall.IO / AbfallPlus.de
  • Abfall Kreis TĂŒbingen
  • AbfallNavi (RegioIT.de)
  • Abfallwirtschaft Stuttgart
  • Abfallwirtschaftsbetriebe Köln
  • Berliner Stadtreinigungsbetriebe
  • Jumomind
  • MĂŒllmax
  • Stadtreinigung.Hamburg
  • Abfallwirtschaft Zollernalbkreis
  • MyMĂŒll App

Netherlands

  • HVCGroep
  • Ximmio

New Zealand

  • Wastenet

Sweden

  • Lerum

United States of America

  • PGH, Pittsburgh
  • Seattle Public Utilities

The complete documentation is available in the GitHub repository:

Examples


date-of-next-collections
days-to-next-collections
next-collections-date-and-days



Features

  • Integrates into Home Assistant’s Calendar view
  • Template support for sensor state (e.g. date format, number of days to next appointment, waste type)
  • Different detail views, e.g. list of upcoming events or next appointment per waste type
  • Limit number of displayed items by count or time
  • Rename waste types
  • Filter unwanted waste types
  • Configurable daily update time
  • Configurable expiration time for today’s collections
  • Support for multiple sources (= services) at the same time
  • Support for multiple sensors at the same time (e.g. one sensor per waste type or one sensor for all waste type)
  • and much more 


Suggestions welcome!

29 Likes

Hi @mampfes,
i used the Abfall.io Integration for a while now, but since yesterday all my sensors show ‘unknown’.

So i installed your framework via HACS and configured it for abfall.io, but the sensor also shows no data.

Is there something wrong with my config, or are there problems with abfall.io?

configuration.yaml

waste_collection_schedule:
  sources:
    - name: abfall_io
      args:
        key: 3701fd1ff111f63996ab46a448669ea3
        f_id_kommune: 1069
        f_id_bezirk: 979
        f_id_strasse: 2890
        f_abfallarten:
          - 31
          - 28
          - 64
          - 53
          - 84
          - 60

sensor:

  - platform: waste_collection_schedule
    #source_index: 0
    name: Abfall WaBue
    details_format: "upcoming"
    #count: COUNT
    #leadtime: LEADTIME
    #value_template: VALUE_TEMPLATE
    #date_template: DATE_TEMPLATE
    # types:
    #   - Appointment Type 1
    #   - Appointment Type 2

Auswahl_320

BTW: The ‘details_format’ is not optional like stated in the docs and raises error when omitted.

I also tried the abfall_io.py to get the values, but after selecting the provider the next select is emty too.

Thanks in advance!

Hi @VDRainer,

thanks for the info. Abfall.io obviously changed their API yesterday or today, they require a valid user-agent now (I assume to reject all the scrapers). I uploaded a fix to HACS, it should work again now.

I also fixed the non-optional details_format. It should be really optional now.

Regards

Thanks very much for your fast fix!
Now the sensor works as expected.

1 Like

Hi @mampfes,

Thank you very much for this nice framework. My custom_component create based on beyer-tom.de stopped working yesterday evening half past nine. This afternoon I tried to get it to work again but wasn‘t successfully.

I think your code looks better as there are more configuration options instead of changing python script. Furthermore I saw the test parts for new sources.

I’m interested in following waste collection dates:
https://api.abfallplus.de/?key=8303df78b822c30ff2c2f98e405f86e6&modus=d6c5855a62cf32a4dadbc2831f0f295f&waction=export_pdf

I changed configuration:

# Waste collection
waste_collection_schedule:
  sources:
    - name: abfall_io
      #fetch_time: FETCH_TIME
      #day_switch_time: DAY_SWITCH_TIME
      #separator: SEPARATOR
      args:
        key: 8303df78b822c30ff2c2f98e405f86e6
        f_id_kommune: 3317
        f_id_strasse: 289
        f_abfallarten:
          - 28
          - 17
          - 48
          - 100
          - 67
        #f_zeitraum: "20200101-20301231"

sensor:
  # Waste collection
  - platform: waste_collection_schedule
    #source_index: SOURCE_INDEX
    name: abfall_myk
    #details_format: DETAILS_FORMAT
    #count: COUNT
    #leadtime: LEADTIME
    #value_template: VALUE_TEMPLATE
    #date_template: DATE_TEMPLATE
    #types:
    #  - Appointment Type 1
    #  - Appointment Type 2
  #- platform: waste_collection_schedule
  #  name: abfall_vallendar
  #  value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%a")}}'

Works great!

1 Like

Just an idea, to prevent this in the future, wouldn’t it make sense to fetch the data at a random time?
Maybe fetch_time: "01:00-02:00"

Thanks once again for this great integration. :+1:

1 Like

Thanks for the suggestion, that’s a very good idea because we definitely don’t want to annoy the service providers! I would add a new option with a default value which defines the range for a random offset to the fetch time. What would be a good default value? 1h - or should it be even more? Testing of this feature requires some days
 :grimacing:

Hi,
has anybody an example for the Stadtreinigung.Hamburg waste collection setup?

Regards,
Jörg

Ok, figured out, that for Stadtreinigung.Hamburg I have to run a python script.
But how?
I launched an issue (question for some advice) at Github already.

If someone here has additional hints, that would be great.

Regards,
Joerg

No clue about a python env on windows, but after installing module inquirer

pip install inquirer

and start it with

python /path/to/stadtreinigung_hamburg.py

it works for me.

If you like, you can tell me the street and house number per PM and i send the result back.

Unfortunately, inquirer is not available on Windows! Everything else @VDRainer provided is correct. (maybe you have to use pip3 instead of pip).

EDIT: Fixed it myself by not being an idiot for 5 seconds

Hello!

I also have a problem (mostly because I’m completely new to HA, so sorry in advance :D)

My entity/sensor doesn’t show anything: Screenshot_33

The iCal file is located in /config/www/garbage.ics"

My source in configuration.yaml:
EDIT: There was my problem. It works now after I changed the “file:” to "www/garbage.ics"

#Garbage_Schedule
waste_collection_schedule:
  sources:
    - name: ics
      args:
        #url: URL
        file: "/local/garbage.ics"
        #offset: OFFSET

The sensor in sensor.yaml

### Garbage Schedule ###
- platform: waste_collection_schedule
  #source_index: 0
  name: Garbage Schedule
  details_format: "upcoming"
  #count: COUNT
  #leadtime: LEADTIME
  #value_template: VALUE_TEMPLATE
  #date_template: DATE_TEMPLATE
  # types:
  #   - Appointment Type 1
  #   - Appointment Type 2

I’m guessing that I’m doing something wrong in pointing at the garbage.ics file, but I’m not sure and just hella confused by now :smile:

@Florian.Schmidt
May I ask what kind of Lovelace Card you’re using there?

@Loony1 Card type also fixed?

Whoops, yes, sorry!

No problem! :+1:

Hi, my sensor show ‘B in 2 days’. How can i change the ‘B’ to ‘Bio’ and ‘days’ to ‘Tage’?

Hi, this requires 2 steps:

  1. Add customize to your source definition to set an alias for the requires waste types:
waste_collection_schedule:
  sources:
    - name: SOURCE
      args:
        SOURCE_SPECIFIC_ARGUMENTS
      customize:
        - type: B
          alias: Bio
  1. Set the value_template in your sensor definition:
sensor:
  - platform: waste_collection_schedule
    name: NAME
    value_template: '{{value.types|join(" + ")}} in {{value.daysTo}} Tagen'

I’m not at home right now therefore please excuse errors because I wrote this out of my head.

Many many thanks. Works perfectly.

1 Like

Great Framework, many thanks! I use it with my Google Calender ICS and it works flawlessly.

However, one question:

I have three different types defined under customize:

      customize:
        - type: Wertstofftonne
          alias: Gelbe Tonne
        - type: Hausmuell
          alias: Hausmuell
        - type: Altpapier
          alias: Altpapier

Now, I would like to have one button for each showing when it will be handled, e.g. “Hausmuell will be handled in 3 days”. I am using custom:button-card. Any hints how to do this?

Yes: Create multiple sensors, one per waste type. For every sensor, add types and set it to the desired waste type:

sensor:
  - platform: waste_collection_schedule
    name: HausmuellDates
    types:
      - Hausmuell
  - platform: waste_collection_schedule
    name: AltpapierDates
    types:
      - Altpapier
1 Like