Garbage pickup date (mijnafvalwijzer.nl) custom_component

Apologies for late reply, but did you manage to solve it yourself in the meantime? If not then I will do it somewhere coming week.

EDIT: here you go:

1 Like

Hello @fversteegen,

First of all the best wishes for 2024.

I managed to do it with the Draw.io application. It was quite a bit of tinkering to finally get it done. I will also share my creations here. Maybe other users will find it helpful too.

I’m really curious about how you made the pictures and with which application.

Here we go with my creation;

pmd_snoei

best_snoei

gft_papier

pmd_best

Cheers Herman

3 Likes

Okay, I’m feeling really dumb right now, but I’m going to ask anyways. I’ve installed HomeAssistant on my RPi4 in June, but haven’t gotten around to doing much with it due to real-life events. I’m picking it back up now, and one of the things I have installed is afvalwijzer. It works great, but all I see are the sensor-values. I cannot find any card that has the nice pictures as in the two png-files on the Github-repository. I also can’t find any code how to create those type of cards.

Can anybody point me in the right direction? Or is this a bit much to start with as a HA-newby?

Hi, welcome! Don’t worry, everybody needs to start somewhere.

This is the lovelace code I`m currently using for my sensors (your sensor might have different names, so be aware of that.

cards:
  - cards:
      - entity: sensor.afvalwijzer_today_formatted
        show_name: false
        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
          Restafval: /local/afvalwijzer/Restafval.png
        type: picture-entity
      - entity: sensor.afvalwijzer_tomorrow_formatted
        show_name: false
        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
          Restafval: /local/afvalwijzer/Restafval.png
        type: picture-entity
      - entity: sensor.afvalwijzer_day_after_tomorrow_formatted
        show_name: false
        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
          Restafval: /local/afvalwijzer/Restafval.png
        type: picture-entity
    type: horizontal-stack
  - type: entities
    show_header_toggle: false
    entities:
      - entity: sensor.afvalwijzer_gft
        format: date
      - entity: sensor.afvalwijzer_papier
        format: date
      - entity: sensor.afvalwijzer_pmd
        format: date
      - entity: sensor.afvalwijzer_restafval
        format: date
  - type: custom:auto-entities
    card:
      type: glance
    filter:
      include:
        - entity_id: sensor.afvalwijzer_gft
        - entity_id: sensor.afvalwijzer_papier
        - entity_id: sensor.afvalwijzer_pmd
        - entity_id: sensor.afvalwijzer_restafval
    sort:
      attribute: days_until_collection_date
      method: attribute
      numeric: true
  - entities:
      - entity: sensor.afvalwijzer_today
      - style:
          background: '#62717b'
          height: 1px
          margin-left: auto
          margin-right: auto
        type: divider
      - entity: sensor.afvalwijzer_next_type
      - entity: sensor.afvalwijzer_next_in_days
      - style:
          background: '#62717b'
          height: 1px
          margin-left: auto
          margin-right: auto
        type: divider
      - entity: input_boolean.waste_moved
      - entity: input_boolean.waste_reminder
    show_header_toggle: false
    type: entities
    state_color: false
type: vertical-stack

Result visualized is like this:

That’s a great starting point. I really need to get into the whole system of cards I see. An attractive dashboard invites to do more with it!

I straight- up copied and pasted it for now, I will check the names and images and stuff soon, but the first info is already working!

Great! Maybe this is also usefull to get a better understanding: https://github.com/xirixiz/my-hass-config/blob/b51024a19117897d339443e2fafb1ef826e77310/packages/waste.yaml

1 Like

I must be doing something wrong… but I copied and pasted your lovelace into a custom card and I’m not getting the same view as you are having :face_with_raised_eyebrow:

It keeps giving me the icons and not the pictures I saved to local/afvalwijzer/

Can you help me out?

:slight_smile: the files (images / jpg files) have to be in your hass folder (under www):

Ofcourse you need the add the ones depending on your requirements.
I have some here for you: https://github.com/xirixiz/my-hass-config/tree/master/www/afvalwijzer

Yeah I have them there, config/www/afvalwijzer and local/afvalwijzer in Home Assistant should be redirected to that location right?

The “geen” days are showing the “geen” bin as you can see, but the rest keeps an icon it does not change to the nice looking images.
Highly frustrating :rofl::rofl::rofl:

That’s correct indeed. Not local/afvalwijzer but /local/afvalwijzer. Please validate the case and extension of the icons if they match what you have defined in the lovelace config. It’s something small, as Geen is showing up nicely.

Also check security rights if they are the same as the Geen one.

Otherwise please post some logs and/or screenshots of your lovelace config and the folder structure where you saved the files to.

Thanks for trying to help me out on this.
I have this in my configuration.yaml

I made a waste.yaml just like you (check below). But somehow it seems it is not picking up that yaml file.

Integration error: waste - Integration ‘waste’ not found.

I tried adding “waste: !include waste.yaml” But then when I check the config it gives me an error:
Configuratiewaarschuwingen

thanks again.

Check this: https://github.com/xirixiz/my-hass-config/blob/b51024a19117897d339443e2fafb1ef826e77310/configuration.yaml#L1-L2

Then also keep in mind I`m using waste.yaml in the packages folder. See structure here: GitHub - xirixiz/my-hass-config: 🏡 Open source home automation that puts local control and privacy first

