Waste Collection Schedule Framework

Blue bin is in 6 days. Grey in 13 days. I also had the green bin but deleted it for now, it also showed 6 days but should be 20 days.

The indentation is correct in my config, just messed up when pasting it here.

You need to add the type to the sensor, otherwise it won’t know which one to choose. With the sources, you select which list of entries from the data (calendar) you want, and in the sensor you need to select which one you bind to this specific sensor.

Like this:

- platform: waste_collection_schedule
  name: Grey Bin
  details_format: upcoming
  value_template: 'in {{value.daysTo}} days'
  type:
    - Grey Bin

And I’m not sure, but I’ve added the attribute add_days_to: true as well, but that please check for yourself in the documentation. :slight_smile:

It just adds as a new attribute:

- platform: waste_collection_schedule
  name: Grey Bin
  details_format: upcoming
  value_template: 'in {{value.daysTo}} days'
  add_days_to: true
  type:
    - Grey Bin

Thanks for the hint. I added type but got an error and changed it to types and this cleared the error.

But the state now showed as unknown. I then deleted the word bin from types, so just grey, blue, green, and it works now.

Thanks again

Anyone knows what is going on after the last Waste Collection Update (I did it today)?
Instead of receiving the inforation "Biomüll/Restmüll/…) I get person names!
Information in the phone app still works fine!

I use this connection:
waste_collection_schedule:
sources:
- name: app_abfallplus_de
args:
app_id: de.ucom.abfallavr

Can confirm this behavior. Just freshly installed it and thought it was an error on my side.
source:

waste_collection_schedule:
    sources:
    - name: app_abfallplus_de
      args:
        app_id: de.k4systems.abfallappzak

I created an GitHub Issue for the problem:

@AKGitH and @OnSive Has either of you checked the real source? In this case the data that comes in from AbfallPlus?

The phone might not be updated, so could still use data from yesterday.

It’s nice that you created an issue, but for now, you haven’t provided any information, that could help. If it’s an error on the side of AbfallPlus, the issue and the time of the developer of this integration is simply waisted. :wink:

So please, before you jump to conclusions, like “it’s a bug”, give us some information, so the source of the error can be checked and verified. So that we can at least add any kind of information to that issue. :slight_smile:

If you provide us with some more information we could as well check, but without even knowing for what address/city/county this is, we are not really able to help. :slight_smile:

@paddy0174 sorry for writing such a short report.
I’ve just installed the a ZAK Abfall App on a new phone and used following the location settings:

Fischen
Ortsteile (= districts)
alle Straßen (= all streets)

basically the same as in my source which I generated using the app_abfallplus_de.py wizard.

waste_collection_schedule:
    sources:
    - name: app_abfallplus_de
      args:
        app_id: de.k4systems.abfallappzak
        city: Fischen
        bezirk: Ortsteile

While the data in the app seems to be real and valid, the result of the framework returns the names and numbers.

Hi,
This is the complete code:
waste_collection_schedule:
sources:
- name: app_abfallplus_de
args:
app_id: de.ucom.abfallavr
city: Spechbach
strasse: Rübenbergweg
customize:
- type: Grüne Tonne plus 4-Radbehälter wöchentlich
show: false
- type: Sperrmüll + Altholz
show: false
- type: Rest-/Biomüll 4-Radbehälter wöchentlich
show: false
- type: Grünschnitt
show: false
- type: Restmüll 2-/4-Radbehälter 14-täglich
alias: Graue_Tonne
- type: Biomüll 2-/4-Radbehälter 14-täglich
alias: Braune_Tonne
- type: Grüne Tonne plus 2-/4-Radbehälter 14-täglich
alias: Gruene_Tonne
icon: mdi:recycle
- type: Glasbox
alias: Glasbox
icon: mdi:recycle
HA shows still names, phone app today shows the right information (Phone was restarted and the “Abfall datas” updated).

This showes HA:
grafik

And this showes the phone app:

I was hoping someone could help me out, on HA startup I get several errors for “UndefinedError: ‘None’ has no attribute ‘state’”, one for each of my two schedules. I also don’t see any calendar entries, but I do get sensors with the correct date information. Can someone point me in the right direction to resolve this?

Configuration:

waste_collection_schedule:
  day_switch_time: '6:00'
  sources:
    - name: static
      args:
        type: Trash
        frequency: WEEKLY
        start: '2024-01-03'
        until: '2024-12-25'
        excludes: # Add exception for the recurrence
          - '2024-01-03' #New Years Day
          - '2024-05-29' #Memorial Day
          #Independence Day
          - '2024-09-04' #Labor Day
          #Thanksgiving
          #Christmas Day
        dates: # Manually add dates that are not part of the recurrence
          - '2024-01-04'
          - '2024-05-30'
          - '2024-09-05'
    - name: static
      args:
        type: Recycle
        frequency: WEEKLY
        start: '2024-01-01'
        until: '2024-12-30'
        excludes: # Add exception for the recurrence
          - '2024-01-01' #New Yesrs Day
          - '2024-05-27' #Memorial Day
          #Independence Day
          - '2024-09-02' #Labor Day
          #Thanksgiving
          - '2024-12-25' #Christmas Day
        dates: # Manually add dates that are not part of the recurrence
          - '2024-01-02'
          - '2024-05-28'
          - '2024-09-03'
          - '2024-12-26'

  - platform: waste_collection_schedule
    name: Trash Pickup
    source_index: 0
    details_format: upcoming
    value_template: '{{value.types|join(", ")}} {% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}'

  - platform: waste_collection_schedule
    name: Recycling Pickup
    source_index: 1
    details_format: upcoming
    value_template: '{{value.types|join(", ")}} {% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}'

