Garbage pickup date (mijnafvalwijzer.nl) custom_component

First reaction: your yaml indentation does not seem right:

sensor:
  - platform: afvalwijzer
    provider: mijnafvalwijzer
    postal_code: xxxxx
    street_number: xx

Secondly: have you tried each one of the 3 providers: mijnafvalwijzer, afvalstoffendienstkalender, rova

Please let me know if this works for you

Because: I am using this configuration also, but I don’t get the sensor either at the moment.

My environment:

  • Afvalwijzer 2022.11.02
  • Home Assistant 2022.11.3
  • Supervisor 2022.10.2
  • Operating System 9.3
  • Frontend 20221108.0 - latest

@xirixiz, in the documentation: Is it possible to add an extra column to the list of garbage providers and show of each garbage provider if you should choose mijnafvalwijzer, afvalstoffendienstkalender or rova as provider in the configuration.yaml.

If somethings doesn’t seem the work one will at least be certain that your calling the right provider for the postal_code & street_number.

Using this configuation in my configuation.yaml I do not get the sensors for the garbage pick up

sensor:
  - platform: afvalwijzer
    provider: gad
    postal_code: xxxxx
    street_number: xx

My provider is: GAD. So I choose ‘gad’ as the provider. Or do I need to select ‘mijnafvalwijzer’ or ‘afvalstoffendienstkalender’?

I did work in the past.

What am I doing wrong?

My environment:

  • Afvalwijzer 2022.11.02
  • Home Assistant 2022.11.3
  • Supervisor 2022.10.2
  • Operating System 9.3
  • Frontend 20221108.0 - latest

Hi, Has someone been able to also include VCCS Container Cleaning schedule in this component or otherwise?

Sinds deze week ook aan de slag gegaan met HA, erg leuk! Nu heb ik dus ook een afval card gemaakt:

Simpel, maar fijn. Nu wil ik deze nog simpeler maken, door het jaartal uit de datum te halen. Ik krijg het nog niet voor elkaar. Iemand hier die weet hoe dit te doen?

type: custom:auto-entities
card:
  title: Afval
  type: entities
  entity: null
entities:
  - sensor.afvalwijzer_gft
  - sensor.afvalwijzer_restafval
  - sensor.afvalwijzer_plastic
  - sensor.afvalwijzer_papier
sort:
  method: state

Hi there,

Im playing with HA for 2 days now and really enjoying the flexibilty. Next step is to integrate the garbage pickup but Im really struggling here. im trying to follow the installation howto but Im stuck on the configuration.yaml part.

Where should I add

- platform: afvalwijzer
      provider: mijnafvalwijzer        # (required, default = mijnafvalwijzer) either choose mijnafvalwijzer, afvalstoffendienstkalender or rova
      postal_code: 1234AB              # (required, default = '')
      street_number:  5                # (required, default = '')
      suffix: ''                       # (optional, default = '')
      exclude_pickup_today: true       # (optional, default = true) to take or not to take Today into account in the next pickup.
      default_label: Geen              # (optional, default = Geen) label if no date found
      id: ''                           # (optional, default = '') use if you'd like to have multiple waste pickup locations in HASS
      exclude_list: ''                 # (optional, default = '') comma separated list of wast types (case ignored). F.e. "papier, gft"

In my current configuration.yaml I`m reffering sensors to sensors.yaml with:

sensor: !include sensors.yaml

so I thought I should insert the code into the sensors.yaml but when I check the configuration it tells me there is something wrong here. I`ve aded the following in sensors.yaml:

- platform: afvalwijzer
      provider: mijnafvalwijzer        
      postal_code: 6135JR            
      street_number:  4              
      exclude_pickup_today: true
      default_label: Geen
      exclude_list: ''  

- platform: template
  sensors:
      afvalwijzer_restafval_next:
        friendly_name: Restafval
        entity_picture_template: /local/afvalwijzer/rest.png
        value_template: >
          {{state_attr('sensor.afvalwijzer_restafval','days_until_collection_date')}}
        attribute_templates:
          day: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))
              |timestamp_custom('%A')}}
          date: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))
              |timestamp_custom('%a %d %b')}}
          timestamp: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))}}
 
      afvalwijzer_gft_next:
        friendly_name: GFT
        entity_picture_template: /local/afvalwijzer/gft.png
        value_template: >
          {{state_attr('sensor.afvalwijzer_gft','days_until_collection_date')}}
        attribute_templates:
          day: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_gft'),'%d-%m-%Y'))
              |timestamp_custom('%A')}}
          date: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_gft'),'%d-%m-%Y'))
              |timestamp_custom('%a %d %b')}}
          timestamp: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_gft'),'%d-%m-%Y'))}}
      afvalwijzer_plastic_next:
        friendly_name: Plastic
        entity_picture_template: /local/afvalwijzer/plastic.png
        value_template: >
          {{state_attr('sensor.afvalwijzer_plastic','days_until_collection_date')}}
        attribute_templates:
          day: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))
              |timestamp_custom('%A')}}
          date: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))
              |timestamp_custom('%a %d %b')}}
          timestamp: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))}}
      afvalwijzer_papier_next:
        friendly_name: Papier
        entity_picture_template: /local/afvalwijzer/papier.png
        value_template: >
          {{state_attr('sensor.afvalwijzer_papier','days_until_collection_date')}}
        attribute_templates:
          day: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_papier'),'%d-%m-%Y'))
              |timestamp_custom('%A')}}
          date: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_papier'),'%d-%m-%Y'))
              |timestamp_custom('%a %d %b')}}
          timestamp: >
            {{as_timestamp(strptime(states('sensor.afvalwijzer_papier'),'%d-%m-%Y'))}}

