Waste Collection Schedule Framework

ok got it working!!!

source index needed to be the same

waste_collection_schedule:
    sources:
    - name: bromley_gov_uk
      args:
        property: 123456


#Paper Waste Sensors
    - platform: waste_collection_schedule
      source_index: 0
      name: Paper & Cardboard  # Change this to whatever you want the UI to display
      details_format: generic
      date_template: '{{value.date.strftime("%A %d %B %Y")}}'  # date format becomes 'Tuesday 1 April 2022'
      value_template: 'in {{value.daysTo}} days'
      types:
        - Paper & Cardboard

#Garden Waste Sensors
    - platform: waste_collection_schedule
      source_index: 0
      name: Garden Waste  # Change this to whatever you want the UI to display
      details_format: generic
      date_template: '{{value.date.strftime("%A %d %B %Y")}}'  # date format becomes 'Tuesday 1 April 2022'
      value_template: 'in {{value.daysTo}} days'
      types:
        - Garden Waste

#mixed Waste Sensors
    - platform: waste_collection_schedule
      source_index: 0
      name: Mixed Recycling (Cans, Plastics & Glass)  # Change this to whatever you want the UI to display
      details_format: generic
      date_template: '{{value.date.strftime("%A %d %B %Y")}}'  # date format becomes 'Tuesday 1 April 2022'
      value_template: 'in {{value.daysTo}} days'
      types:
        - Mixed Recycling (Cans, Plastics & Glass)
        

#Rubbish Waste Sensors
    - platform: waste_collection_schedule
      source_index: 0
      name: Non-Recyclable Refuse  # Change this to whatever you want the UI to display
      details_format: generic
      date_template: '{{value.date.strftime("%A %d %B %Y")}}'  # date format becomes 'Tuesday 1 April 2022'
      value_template: 'in {{value.daysTo}} days'
      types:
        - Non-Recyclable Refuse

Iā€™m pretty new to HA and struggling to set this up.

Iā€™ve added the waste collection schedule to the configuration yaml and added my uprn for my address but Iā€™m struggling with the sensors I need to add.

waste_collection_schedule:
sources:
- name: southderbyshire_gov_uk
args:
uprn: UPRN_CODE

This shows the info in the calendar but im struggling
I have bi weekly schedule of recycling waste followed by general as per the screenshot below

Thanks!

Screenshot 2023-04-15 at 17.36.01|351x499

It now depends on what the sensor is supposed to show. The simplest sensor which shows all waste types looks like this:

sensor:
  - platform: waste_collection_schedule
    name: all-waste-types

You can add as many sensors as you want.

Only last available pickup is shown, which is 250 days in advance. Checked by importing ics to google calendar (and also feeding via url instead of file) in calendar next pickup date is in 2 days, one after that in 9. Leadtime should limit it, but it does not work (which I reported on github). Does anyone know workaround for it?

Source

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/Harmonogram.ics"

Sensor

  - platform: waste_collection_schedule
    name: waste
    leadtime: 14
    details_format: "upcoming"

Can you help me please, with following error:

Fehler beim Neustart von Home Assistant
The system cannot restart because the configuration is not valid: Invalid config for [waste_collection_schedule]: [fetch_time] is an invalid option for [waste_collection_schedule]. Check: waste_collection_schedule->waste_collection_schedule->sources->0->customize->1->fetch_time. (See /config/configuration.yaml, line 18)

Would you min posting your waste collection configuration? It makes it easier to help.

The error shows that the fetch_time option has a problem. You can savely delete it and try if it works without.

As documented if no fetch_time is specified the waste collection fetches data at 01:00.

Hello everyone. Thanks @mampfes for this nice integration!

I have a problem with the ics file of my local waste disposal company.

Here you can find the file (itā€™s not exactly my address, no worries):
https://www.za-sws.de/abfallkalender.cfm?ab=1
Address: August-Bebel-StraƟe 23, 09390 Gornsdorf

Ical Abo for address above:
https://online-portal.za-sws.de/WasteManagementSuedwestsachsen/WasteManagementServiceServlet?ApplicationName=Calendar&SubmitAction=sync&StandortID=16459903001&AboID=80013&Fra=P;R;B;C;S;W;L