putting it in packages was the trick!
We have got this now!
Only not getting the weeks counter (next week, in two weeks…) it is just giving me the date

Thanks for helping me out man!

Great! You can remove this part:

image

It’s the same as the row below. I used my code for you, but that’s still in development phase. This is also the reason why you’re not getting the “in x weeks” statements.

A next release is to be expected ready at the end of the month.

Thanks a lot again for your help. I think I am quite a long way with this card already, but what I don’t quite understand is where you have put the waste.yaml-file, and how you tell HA to load it.

I am running HA OS, and my configuration.yaml is in the config-folder (I’m using Samba to change files on the RPi).

Edit: nevermind, of course I found the answer right after asking here
For potential googlers that end up here: in configuration.yaml, you just add a line with
homeassistant: !include waste.yaml
And make sure to leave out the starting “homeassistant:” in the waste.yaml-file.

1 Like

I’m not getting something.
Why do I have these sensors:

  • sensor.afvalwijzer_groente_fruit_en_tuinafval
  • sensor.afvalwijzer_papier
  • sensor.afvalwijzer_plastic_metaal_en_drinkpakken

but not this one:

  • sensor.trash_restafval

That may have to do with which waste provider you have, these are mine:

  • sensor.afvalwijzer_gft_etensresten
  • sensor.afvalwijzer_papier
  • sensor.afvalwijzer_plastic_blik_drinkpakken

But you also don’t have a sensor for ‘restafval’ then?

No, where I live there are residual waste container points at the end of the street, so you can throw your residual waste in there whenever you want.

My provider are HVC.

I’m not getting any sensors. In the logs I see that the API call is returning no data, and indeed when I pull the url and inspect in the browser it’s generating an error: No afval data. At first I thought I must have a waste provider here in Amsterdam that’s not listed at mijnafvalwijzer.nl but I get the same results with the other alternatives, afvalstoffendienstkalender and rova. But in each case, when I go to the web interface of all of those sites and tried to enter my own address it claims it’s unknown. Tried neighbor’s too. Then tried to enter ANY valid postcode and street number from clicking around google maps, the systems all return that the address is unknown, despite recognizing street name from the postcode. Seems like something major is broken in whatever api is being used to resolve location by house number? Or am I being stupid and these systems are not resolving my address because I’m using the wrong provider for Bos en Lommer in Amsterdam? Can anyone get a valid result from https://www.mijnafvalwijzer.nl/ ?