Waste Collection Schedule Framework

HI, Not sure what I’m doing wrong.
I get the following error: “Unable to prepare setup for platform ‘waste_collection_schedule.sensor’: Unable to set up component.”

My Config as follows:

    name: Waste Collection
    details_format: "upcoming"
      #count: COUNT
      #leadtime: LEADTIME
      #value_template: VALUE_TEMPLATE
      #date_template: DATE_TEMPLATE
      # types:
      #   - Appointment Type 1
      #   - Appointment Type 2
waste_collection_schedule:
    sources:
    - name: eastherts_gov_uk
      args:
        address_postcode: SG13 8LW
        address_name_number: xxx
        version: 1

Just installed 2024.5.2 and issue persists, no calendar created :frowning:

can you post your sensors here maybe compare see if we can sort it for you

Mea culpa! I just figured out, that after getting errors and no data in calendar after 2024.5.1 I disabled integration and template sensors to avoid errors and did not enabled it again after update to 2024.5.2 :man_facepalming: After reenabling seems everything is working fine again :+1: Sorry for confusion!

2 Likes

glad you got it working.

Hi,

I’m not the best person to ask on this as I am a complete amateur and tend to hack around until something works. Not sure how to paste code but below is what I have in my config.

Hope this helps

waste_collection_schedule:
  sources:
    - name: aucklandcouncil_govt_nz
      args:
        area_number: ENTER AREA NUMBER HERE
      customize:
        - type:  Rubbish
          icon: mdi:trash-can

sensors:
  - platform: waste_collection_schedule
    name: Rubbish
    details_format: "upcoming"
    value_template: "{{value.daysTo}}"
    types:
      - Rubbish

As of today all 3 of my waste sensors stopped reporting a state. This is for Chichester Council, UK. Code which previously worked is:

waste_collection_schedule:
  sources:
    - name: chichester_gov_uk
      args:
        uprn: 100061747398

sensor:
  - platform: waste_collection_schedule
    name: General_waste
    types:
      - General Waste
    value_template: "{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}"
  - platform: waste_collection_schedule
    name: Recycling
    types:
      - Recycling
    value_template: "{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}"
  - platform: waste_collection_schedule
    name: Garden
    types:
      - Garden
    value_template: "{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}"

do you have any errors in your logs

On waking today everything is fine again. I’m not familiar with the logs but think I’ve found what you’re after…