When checking the config without the following code the file is considered ok and the sensors are created however obviusly without data because its missing this vital part…

- platform: afvalwijzer
      provider: mijnafvalwijzer        
      postal_code: 6135JR             
      street_number:  4               
      exclude_pickup_today: true
      default_label: Geen
      exclude_list: ''   

Any help is much appriciated :slight_smile:

This is working for me in configuration.yaml:


sensor:
  - platform: afvalwijzer
    provider: hvc                     # (required, default = mijnafvalwijzer) either choose mijnafvalwijzer, afvalstoffendienstkalender or rova
    postal_code: !secret postcode     # (required, default = '')
    street_number: !secret huisnummer # (required, default = '')
    suffix: ''                        # (optional, default = '')
    exclude_pickup_today: false       # (optional, default = true) to take or not to take Today into account in the next pickup.
    default_label: Geen               # (optional, default = Geen) label if no date found
    id: ''                            # (optional, default = '') use if you'd like to have multiple waste pickup locations in HASS
    exclude_list: ''                  # (optional, default = '') comma separated list of wast types (case ignored). F.e. "papier, gft"

  - platform: template
    sensors:
      afvalwijzer_next_pickup:
        friendly_name: "Eerstvolgende bak"
        value_template: >
          {% if is_state('sensor.afvalwijzer_next_type', 'gft & etensresten') %}
            GFT
          {% elif is_state('sensor.afvalwijzer_next_type', 'plastic, blik & drinkpakken') %} 
            Plastic
          {% elif is_state('sensor.afvalwijzer_next_type', 'restafval') %} 
            Restafval            
          {% endif %}
        entity_picture_template: > #/local/afvalbeheer-images/gft-grey.png
          {% if is_state('sensor.afvalwijzer_next_type', 'gft & etensresten') %}
            /local/afvalbeheer-images/gft-grey.png
          {% elif is_state('sensor.afvalwijzer_next_type', 'plastic, blik & drinkpakken') %}
            /local/afvalbeheer-images/pmd-grey.png
          {% elif is_state('sensor.afvalwijzer_next_type', 'restafval') %}
            /local/afvalbeheer-images/restafval-grey.png
          {% endif %}

Hi,

thanks for your input. After lots of testing with your code I finally figured it out. Spacing is everything in yaml…

Also I believe a reboot between installing the addon and setting up the config files was mandatory but I might be mistaking here…

Hi,

In my city Zutphen there is Circulus the garbage collector. It isnt in afvalwijzer unfortunately.
Can you add it to this nice integration?

https://www.circulus.nl/afvalkalender/

@Mariusthvdb

Thanks for your help. I’m getting progress… this is what I have right now, but I’m still not finished. How do I get the 5 at the top (volgende afval-ophaal) like you have and the date of the next pickup at the top? And how to define the next pickups like you did? Thanks in advance…

Because this is what I want:

the 5 is simply a template from an entity provided by the integration:

{{states('sensor.afvalwijzer_next_in_days')}}

you should check the entities, and just the entity_id in the templates.

Without any info from your system, there’s nothing we can.

the section with your black circles is all automated, based on custom:auto-entities, that uses custom:template-entity-row and auto sorts the entities based on the sort filter uses in that auto-entities

its all in Garbage pickup date (mijnafvalwijzer.nl) custom_component - #722 by Mariusthvdb

the icon is a template sensor. maybe you can figure that out yourself?

{{states('sensor.trash_next_icon')}}

is used in the markdown

if you cant, I have posted it in this topic before…

I used your (new) code. The ‘5’ the entity_id is correct so far I can see. The template sensor I have the figure out…

type: custom:mod-card
card_mod:
  style: |
    :host {
      --stack-card-margin: 0px;
    }
