Garbage pickup date (mijnafvalwijzer.nl) custom_component

Do you have duplicate sensor: entries in you configuration.yaml file maybe?

You could also enable debug logging for the component:

logger:
  default: info
  logs:
    custom_components.afvalwijzer: debug

What do you mean by duplicate sensors?
This is what I have:

sensor:
  - platform: afvalwijzer

sensor:
  - platform: time_date

sensor:
- platform: nederlandse_spoorwegen

- platform: template
  sensors:
    greeting_time:

Should they all be onfigured under one sensor: then with each having their own type?

Where does this log info go to?
Ii have added the code to the configuration.yaml

yes, under 1 sensor:

@bobbasli we’re happy to help with having this component up and running. For gaining basic knowledge, like logs etc, I’d like to refer you to the HASS documentation and/or getting started section: Getting Started - Home Assistant

Example: System Log - Home Assistant

Okay, that does the trick!
Only part I need to het working again is my

- platform: template
  sensors:
    greeting_time:
     friendly_name: Greetings
      value_template: >
        {% set day = now().strftime('%A') %}
        {%- set wdays = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] %}
        {%- if as_timestamp(now()) | timestamp_custom('%H') | int < 12 -%}
        {{ ["Mogguh", "Goeiemorgen", "God morgon", "Bonjour", "Good Morning", "Guten morgen", "Hallo", "Hi", "Hoi", "Hallootjes", "Welkom terug", "Fijne " ~day] | random }}
        {%- elif as_timestamp(now()) | timestamp_custom('%H') | int < 18 -%}
        {{ ["sMiddags", "Goeiemiddag", "God eftermiddag", "Bon apres midi", "Good Afternoon", "Guten Mittag", "Hallo", "Hi", "Hoi", "Hallootjes", "Welkom terug", "Fijne " ~day] | random }}
        {%- else -%}
        {{ ["nAvond", "Goeienavond", "Bonsoir", "God kv'\0xC3\0xA4'll", "Good Evening", "Guten Abend", "Hallo", "Hi", "Hoi", "Welkom terug", "Hallootjes", "Fijne " ~day] | random }}
        {%- endif -%}

Now this code gives me an error where it used to work before. I assume this should also be placed under sensor:

As Xirixiz said, please try and read up on basic HA knowledge, especially when doing less than obvious things like template sensors…

btw, you’re still using the legacy format here, so might be a nice opportunity to move to the new template: syntax for those.

btw, although initially funny, that sensor is useless, as it returns many identical phrases during the different daytimes ?? (dont answer, its off topic, Im sorry)

1 Like

I ditched the greetings code and now it’s working as expected.
Thanks for your help @Mariusthvdb and @xirixiz .

Restarted my homeassistant today, sadly the afvalwijzer compoment did not load with the error:

This error originated from a custom integration.

Logger: custom_components.afvalwijzer.const.const
Source: custom_components/afvalwijzer/collector/main_collector.py:101
Integration: afvalwijzer (documentation, issues)
First occurred: 15:56:06 (1 occurrences)
Last logged: 15:56:06

Check afvalwijzer platform settings (ConnectionError(MaxRetryError(“HTTPSConnectionPool(host=‘securetoken.googleapis.com’, port=443): Max retries exceeded with url: /v1/token?key=AIzaSyA6NkRqJypTfP-cjWzrZNFJzPUbBaGjOdk (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x7f124b99ea20>: Failed to establish a new connection: [Errno -3] Try again’))”)),)

Any clues how to fix this?

It’s a bit odd but after a few more reboots it started working again.

Hi there, i do really like the card and layout, but i can’t seem to figure out how you created
sensor.afvalwijzer_day_after_tomorrow_formatted
and sensor.afvalwijzer_day_after_today_formatted
Would you be so kind to share it?

Sure! I’m not on my laptop right now, so it is a bit more difficult to give my exact code. If you want that, let me know and I’ll post it another time.

But in short: I copy-pasted these sensors straight for the code of xirixiz. He linked his config-files earlier since he has them on GitHub also: Garbage pickup date (mijnafvalwijzer.nl) custom_component - #844 by xirixiz