Errors in question:

2024-07-04 09:19:38.748 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ states.sensor.trash_pickup.
state }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 604, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2639, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
jinja2.exceptions.UndefinedError: 'None' has no attribute 'state'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 716, in async_render_to_info
    render_info._result = self.async_render(  # noqa: SLF001
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 606, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'state'

2024-07-04 09:19:38.753 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=({{ states.sensor.recycling_pic
kup.state }}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 604, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2639, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 1, in top-level template code
jinja2.exceptions.UndefinedError: 'None' has no attribute 'state'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 716, in async_render_to_info
    render_info._result = self.async_render(  # noqa: SLF001
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 606, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'state'

Edit: I fixed the calendar issue, I believe it may have been due to a seperate logbook issue. I still receive the errors on HA startup, but everything is now functional.

Hello everyone,

is it just me or is the installation via GUI not working?
I am running a clean installation of the integration (no folder in custom_components and uninstalled in hacs, I restart homeassistant, install via hacs and restart).
When I then want to install the integration in the integrations page, it tells me that this integration has to be installed via the configuration.yaml.

I have checked the homeassistant logs and there are no errors so I think the installation went fine.

Does anybody have any experience with this?

Thank you!

that’s because there is no gui. sensors have to be none manually

Since 10days and some HASS updates my schedules seem to have disappeared and all sensors show “unknown” now. Also no calendar entries!?

I used local .ics files for a whole (tried to switch back as well btw) and since 4 weeks my provider’s API (ZAW Donau-Wald).

Any tipps on how to start troubleshooting the API/ICS calls and calendar events???

The Apps By Abfall+ source is currently broken. If you don’t use ZAW Donau-Wald with the Apps By Abfall+ source please open a Issue in github.
The Apps By Abfall+ issue is discussed here: [Bug]: app_abfallplus_de returns names with numbers instead of the types · Issue #2197 · mampfes/hacs_waste_collection_schedule · GitHub. There is a fix that seem to work, but it’s not officially part of the repo. (only apply the patch if you know what you’re doing)

1 Like

The GUI configuration method is not yet part of a release, it’s only available in the master/git version and will be available shortly in the next release.

1 Like

The configuration looks fine (if you put the sensors in the sensor section). The issue seems not to be in the Waste Collection sensors, but some other template sensor you may set up somewhere else (based on error log).

Thank you! That was the push I needed. I had a mushroom card with a template. I was able to fix it:

Before:

    cards:
      - type: custom:mushroom-template-card
        primary: '{{ states.sensor.trash_pickup.state }}'
        icon: mdi:trash-can
        icon_color: >-
          {{ 'red' if 'Trash Tomorrow' in states('sensor.trash_pickup') else
          'red' if 'Trash Today' in states('sensor.trash_pickup') else 'blue' }}
      - type: custom:mushroom-template-card
        primary: '{{ states.sensor.trash_pickup.state }}'
        icon: mdi:recycle
        icon_color: >-
          {{ 'red' if 'Recycle Tomorrow' in states('sensor.recycling_pickup')
          else 'red' if 'Recycle Today' in states('sensor.recycling_pickup')
          else 'blue' }}

After:

    cards:
      - type: custom:mushroom-template-card
        primary: '{{ states(''sensor.trash_pickup'') }}'
        icon: mdi:trash-can
        icon_color: >-
          {{ 'red' if 'Trash Tomorrow' in states('sensor.trash_pickup') else
          'red' if 'Trash Today' in states('sensor.trash_pickup') else 'blue' }}
      - type: custom:mushroom-template-card
        primary: '{{ states(''sensor.recycling_pickup'') }}'
        icon: mdi:recycle
        icon_color: >-
          {{ 'red' if 'Recycle Tomorrow' in states('sensor.recycling_pickup')
          else 'red' if 'Recycle Today' in states('sensor.recycling_pickup')
          else 'blue' }}

Release of version 2.0.0 with GUI configuration support

We now support GUI configuration. This is the first version of the GUI, and we already planned future improvements. We could not test the GUI with all sources and edge cases, so if you run into any problems, feel free to report them in GitHub or here.

We are aware of a few limitation (Add config flow (UI) configuration option by dan-r · Pull Request #2068 · mampfes/hacs_waste_collection_schedule · GitHub)
and minor improvements (Add config flow (UI) configuration option by dan-r · Pull Request #2068 · mampfes/hacs_waste_collection_schedule · GitHub)

Full release notes: Release 2.0.0 · mampfes/hacs_waste_collection_schedule · GitHub

3 Likes

Thanks a lot for your work on this integration, you’re really doing a lot here! :+1: :wave:

Just before the topic comes up:

If you’re upgrading to version 2.0.x from 1.x.x, you can just apply the update! Besides the mentioned breaking changes, you can just update and there’s no need to change configuration or anything like that.

1 Like