card:
  type: vertical-stack
  cards:
    - type: custom:button-card
      name: Afvalwijzer
      template: null
      hold_action:
        action: navigate
        navigation_path: |
          [[[ return window.location.pathname.split('/')[2] == 'calendar'
              ? '/ui-overview/home_summary' : null; ]]]
      styles:
        card:
          - background-color: var(--background-color-off)
          - color: Darkgreen
          - font-size: 20px
          - font-weight: Bold
          - padding: 12px
        name:
          - justify-self: left
    - type: custom:hui-element
      card_type: markdown
      card_mod:
        style: |
          ha-card.type-markdown {
            box-shadow: none;
          }
      content: >
        <font color={{states('sensor.trash_color')}}><ha-icon icon=
        {{'mdi:delete-alert' if states('sensor.afvalwijzer_today') != 'Geen'
        else 'mdi:delete-outline'}}> </ha-icon></font> Vandaag,
        {{states('sensor.vandaag')}}: <font color=
        {{states('sensor.trash_color')}}>**{{states('sensor.afvalwijzer_today')|capitalize}}</font>**

        <font color={{states('sensor.trash_next_color')}}><ha-icon icon=
        {{states('sensor.trash_next_icon')}}> </ha-icon></font> Volgende
        afval-ophaal over **<font
        color={{states('sensor.trash_next_color')}}>{{states('sensor.afvalwijzer_next_in_days')}}</font>**
        {{'dag' if states('sensor.afvalwijzer_next_in_days') == '1' else
        'dagen'}} op:

        <ha-icon icon= 'mdi:delete-alert'> </ha-icon>
        {{states('sensor.volgende_afval_ophaal_dag')}}: **<font
        color={{states('sensor.trash_next_color')}}>{{states('sensor.afvalwijzer_next_type')|capitalize}}</font>**
    - type: horizontal-stack
      cards:
        - type: picture-entity
          card_mod:
            style: |
              ha-card {
                box-shadow: none;
                animation: {% if is_state('persistent_notification.trash_notification_today','notifying') and
                                   states('sensor.afvalwijzer_today') != 'Geen' %} blink 2s linear infinite;
                           {% else %} none
                           {% endif %}
              }
              @keyframes blink {
                100% {opacity: 0;}
              }
          entity: sensor.afvalwijzer_today
          name: Vandaag
          show_state: false
          state_image:
            gft: /local/images/afvalwijzer/GFT.png
            papier: /local/images/afvalwijzer/Papier.png
            restafval: /local/images/afvalwijzer/Restafval.png
            plastic: /local/images/afvalwijzer/PMD.png
            Geen: /local/images/afvalwijzer/Geen1.png
        - type: picture-entity
          card_mod:
            style: |
              ha-card {
                box-shadow: none;
                animation: {% if is_state('persistent_notification.trash_notification_tomorrow','notifying') and
                                   states('sensor.afvalwijzer_tomorrow') != 'Geen' %} blink 2s linear infinite;
                           {% else %} none
                           {% endif %}
              }
              @keyframes blink {
                100% {opacity: 0;}
              }
          entity: sensor.afvalwijzer_tomorrow
          name: Morgen
          show_state: false
          state_image:
            gft: /local/images/afvalwijzer/GFT.png
            papier: /local/images/afvalwijzer/Papier.png
            restafval: /local/images/afvalwijzer/Restafval.png
            plastic: /local/images/afvalwijzer/PMD.png
            Geen: /local/images/afvalwijzer/Geen1.png
        - type: picture-entity
          entity: sensor.afvalwijzer_day_after_tomorrow
          card_mod:
            style: |
              ha-card {
                box-shadow: none;
              }
          name: Overmorgen
          show_state: false
          state_image:
            gft: /local/images/afvalwijzer/GFT.png
            papier: /local/images/afvalwijzer/Papier.png
            restafval: /local/images/afvalwijzer/Restafval.png
            plastic: /local/images/afvalwijzer/PMD.png
            Geen: /local/images/afvalwijzer/Geen1.png
    - type: custom:auto-entities
      card:
        type: entities
      filter:
        exclude:
          - entity_id: sensor.afvalwijzer*next*
          - entity_id: sensor.afvalwijzer*to*
        include:
          - entity_id: sensor.afvalwijzer_*
            options:
              type: custom:template-entity-row
              image: >
                {% set type = config.entity.split('afvalwijzer_')[1] %}
                /local/images/afvalwijzer/{{type}}.png
              state: >
                {% set trash = config.entity %} {% set today =
                state_attr(trash,'is_collection_date_today') %} {% set future =
                state_attr(trash,'days_until_collection_date') %} {% if future
                is none or
                   (is_state(trash,'Geen') and future == 0) %} Tba
                {% else %} {{as_timestamp(strptime(states(trash),'%d-%m-%Y'))
                                |timestamp_custom('%-d %b')}}
                {% endif %}
              secondary: >
                {% set trash = config.entity %} {% set today =
                state_attr(trash,'is_collection_date_today') %} {% set future =
                state_attr(trash,'days_until_collection_date') %} {% if future
                is none or
                   (is_state(trash,'Geen') and future == 0) %} Nog niet gepubliceerd
                {% else %}
                  {% set count = state_attr(trash,'days_until_collection_date')|int(default=0) %}
                  {% set day = as_timestamp(strptime(states(trash),'%d-%m-%Y'))
                     |timestamp_custom('%A') %}
                  {% set dagen =
                    {'Monday': 'Maandag',
                    'Tuesday': 'Dinsdag',
                    'Wednesday': 'Woensdag',
                    'Thursday': 'Donderdag',
                    'Friday': 'Vrijdag',
                    'Saturday': 'Zaterdag',
                    'Sunday': 'Zondag'} %}
                  {% set dag = dagen[day] if day in dagen else day %}
                  {% set unit = 'dag' if count == 1 else 'dagen' %}

                  {% if count >= 28 %} {% set phrase = dag + ' over 4 weken' %}
                  {% elif count >= 21 %} {% set phrase = dag + ' over 3 weken' %}
                  {% elif count >= 14 %} {% set phrase = dag + ' over 2 weken' %}
                  {% elif count >= 7 %} {% set phrase = 'Volgende week ' + dag %}
                  {% elif count >= 3 %} {% set phrase = 'komende ' + dag %}
                  {% elif count == 2 %} {% set phrase = dag + ', overmorgen' %}
                  {% elif count == 1 %} {% set phrase = 'morgen, ' + dag %}
                  {% else %} {% set phrase = 'Vandaag, ' + dag %}
                  {% endif %}
                  {{phrase}} {% if count != 0 %} ({{count}} {{unit}}) {% endif %}
                {% endif %}
      sort:
        method: attribute
        attribute: days_until_collection_date
        numeric: true
      entities:
        - type: custom:fold-entity-row
          head:
            type: section
            label: Automations
            card_mod:
              style: |
                .label {
                  margin-left: 0px;
                }
          group_config:
            state_color: true
          padding: 0
          entities:
            - entity: input_boolean.trash_reminder
              secondary_info: last-changed
            - entity: input_boolean.trash_outside
              secondary_info: last-changed
            - entity: automation.afval_vandaag
              name: Notify vandaag
              secondary_info: last-triggered
            - entity: automation.afval_morgen
              name: Notify morgen
              secondary_info: last-triggered