2024-05-17 16:47:57.060 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module inside the event loop by custom integration ‘waste_collection_schedule’ at custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py, line 188: source_module = importlib.import_module( (offender: /config/custom_components/waste_collection_schedule/waste_collection_schedule/source_shell.py, line 188: source_module = importlib.import_module(), please report it to the author of the ‘waste_collection_schedule’ custom integration

waste_collection_schedule:
sources:
- name: static
args:
type: Organic
frequency: WEEKLY
weekdays: MO
start: “2023-01-01”
until: “2030-12-31”

So i have this source configured but i want to add also some extra dates. I have tried to this according to the documentation but the sensor that i have configured did not display the extra date. HOw can i add the second source as a date? Is it also possible to exlcude some dates?

I am trying to sort out the right type for a supported service provider where public holidays do reschedule the waste collection for 1 day and the type does not seem to be the usual (Restmülltonne, Bioabfallbehäter, Papiertonne) but with an addition of “(verlegt)”.

I wanted to add this 2nd type to my sensor to show also those rescheduled waste collection times but obviously I am doing something wrong here?

I added 3 new types to my source and added each of those to my sensor(s)!? What am I doing wrong?

image

waste_collection_schedule:
  sources:
    - name: app_abfallplus_de
      args:
        app_id: de.k4systems.zawdw
        city: Munich
        hnr: 123456
        strasse: Mainstreet
      customize:
        - type: Restmülltonne
          alias: Rest
          icon: mdi:trash-can
        - type: Restmülltonne(verlegt)
          alias: Rest—verlegt
          icon: mdi:trash-can
        - type: Bioabfallbehälter
          alias: Bio
          icon: mdi:flower-outline
        - type: Bioabfallbehälter(verlegt)
          alias: Bio_verlegt
          icon: mdi:flower-outline
        - type: Papiertonne
          alias: Papier
          icon: mdi:trash-can-outline
        - type: Papiertonne(verlegt)
          alias: Papier_verlegt
          icon: mdi:trash-can-outline
  fetch_time: "06:00"
  day_switch_time: "11:00"

sensor:
# Abfall
  - platform: waste_collection_schedule
    name: AbfallRestmuell
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tag(en){% endif %}'
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    types:
      - Rest
      - Rest_verlegt
  - platform: waste_collection_schedule
    name: AbfallBiotonne
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tag(en){% endif %}'
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    types:
      - Bio
      - Bio_verlegt
  - platform: waste_collection_schedule
    name: AbfallPapier
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tag(en){% endif %}'
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    types:
      - Papier
      - Papier_verlegt
  - platform: waste_collection_schedule
    name: AbfallNaechster
    details_format: "upcoming"
    value_template: '({{value.types|join(" + ")}}) {% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tag(en){% endif %}'
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'

Hi all

I’ve been trying to do this for a few days and getting nowhere. Any chance someone could point me in the right direction?

I want to display a picture of the bin instead of the text. Is this possible?

waste_collection_schedule:
  sources:
    - name: tameside_gov_uk
      args:
        postcode: "OL7 9ER"
        uprn: ""
      customize:
        - type: brown bin
          alias: Brown
          picture: local/community/brown_bin.jpg
        - type: blue bin
          picture: local/community/blue_bin.jpg
          alias: Blue
        - type: green bin
          picture: local/community/green_bin.jpg
          alias: Green
        - type: black bin
          picture: local/community/black_bin.jpg
          alias: Black


sensor:
  - platform: waste_collection_schedule
    name: Bins
    details_format: upcoming
    value_template: '{{value.types|join(" & ")}} in {{value.daysTo}} days'
    types:
     - Brown
     - Blue
     - Green
     - Black

I’ve uploaded the pictures to that location based on recommendations I had for a custom picture on the picture elements card

not sure if it helps but this is mine

waste_collection_schedule:
    sources:
    - name: cherwell_gov_uk
      args:
        uprn: "xxxxxxxxx" 
      customize:
      - type: Green Bin
        picture: https://forms.cherwell.gov.uk/images/bin-collections/bin-collection-green.svg
        alias: "Rubbish (Green)"
      - type: Blue Bin
        picture: https://forms.cherwell.gov.uk/images/bin-collections/bin-collection-blue.svg
        alias: "Recycling (Blue)"
      - type: Brown Bin
        picture: https://forms.cherwell.gov.uk/images/bin-collections/bin-collection-brown.svg
        alias: "Garden (Brown)"     
        

How do I get the picture to display though? I’m using the entity card and I’ve selected the “Bins” sensor as setup in my yaml file…

Normally there should be a / (dash) in front of local.

/local/...

EDIT: and do you have the correct location for that img file? It should be physically in
/config/www/... and linked /local/.... :slight_smile:

@paddy0174 is right, I downloaded it locally to test for you.

if using a mushroom card don’t forget to Change icon type

type: custom:mushroom-entity-card
entity: sensor.all_waste_types
icon_type: entity-picture

1 Like

Thanks for everyones help help so far. I can confrim the pictures are in the right place, I tested it by just passing the path to a picture card and it was displayed.

I tried setting up the mushroom card too but that still just displayed text. This Friday my bin collection is ny Brown and Green bin. I have it configured so it currently displays

Brown & Green in 3 days

Is it because I have it combining multiple bin types into one card that the picture option doesnt work?

I have mine setup for all waste on one sensor, and is working as intended.

- platform: waste_collection_schedule
    name: all-waste-types
    details_format: upcoming
    value_template: '{{value.types|join(", ")}} {% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %} '
    date_template: '{{value.date.strftime("%A %n%d %B")}}'
    add_days_to: true
    

OK so I’ve done some testing and created another sensor which matches yours.

so far I think your problem is that to have a picture for multiple waste types you need to add it to your configuration.yaml

customize:
        - type: Brown & Green bin
          alias: Brown & Green
          picture: local/community/brown_bin.jpg #new image(can only use one)

then add the new alias to your sensor

sensor:
  - platform: waste_collection_schedule
    name: Bins
    details_format: upcoming
    value_template: '{{value.types|join(" & ")}} in {{value.daysTo}} days'
    types:
     - Brown
     - Blue
     - Green
     - Black
     - Brown & Green

I haven’t finished testing but I think this is the issue

EDIT: SCRAP THAT… it won’t work because it will only match from the source, and there won’t be Brown & Green

I’ve tested everything I can but I believe this might be the issue. I’ve read the FAQs and the forums and couldn’t find anything else.

as a workaround I created a template sensor and added an entity picture to get the same end result, depending on your use.

  - sensor:
      - name: "Recycle & Garden Bin"
        unique_id: recycle_garden_bins
        state: > 
          {{ states('sensor.recycle_garden') }}
        picture: https://forms.cherwell.gov.uk/images/bin-collections/bin-collection-green.svg