Days until bin collection instead of date

Oke so i could find my latest backup after a crash and had to do it all again.
luckily i had a backup from last year but still a lot of work lost!

noticing when reading back, all this is a bit complicated to grasp again if you have
not done this before. (or reading this the first time)

So i thought i would make you guys a small guide. If you read this you hopefully know how to make this:

First of… install ‘‘Afvalbeheer’’ integration in integrations

Read the documentation to choose the right waste collector in your yaml !!

Second put this Yaml in your Configuration.yaml file:
(and change postal code and streetnumber to your adres)

# Afval beheer
afvalbeheer:
      wastecollector: MijnAfvalwijzer
      resources:
        - restafval
        - gft
        - papier
        - pmd
      postcode: (vul hier je postcode in)
      streetnumber: (vul hier je huisnummer in)
      suffix: ""                        # (optional)
      upcomingsensor: 1                # (optional)
      dateformat: '%d-%m-%Y'           # (optional)
      dateonly: 1                      # (optional)
      name: ""                         # (optional)
      nameprefix: 1                    # (optional)
      builtiniconsnew: 1               # (optional)
      dutch: 1                         # (optional)

After that put the following yaml in your templates.yaml file (if you dont have this you can google how to make this file. Or i beleive you can choose to put it in your configuration.yaml aswell. but i have it in my templates.yaml:

So put this in Templates.yaml:
Make sure that youre name and unique_id are a different name than the original sensor.

############ Bin collection opzet vandaag morgen etc########################    

    - name: afvalbeheer_gft
      unique_id: afvalbeheer_gft
      icon: mdi:calendar
      state: >
         {% set days = (((strptime(states('sensor.mijnafvalwijzer_gft'), '%d-%m-%Y') | as_local - now()).days  + 1) | int) %}
         {% if days == 0 %}
           Vandaag
         {% elif days == 1 %}
           Morgen
         {% else %}
           {{ days }} Dagen
         {% endif %}
         
    - name: afvalbeheer_pmd
      unique_id: afvalbeheer_pmd
      icon: mdi:calendar
      state: >
         {% set days = (((strptime(states('sensor.mijnafvalwijzer_pmd'), '%d-%m-%Y') | as_local - now()).days  + 1) | int) %}
         {% if days == 0 %}
           Vandaag
         {% elif days == 1 %}
           Morgen
         {% else %}
           {{ days }} Dagen
         {% endif %}

    - name: afvalbeheer_restafval
      unique_id: afvalbeheer_restafval
      icon: mdi:calendar
      state: >
         {% set days = (((strptime(states('sensor.mijnafvalwijzer_restafval'), '%d-%m-%Y') | as_local - now()).days  + 1) | int) %}
         {% if days == 0 %}
           Vandaag
         {% elif days == 1 %}
           Morgen
         {% else %}
           {{ days }} Dagen
         {% endif %}
         
    - name: afvalbeheer_papier
      unique_id: afvalbeheer_papier
      icon: mdi:calendar
      state: >
         {% set days = (((strptime(states('sensor.mijnafvalwijzer_papier'), '%d-%m-%Y') | as_local - now()).days  + 1) | int) %}
         {% if days == 0 %}
           Vandaag
         {% elif days == 1 %}
           Morgen
         {% else %}
           {{ days }} Dagen
         {% endif %}

Once you have put this in your templates.yaml
You will have to restart Home assistant i think.

After that go to your entities page and check if the newly made sensors are there:

You can see that the sensor will have template behind it.
Make sure you put this sensor in the card . not the original one.
The original one will show you just the dates.

The new sensor will show you text. like today/vandaag. or tomorrow/morgen.

Then you have to make the card:

Choose to manually make a card (handmatig) so you have the empty box and then copy past my yaml in there.
i have made it so that i only see the bins that need to be empty today or tommorrow. and otherwise i see no bin.
But if you want to see all the bins with all dates. i will show you the card yaml later.

So the card yaml for only showing the bins that need to be done today/ tomorrow
In dutch by the way so you can change the names to your language:

type: horizontal-stack
cards:
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_gft
        state: Vandaag
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_gft
      image: /local/afbeeldingen/GFT1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_gft
        state: Morgen
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_gft
      image: /local/afbeeldingen/GFT1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_restafval
        state: Vandaag
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_restafval
      image: /local/afbeeldingen/REST1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_restafval
        state: Morgen
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_restafval
      image: /local/afbeeldingen/REST1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_pmd
        state: Vandaag
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_pmd
      image: /local/afbeeldingen/PLASTIC1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_pmd
        state: Morgen
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_pmd
      image: /local/afbeeldingen/PLASTIC1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_papier
        state: Vandaag
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_papier
      image: /local/afbeeldingen/PAPIER1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;
  - type: conditional
    conditions:
      - condition: state
        entity: sensor.afvalbeheer_papier
        state: Morgen
    card:
      show_state: true
      show_name: false
      camera_view: auto
      type: picture-entity
      entity: sensor.afvalbeheer_papier
      image: /local/afbeeldingen/PAPIER1.png
      card_mod:
        style: |
          ha-card
            {background: transparent;
            border-style: none;
            color: red;

Make sure you install Card mod integration trough HACS libarary to be able to use the card mod to make them transparant.
If you dont know how, or dont want this. Just delete this part from every card in your yaml:


            card_mod:
              style: |
                ha-card
                  {background: transparent;
                   border-style: none;

If you want the card showing all the bins and their dates( as shown in previous posts) use this yaml:

MAKE SURE YOU INSTALL AUTO ENTITIES FIRST!
Without auto entities it will also work, i just used this card to put the bins in the right order. So from left to right the first one that needs to be emptyd until the last one.

Without auto entities , you will still see the bins but not int the correct order.
Also in this case you cannot use my Yaml.

type: custom:auto-entities
card:
  square: true
  type: grid
  columns: 4
card_param: cards
filter:
  include:
    - entity_id: sensor.afvalbeheer_gft
      options:
        type: picture-entity
        show_name: false
        image: /local/afbeeldingen/GFT1.png
        card_mod:
          style: |
            ha-card
              {background: transparent;
              border-style: none;
              color: red;
    - entity_id: sensor.afvalbeheer_papier
      options:
        type: picture-entity
        show_name: false
        image: /local/afbeeldingen/PAPIER1.png
        card_mod:
          style: |
            ha-card
              {background: transparent;
              border-style: none;        
    - entity_id: sensor.afvalbeheer_pmd
      options:
        type: picture-entity
        show_name: false
        image: /local/afbeeldingen/PLASTIC1.png
        card_mod:
          style: |
            ha-card
              {background: transparent;
              border-style: none;
    - entity_id: sensor.afvalbeheer_restafval
      options:
        type: picture-entity
        show_name: false
        image: /local/afbeeldingen/REST1.png
        card_mod:
          style: |
            ha-card
              {background: transparent;
              border-style: none;
  exclude: []
sort:
  method: state
  numeric: false

I will also give you my pictures. these are transparant.

BY THE WAY I USE THE CARD MOD IN ALL CARDS TO MAKE THEM TRANSPARANT. YOU CAN REMOVE THIS IF YOU WISH. TO USE IT YOU WILL NEED CARD MOD CARD!




last of all, if its not working. check all your entities, and entitie id’s

Usually you will have to check your entities and compare if the names are the same.

Same goes for the location of the pictures.

This is in www/afbeeldingen/ (i believe i created this folder) so you can either change the location or try and copy my setup. your choice.

Hope i didnt forget anything! this post was purely to help the next person reading this! and if you have questions you can ask but i might not reply cuickly because im not often on the forum. And im certainly no expert! hopefully the rest can help you if i dont reply.

Last thing, if you are using this guide. and it helps you. show some love with a reply/message… fun to hear if it helps anyone. Took some time to write this for you!

Good Luck!!!

1 Like