Please let me know if this is helpfull for you, or if you need me to post something more extensive another time.

1 Like

Hi,

I can’t figure out why the geen.png icon is not getting displayed. I’ve read in the comments above that capital letter makes difference but in my case neither of them work (I have geen for today and Geen for tomorrow). What else am I missing? The gft.png is shown properly.

Can you show the value of the sensors? If you have an automatic dashboard, the sensor-values will be displayed there.

Thanks!, i will have a look at it.

It works :wink:

Thank you for showing my in the right direction:

image

1 Like

Awesome! :+1:

Maybe someone has suggestions for my problem. My waste integration actually works perfectly, both with notifications to my mobile and the dates of the collection time. I only have a problem with 2 pictures that are not displayed while there is 1 that always works.

Paper works perfectly, get a place from the day after tomorrow
PMD & GFT do not work, cannot get any images as you see in the screenshot, GFT should now be visible by the day after tomorrow.

Mijn Yaml code:

################################################
# 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_plastic_blik_drinkpakken:
      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', 'plastic_blik_drinkpakken') %}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', 'plastic_blik_drinkpakken') %}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', 'plastic_blik_drinkpakken') %}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', 'plastic_blik_drinkpakken') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Overmorgen"

My card:

cards:
  - 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
  - type: custom:auto-entities
    card:
      type: glance
    filter:
      include:
        - entity_id: sensor.afvalwijzer_gft_etensresten
        - entity_id: sensor.afvalwijzer_papier
        - entity_id: sensor.afvalwijzer_plastic_blik_drinkpakken
    sort:
      attribute: days_until_collection_date
      method: attribute
      numeric: true
  - entities:
      - entity: sensor.afvalwijzer_today
        icon: phu:garbage-residual
        secondary_info: none
      - entity: sensor.afvalwijzer_tomorrow
        icon: phu:garbage-residual
        secondary_info: none
      - entity: sensor.afvalwijzer_day_after_tomorrow
        icon: phu:garbage-residual
        secondary_info: none
      - style:
          background: '#62717b'
          height: 1px
          margin-left: auto
          margin-right: auto
        type: divider
      - entity: sensor.afvalwijzer_next_type
        icon: phu:garbage-residual
        secondary_info: none
      - entity: sensor.afvalwijzer_next_in_days
        icon: phu:garbage-residual
        secondary_info: none
      - style:
          background: '#62717b'
          height: 1px
          margin-left: auto
          margin-right: auto
        type: divider
      - entity: input_boolean.waste_reminder
        name: Afval aan de weg zetten
        secondary_info: none
      - entity: input_boolean.waste_outside
        secondary_info: none
      - entity: input_boolean.waste_moved
        secondary_info: none
    show_header_toggle: false
    type: entities
    state_color: true
type: vertical-stack

1 Like

Hi Braakie, i would like to use these too, ( your config) how and where did you put the yaml files? and the card ? did you put it in a custom card? “show code editor” and paste it there? thnx for help in advance

greets

johan

You need HACS and then you need to install the “auto-entities” card.

In the “configuration.yaml” file I put:

# Loads packages
homeassistant:
  packages: !include_dir_named packages

Then you create a folder in the config folder called “packages” and in the packages folder I create a file “afvalwijzer.yaml” with the following code:

################################################
# 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_plastic_blik_drinkpakken:
      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', 'plastic_blik_drinkpakken') %}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', 'plastic_blik_drinkpakken') %}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', 'plastic_blik_drinkpakken') %}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', 'plastic_blik_drinkpakken') %}PMD
          {% else %}Geen
          {% endif %}
        friendly_name: "Overmorgen"

Of course, you have to change the correct sensor names yourself to the ones that are displayed for you

Now restart Home Assistant and choose a new card in your lovelace dashboard, just choose manual at the bottom and paste my card code into it.

For the data you need to load, you must enter your own data. I put that in the “secret.yaml” file.

From your “afvalwijzer.yaml”

  - platform: afvalwijzer
    provider: !secret afvalverwerker
    postal_code: !secret postcode

Put in the “secret.yaml” this code

# Afvalwijzer
afvalverwerker: your waste processors name
postcode: "your zip code"
huisnummer: "your house number"