Garbage pickup date (mijnafvalwijzer.nl) custom_component

Nice lovelace config Sjorsjes! I copied it right away :stuck_out_tongue:

Ik gebruik nu icons van een andere gemeente trouwens. Die kwam ik toevallig tegen.

https://www.google.nl/search?biw=1920&bih=898&tbs=ift%3Apng&tbm=isch&sa=1&ei=iSARXKKoB8jIwQLD8YnwBw&q=mijnafvalwijzer+doetinchem+sweelincklaan&oq=mijnafvalwijzer+doetinchem+sweelincklaan&gs_l=img.3...8183.16515..16755...4.0..0.206.1178.16j0j1......0....1..gws-wiz-img.hLto1XIM-GQ
1 Like

Hi all,

This is my first post in this forum \o/
I love this component and after some hours I got is (almost) to workā€¦ Thanks for the great job done hereā€¦

The firtst problem is that my municipale does not give a name to the paper collection the sensor is just called trash_

A piece of the json I get:

"ophaaldagen":{"response":"OK","data":[{"nameType":"","type":"papier","date":"2018-01-06"},{"nameType":"gft","type":"gft","date":"2018-01-08"},{"nameType":"plastic, blik en drankenkartons","type":"pmd","date":"2018-01-09"},{"nameType":"fijn huishoudelijk restafval","type":"restafval","date":"2018-01-15"},{"nameType":"gft","type":"gft","date":"2018-01-22"},{"nameType":"plastic, blik en drankenkartons","type":"pmd","date":"2018-01-23"},{"nameType":"","type":"papier","date":"2018-01-29"},{"nameType":"gft","type":"gft","date":"2018-02-05"},{"nameType":"plastic, blik en drankenkartons","type":"pmd","date":"2018-02-06"},{"nameType":"fijn huishoudelijk restafval","type":"restafval","date":"2018-02-12"},{"nameType":"gft","type":"gft","date":"2018-02-19"},{"nameType":"plastic, blik en drankenkartons","type":"pmd","date":"2018-02-20"},{"nameType":"","type":"papier","date":"2018-02-26"},{"nameType":"gft","type":"gft","date":"2018-03-05"},{"nameType":"plastic, blik en drankenkartons","type":"pmd","date":"2018-03-06"},{"nameType":"fijn huishoudelijk restafval","type":"restafval","date":"2018-03-12"},

I just use this sensor trash_, should not be a problem I think?

The real problems I have are

  1. I can not get my output to show custom icons.

I places a set in /www/mijnafvalwijzer/ and I can show them in my browser with: http://ip:8123/local/mijnafvalwijzer/gft.png

In customize.yaml I created entries like:

  sensor.trash_gft:
    friendly_name: 'GFT'
    templates:
      entity_picture: >
        if (state === 'gft') return "/local/mijnafvalwijzer/gft.png";
        return null;
      _stateDisplay: >
        if (state === 'gft') return 'GFT';
        return null;

All I get is:
afvalophalen1

  1. I like to have the date in Dutch format. I searched for line 121 (stated in a previous post), but could not find it.

Any clues?

Thanks!
Kees

`

Hi Kees,

Welcome! Have a look at my HASS github repo, you should be able to find out how to set up a nice looking interface that suits your needs. Also you can find custom images for mijnafvalwijzer. If you need more help, please let me know. My interface currently looks like this (thanks to Sjorsjes):

https://github.com/xirixiz/home-assistant

Iā€™ll look into the trash_ matterā€¦


Awsome, it all worksā€¦

Tnx a lot!

Cheers,
Kees

Nice indeed, changed the setup a bit to keep them all together: a vertical stack with a nested horizontal stack.
btw 1 anomalyā€¦:
large icon for plastic is so wrong!.. spot the error, and difference with my other original:

plastic (and I dont refer to the resolution )

14

  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          - type: picture-entity
            entity: sensor.trash_today
            name: Vandaag
            state_image:
              'gft': /local/mijnafvalwijzer/gft3.png
              'papier': /local/mijnafvalwijzer/papier3.png
              'restafval': /local/mijnafvalwijzer/rest3.png
              'plastic verpakkingsafval': /local/mijnafvalwijzer/plastic3.png
              'Geen': /local/mijnafvalwijzer/kliko3.png

          - type: picture-entity
            entity: sensor.trash_tomorrow
            name: Morgen
            state_image:
              'gft': /local/mijnafvalwijzer/gft3.png
              'papier': /local/mijnafvalwijzer/papier3.png
              'restafval': /local/mijnafvalwijzer/rest3.png
              'plastic verpakkingsafval': /local/mijnafvalwijzer/plastic3.png
              'Geen': /local/mijnafvalwijzer/kliko3.png

      - type: custom:useful-markdown-card
        content: >
         Vandaag is het <font color='green'>[[ sensor.vandaag.state ]]</font>.

      - type: glance
        entities:
         - entity: sensor.gft_formatted
           name: GFT
         - entity: sensor.papier_formatted
           name: Papier
         - entity: sensor.plastic_verpakkingsafval_formatted
           name: Plastic
         - entity: sensor.restafval_formatted
           name: Restafval

Enlighten us? The large one is correct (PlasticBlikMelkpakken)ā€¦

Is there a way to het the date translated? Is there a route to localisation in HA?
I am going to deploy the stacks more, just used it for the first time yesterdayā€¦

Cheers,
Kees

well, this illustrates the fact ā€˜expertsā€™ donā€™t agree how garbage should ultimately be disposed of and collectedā€¦
The modern waste-factories can separate waste much better and more precise, than we do manually at this moment.

But, in our neighborhood we have to collect Plastic, separate of everything else, and ā€˜blikā€™ should be disposed of together with the small and final waste fraction of Restā€¦

It is all about politicsā€¦ Oosterhout and Breda both transport their waste to the factory at Moerdijk. Breda collects plastic while Oosterhout PBM including metal coated plastics. We can even leave foodleftovers in plastic. It al depends on the contract each municipale signed and what the local policies areā€¦

Thanks for pointing it out! Now I see what I did wrong.

1 Like

Localization is done by setting the language of your interface.
The date format can be adjusted by adding the ā€˜datumformaatā€™ attribute to the sensor settings.

sensor:
  - platform: mijnafvalwijzer
    postcode: !secret afvalwijzer_postcode
    huisnummer: !secret afvalwijzer_huisnummer
    toevoeging: !secret afvalwijzer_toevoeging
    datumformaat: '%d %b'

see http://strftime.org/ for possible formats.

HI @xirixiz

please check the release page, the 1.1.6 isnā€™t listed, so updater wonā€™t updateā€¦

30

Fixedā€¦thanks!

cool.
doesnā€™t help though, updater still lists the same for your componentā€¦which is in fact not yet updated.

image

Hi @xirixiz, thanks for implementing the multiple waste types. Butā€¦ the feature request is giving me a UI problem. Is there a way to show two images in case there are two garbage types in one day? The other option is to create an image for every possible combination. But thats just not the way i want to go.

Besides that it would be nice to be able to ignore some waste types for the today and tomorrow sensor. i.e. grofvuil is only picked up after making an appointment. So i like that for my automations but not for the today and tomorrow sensor. Is that something for a feature request on Github?

hey @xirixiz

would you please update the correct version info in your GitHub repo? Updater says 1.1.6 is available but isnā€™t successful in updating.
Checking your repo the files are still on 1.1.5?

15

Hi Mariusā€¦fixed :smiley:

1 Like

Hmm, that would be nice indeedā€¦I`ll look into it.

1 Like

hi @xirixiz

trying to find a way to count the days left for the next collection date (see Bin / Waste Collection)

the other component uses:

import datetime
import bin_collection_dates
from datetime import *

    today = date.today()
    future = bin_collection_dates.next_collection
    diff = future - today
    days_left = str(diff.days)
    print(days_left)

which is of no use (yet), but might be when adapted somehow?

maybe you can help? Right now im using the extra scrape sensor for afval_datum, but that doesnā€™t return a timestamp, but a string.

  - platform: scrape
    resource: !secret scrape_resource_date
    name: Afval Datum
    select: ".firstDate"
    scan_interval: 60

Would you know a way to get the timestamp for the next collect date?

Hello,

Yesterday I installed this custom_component. :slight_smile:

The issue I have is the first pick up date showed up is in the new year, but today gft is picked up and next week pmd.

The days showed are right but I missed these 2.

saw something related today: this day was GFT at first, but later this had disappearedā€¦no more dates in 2018 left.

maybe Mijnafvalwijzer have edited their page to 2019, and 2018 dates are gone?