Currently Iā€™m using a local ics file since I had no luck with the online ical, but this is no problem for the moment.

configuration.yaml

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/Leerungstermine71321.ics"
        split_at: '\\, '
      customize:
        - type: 'Restmuelltonne 02-woechentl.'
          alias: schwarzetonne
          icon: mdi:trash-can
        - type: 'Papiertonne 04-woechentl.'
          alias: blauetonne
          icon: mdi:trash-can
        - type: 'Biotonne 02-woechentl.'
          alias: braunetonne
          icon: mdi:trash-can
        - type: 'Gelbe Tonne'
          alias: gelbetonne
          icon: mdi:trash-can
        - type: 'Schadstoff'
          alias: schadstoffmobil
          icon: mdi:trash-can

sensor.yaml

#Abfall
- platform: waste_collection_schedule
  name: AbfallRestmuelltonne
  details_format: "upcoming"
  value_template: '{{ value.daysTo }}'
  types:
    - schwarzetonne
    
- platform: waste_collection_schedule
  name: AbfallPapiertonne
  details_format: "upcoming"
  value_template: '{{ value.daysTo }}'
  types:
    - blauetonne

- platform: waste_collection_schedule
  name: AbfallBiotonne
  details_format: "upcoming"
  value_template: '{{ value.daysTo }}'
  types:
    - braunetonne

- platform: waste_collection_schedule
  name: AbfallGelbeTonne
  details_format: "upcoming"
  value_template: '{{ value.daysTo }}'
  types:
    - gelbersack

- platform: waste_collection_schedule
  name: AbfallSchadstoffmobil
  details_format: "upcoming"
  value_template: '{{ value.daysTo }}'
  types:
    - schadstoffmobil

The problem is this waste type (there is also a trailing space but I read you delete them since the last update):
SUMMARY;LANGUAGE=de:Gelber Sack, Gelbe Tonne

With the above configuration I can see this:

  • AbfallSchadstoffmobil
  • all others are unknown

When I change the configuration.yaml to this:

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/Leerungstermine71321.ics"
#       split_at: '\\, '
      customize:
        ...
        - type: 'Gelber Sack\, Gelbe Tonne '
#same problem with
#      - type: 'Gelbe Tonne '
#      - type: 'Gelber Sack'
          alias: gelbetonne
          icon: mdi:trash-can
...

I get these types:

  • AbfallRestmuelltonne
    -AbfallPapiertonne
    -AbfallBiotonne
    -AbfallSchadstoffmobil
    -AbfallGelbeTonne ā†’ unknown

I tried ā€œsplit_atā€ with different combinations or without itā€¦and many more combinations.
I think ā€œre.split()ā€ may not be sufficient for this?

Would be happy to get some good hints :slight_smile:

Regarding the not working online variant: Please see the (new) example for za-sws.de: hacs_waste_collection_schedule/za_sws_de.md at 39c663e0eeaef3702f922843606fe24667e9e0f4 Ā· mampfes/hacs_waste_collection_schedule Ā· GitHub

Regarding the type Gelber Sack, Gelbe Tonne: Have you tried it without the double-backtick? Like this:

      customize:
        - type: "Gelbe Tonne, Gelber Sack"
          alias: gelbetonne
          icon: mdi:trash-can

You can always check if your aliasā€™es are working if you look at the HA calendar. There you will see the the final names - the ones that also has to be used as value for the types attribute.

1 Like

No, thatā€™s not working with your recommendation. Or should I enable ā€œsplit_atā€ (I tried without)? If thatā€™s the case, what should be the content?

If I use an online Python interpreter for ā€œre.split()ā€ and simply try to split my example string I need to use '\, ā€™ (three! backslash) to get two strings ā€œGelber Sackā€ and ā€œGelbe Tonneā€. I donā€™t need both types because itā€™s the same but I need to parse it correct to get the daysā€¦

Thanks in advance for your help.