ok, please help me to help you: what was your question in above post?
I can not see if you made any progress there.

Did you find the template sensor above?

Yes, I did find it. I did add the code to my configuration.yaml. Some settings did change, but still not the way I would like to have it. Like the ‘5’ (remaining days) was 9 instead of the remaining days.

As a test I removed the code again from configuration.yaml but the sensors created are still visible in entities. I can’t remove them? Why? Edit: I fixed the removal by using the service purge entities.

Hi,
i have the afvalwijzer working but as a basic card in the dashboard.
Also custom-entities from HACS is installed.
Could you please advise:

  • where the icons (GFT…) need to be placed. In a new folder under /config or do i need to use SSH and edit?
    /config//local/images/afvalwijzer/Geen1.png ??

Hello Everybody,
In the last days i’m working on my home assistant skills :smiley:
And today I tried to add the afvalwijzer. I added the code from Mariusthvdb, including all the HACS addons/plugins. When adding a card, the main part of the code is loading.

The only thing I can’t figure out is:
2 of the pictures cannot be loaded. The today " plastic" loads fine, but the other two not. The png files are in the same folder and I double checked the code for typo’s :slight_smile:
and 2 of the date’s are stated " unknown".

Can someone help me out where to look? :slight_smile:
(I’m not working in YAML mode)

Lol that’s exactly the same problem i’ve got. My card is identical to yours and cant figure out what i’m missing

How are you using this in combination with Recycle in Belgium?
Have you installed the Recycle integration via HACS and then use the custom code to create a card?

Thanks!

Hi,

I am implementing this nice plugin and use the code from @Mariusthvdb .
In the defintion there are these images .
Where can I find them? And where do I put them on my own HA. I think I can’t go higher than the config folder.

Thank you very much.

            gft: /local/afvalwijzer/gft.png
            papier: /local/afvalwijzer/papier.png
            restafval: /local/afvalwijzer/restafval.png
            plastic: /local/afvalwijzer/plastic.png
            Geen: /local/afvalwijzer/kliko_geen.png
            unknown: /local/afvalwijzer/kliko_geen.png

please put some effort in this… they’re nicely posted at the code owners resource.

simply rename them to what you need and you’re set

1 Like