Garbage pickup date (mijnafvalwijzer.nl) custom_component

Hi,
In my town the used paper is collected each month by “de buurtvereniging” and that data it’s not known/displayed in mijnafvalwijzer.nl. So off course the HA integration can’t display the used paper dates and only show the restafval, pmd and gft dates.

The paper is collected eacht month at the 2e tuesday of the month. Does anybody know how to calculate the used paper collection date and add it in the entity / sensor?

Hey there,

Your “state_image:”

        state_image:
          GFT: /local/afvalwijzer/gft.png
          Geen: /local/afvalwijzer/geen.png
          PMD: /local/afvalwijzer/pmd.png
          Papier: /local/afvalwijzer/papier.png

Should match:

          {% if is_state('sensor.afvalwijzer_day_after_tomorrow', '**gft_etensresten**') %}GFT
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', '**papier**') %}Papier
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', **'plastic_blik_drinkpakken**

So:

state_image:
          gft_etensresten: /local/afvalwijzer/gft.png
          geen: /local/afvalwijzer/geen.png
          plastic_blik_drinkpakken: /local/afvalwijzer/pmd.png
          papier: /local/afvalwijzer/papier.png

[quote=“Hobbybob, post:866, topic:34631, full:true”] so I created one for PMD since the orange background was missing. I also created a new image (the HA-logo in black/grey) for the days where there is no garbage pickup. My wife found the images for “no pickup” and “restafval” too much alike.
[/quote]

After i while i realized your wife was right about that logo :wink: i have change it not too like you did.

It just looked too much like a normal trash-bin.

She was right about that in my opinion too, but I’m not going to admit that to her :rofl:

1 Like

Thanks, I’m going to change it and then wait until Wednesday for the next pickup. Hadn’t thought of this yet :slight_smile:

Okay, I made the changes and the Papier and PMD icons are now good. Today I received GFT visible for the day after tomorrow, but it is not working yet. I have set everything like the other sensors, but my GFT icon still remains set to none

This is what i have:

entity: sensor.afvalwijzer_day_after_tomorrow_formatted
show_name: true
show_state: false
state_image:
  gft_etensresten: /local/afvalwijzer/gft.png
  Geen: /local/afvalwijzer/geen.png
  pmd: /local/afvalwijzer/pmd.png
  papier: /local/afvalwijzer/papier.png
type: picture-entity
      afvalwijzer_day_after_tomorrow_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_day_after_tomorrow', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Overmorgen"

icons

By the way, my PMD sensor had changed after the last update, adjusted and pmd works
sensor.afvalwijzer_plastic_blik_drinkpakken to sensor.afvalwijzer_pmd

Many thanks to all of you!
I combined some things and changed some others and created this:
image

1 Like

Almost:

Untitled

Match these two and it should be working…

Yes, I tried that too, but unfortunately it didn’t work.
I will try again by making both GFT and then wait until the next collection time.

Thnx you

Hey Guys,

I’m trying to set this up but i’m very new to home assistant and custom integrations like this and would like some help.

In configuration.yaml

i added the sensor bit of code and filled in my house information after installing it from HACS together with template-entity-row and auto-entities

I tried making a custom card on a dashboard with information i got from this thread but it won’t show up anything. would anyone be willing to help me out?

— Edit:

Figured it out, had to restart Home Assistant in order for it to work

Hey,

i love the integration, but i would love to be able to expand it so that i get a notification on my phone and my wife’s on what type of carbage we have to put out on the street the following day, has anyone set that up yet and if so could they tell me how they did it?

Well it’s time for the GFT waste bin again, I had changed my state image to GFT, but as you can see the image does nothing, Papier and PMD do work.

Here is my lovelace card:

cards:
  - entity: sensor.afvalwijzer_today_formatted
    show_name: true
    show_state: false
    state_image:
      GFT: /local/afvalwijzer/gft.png
      Geen: /local/afvalwijzer/geen.png
      PMD: /local/afvalwijzer/pmd.png
      Papier: /local/afvalwijzer/papier.png
    type: picture-entity
  - entity: sensor.afvalwijzer_tomorrow_formatted
    show_name: true
    show_state: false
    state_image:
      GFT: /local/afvalwijzer/gft.png
      Geen: /local/afvalwijzer/geen.png
      PMD: /local/afvalwijzer/pmd.png
      Papier: /local/afvalwijzer/papier.png
    type: picture-entity
  - entity: sensor.afvalwijzer_day_after_tomorrow_formatted
    show_name: true
    show_state: false
    state_image:
      GFT: /local/afvalwijzer/gft.png
      Geen: /local/afvalwijzer/geen.png
      PMD: /local/afvalwijzer/pmd.png
      Papier: /local/afvalwijzer/papier.png
    type: picture-entity
type: horizontal-stack