PS: Very interesting to see the calendarā€¦ The dates and labels for ā€˜Gelbe Tonne, Gelber Sackā€™ are correct here. But I donā€™t get the days remaining for this type.
Another discovery in the calendar: ā€˜Gelbe Tonne, Gelber Sackā€™ are spelled correctly like in the type (configuration.yaml), but all other waste entries use the alias labels here, like ā€œblauetonneā€ oder ā€œschwarzetonneā€. So I would expect to read ā€˜gelbetonneā€™ instead of ā€˜Gelbe Tonne, Gelber Sackā€™.

  1. split_at is used to separate different waste types. In your case, it is just a bad name for a single waste type / collection. Therefore you donā€™t need it.

  2. There is a backtick in the original ics data before the comma, but obviously this has been already removed by the ICS library - so you donā€™t have to care about it any more.

  3. The calendar shows that the alias for Gelber Sack, Gelbe Tonne is not working correctly - because the original name has not been replaced. So the problem is the value of the type attribute - it has to match the original string exactly.

  4. I think the problem is the trailing space. Please try this one:

      customize:
        - type: "Gelbe Tonne, Gelber Sack "
          alias: gelbetonne
          icon: mdi:trash-can

BTW: Schadstoff also has trailing space.

Hello,

I have a separate picture for each type of garbage. If several types of garbage are collected in one day, the sensor shows an icon. Can I replace this with an image?

MĆ¼llabholung

No (except you change the code).

I just stumbled on to this integration after the custom garbage collection I was using for a few years was discontinued. Looking at the docs I am not sure how the best way to handle the setup. I have two garbage, 1 recycle, 1 yard waste and one branch pickup per week. Can this integration pull this information from the built in calendar in HA? If not, the doc is not clear on how to setup multiple sensors. Any help would be appreciated.

Thanks.

Do you get your collection data from a link or a calendar (from the provider) or do you set this up manually?

Manually or I could put the dates in the local calendar if that is easier.

Thatā€™s unfortunate, I had hoped for an ical download available from your provider. :smiley:

The thing is, WCSF (WasteCollectionScheduleFramework) is setting your dates in the local HA calendar. So if you use a local ical file (like the HA calendar) as a source, you will end up with doubled dates.

Fortunately, there is a way around via ā€œuser specified datesā€, that you can put into the configuration. Then WCSF is calculating the data and set it to the local HA calendar. See here.

The other way would be, to setup something like a Google calendar or any other calendar that you have around (maybe in a nextcloud or something like that) and import that one to WCSF. This one, see here.

If your garbage collection provider doesnā€™t offer any form of download, Iā€™d suggest the first method with the ā€œuser definied datesā€ in the configuration of WCSF. Seems like the easier way than maintaining another calendar elsewhere.

I saw this link previously but do not understand how you setup multiple pickups? The link shows one Static sensor.

Do you mean different collections like paper, biohazard and so on, or do you mean paper ā€œevery two weeksā€?

For the first one, just add more than one source. Like this:

waste_collection_schedule:
  sources:
    - name: static
      args:
        type: Paper
        frequency: WEEKLY
        weekdays: WE
    - name: static
      args:
        type: Bio Hazard
        frequency: WEEKLY
        interval: 5
        start: 2023-01-01

Or do you mean something different?

1 Like

That is what I need. Thanks for all your help.

When I setup my garbage, I used:

waste_collection_schedule:
  sources:
    - name: static
      args:
        type: Garbage
        frequency: WEEKLY
        weekdays: [MO, TH]

This gave me a log error of:

File "/config/custom_components/waste_collection_schedule/waste_collection_schedule/source/static.py", line 85, in __init__
    raise Exception(f"Invalid weekdays format: {weekdays}")
Exception: Invalid weekdays format: ['MO', 'TH']

I assume it does not like the two days or how I entered them. The docs show
weekdays: [MO, TU, SA]

Not sure what I entered wrong?
For others following this the brackets used are wrong.

waste_collection_schedule:
  sources:
    - name: static
      args:
        type: Garbage
        frequency: WEEKLY
        weekdays: {MO, TH}
    - name: static
      args:
        type: Recycle
        frequency: WEEKLY
        weekdays: WE

Works correctly

1 Like