Here’s my template:

  - platform: template
    sensors:
      afvalwijzer_next_type_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_next_type', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_next_type', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_next_type', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Volgende type afval"

      afvalwijzer_today_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_today', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_today', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_today', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Vandaag"

      afvalwijzer_tomorrow_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_tomorrow', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_tomorrow', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_tomorrow', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Morgen"

      afvalwijzer_day_after_tomorrow_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_day_after_tomorrow', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Overmorgen"

It may be that my sensor for GFT has a name that is too long, the original name is sensor.afvalwijzer_gft_etensresten.

I also had this before the last update with the PMD sensor, which was then sensor.afvalwijzer_plastic_blik_drinkpakken, and after the update the sensor was replaced for sensor.afvalwijzer_pmd and my state image for PMD did work.

Check your states in developer tools and make sure that they match

Like so:

image

You have set sensor.afvalwijzer_day_after_tomorrow

As:

gft_etensresten

while in fact the actual state of the sensor is:

gft & etensresten

Change this:

{% if is_state('sensor.afvalwijzer_day_after_tomorrow', 'gft_etensresten')

Into this:

{% if is_state('sensor.afvalwijzer_day_after_tomorrow', 'gft & etensresten')

Here is my states in developer tools, not the same. You can also see the original GTF sensor and indicates that there is a pick-up time for the day after tomorrow

I also changed the names of the sensor ‘gft_etensresten’ to 'gft & etensresten, then restarted but that didn’t help either.

This is very strange, your tomorrow_formatted shows “Geen” while the sensor tomorrow shows “gft & etensresten”, and you have to figure out what is causing this because that is why the image won’t show.

image

Mine reads:

image

I’ve mentioned it before, but I think it’s due to the “sensor.afvalwijzer.gft_etensresten”. I had the same problem with the PMD sensor that did not work, but after an update it suddenly worked.
Before the update it was called “sensor.afvalwijzer.plastic_blik_drinkpaken”, and after the update “sensor.afvalwijzer.pmd”. After that the PMD sensor state did work.

Maybe @ xirixiz can change this in a new update to “sensor.afvalwijzer.gft” instead of “sensor.afvalwijzer.gft_etensresten”.

The sensors are defined in your “waste.yaml”

Can you paste it here? or using pastebin?

Yes of course, here is the complete waste.yaml

################################################
# Packages
################################################
homeassistant:
  customize:
    sensor.afvalwijzer_today:
      friendly_name: Vandaag
    sensor.afvalwijzer_tomorrow:
      friendly_name: Morgen
    sensor.afvalwijzer_day_after_tomorrow:
      friendly_name: Overmorgen
    sensor.afvalwijzer_next_type:
      friendly_name: Volgende type afval
    sensor.afvalwijzer_next_date:
      friendly_name: Eerstvolgende ophaalmoment
    sensor.afvalwijzer_next_in_days:
      friendly_name: Aantal dagen voor ophaalmoment
    input_boolean.waste_reminder:
      icon: mdi:reminder

    sensor.afvalwijzer_gft_etensresten:
      friendly_name: GFT
      entity_picture: /local/afvalwijzer/gft.png
    sensor.afvalwijzer_papier:
      friendly_name: Papier
      entity_picture: /local/afvalwijzer/papier.png
    sensor.afvalwijzer_pmd:
      friendly_name: PMD
      entity_picture: /local/afvalwijzer/pmd.png

################################################
# Inputs
################################################
input_boolean:
  waste_moved:
    name: Afval staat aan de weg
    initial: off
    icon: mdi:delete-empty
  waste_reminder:
    name: Afval herrinering
    initial: on
    icon: mdi:delete-empty
  waste_outside:
    name: Afval buiten herinnering
    initial: off
    icon: mdi:delete-empty

################################################
# Sensor
################################################
sensor:
  - platform: afvalwijzer
    provider: !secret afvalverwerker
    postal_code: !secret postcode
    street_number: !secret huisnummer
    suffix: ''
    exclude_pickup_today: false
    default_label: Geen
    id: ''
    exclude_list: ''

################################################
# Formatted sensors
################################################
  - platform: template
    sensors:
      afvalwijzer_next_type_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_next_type', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_next_type', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_next_type', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Volgende type afval"

      afvalwijzer_today_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_today', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_today', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_today', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Vandaag"

      afvalwijzer_tomorrow_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_tomorrow', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_tomorrow', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_tomorrow', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Morgen"

      afvalwijzer_day_after_tomorrow_formatted:
        value_template: >-
          {% if is_state('sensor.afvalwijzer_day_after_tomorrow', 'gft_etensresten') %}GFT
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', 'papier') %}Papier
          {% elif is_state('sensor.afvalwijzer_day_after_tomorrow', 'pmd') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Overmorgen"

I believe it’s in the manual on git.