Garbage pickup date (mijnafvalwijzer.nl) custom_component

@xirixiz @Mariusthvdb the names of ‘plastic, metalen en drankkartons’ and ‘papier en karton’ are too long for my custom view. Is it possible to shorten those names?

Sure, as you can template anything you want :wink:

That’s what I did if you check my glance setup

Good news! I just released version 4.0.0 of the component! See the release changelog for breaking changes and new features added.

Two final steps remaining:

  • Add the component as an official component to HASS
  • Add intergration configuration, so config is generated automatically
  • Add async stuff… however not enough Python knowledge to get to know what te benefit is…yet
2 Likes

@xirixiz Just updated to the new version 4.0.0
Changed the sensor component to english version
Everything is working, but i’m missing now the sensor.trash_firstwastetype and trash_firstdate
image
This doesn’t came after the restart.

@Mariusthvdb this noob cant figure it out :stuck_out_tongue:

I made my own view, because glance doesn’t support the styling i want. I changed the sensors friendly_name to “Plastic”, but this doesn’t change anything:
image

      - card: null
        elements:
          - entity: sensor.trash_today
            style:
              background-color: 'rgba(0, 0, 0, 0.7)'
              bottom: 0
              color: 'rgba(255,255,255,0.8)'
              font-size: 10px
              left: 0
              line-height: 8px
              padding: 0px 0px
              pointer-events: none
              transform: initial
              width: 100%
            type: state-label
        entity: sensor.trash_today
        name: Vandaag
        state_image:
          Geen: /local/images/afvalwijzer/kliko.png
          gft: /local/images/afvalwijzer/gft.png
          papier en karton: /local/images/afvalwijzer/papier.png
          'plastic, metalen en drankkartons': /local/images/afvalwijzer/plastic.png
          restafval: /local/images/afvalwijzer/restafval.png
        type: picture-elements

A missed that one, never used it :). Im releasing 4.0.1 soon with some minor adjustments, Ill add trash_firstwastetype.

1 Like

HI @xirixiz,
excited to go and try the new version. Thanks for keeping developing this!
is the option for ‘day after tomorrow’ available in the new version?

I added it manually in the original package, maybe you can do so in the new package too?

If you share the code, that’ll help :).

Thanks for the update. Small problem:

Log Details (ERROR)
Tue Jan 28 2020 23:17:46 GMT+0100 (Central European Standard Time)
Platform error sensor.afvalwijzer - No module named 'Afvaldienst'
Platform error sensor.afvalwijzer - No module named 'Afvaldienst'

config.yaml:

  - platform: afvalwijzer # Required
    provider: mijnafvalwijzer # Optional - mijnafvalwijzer (default) or afvalstoffendienstkalender
    zipcode: postalcode # Required
    housenumber: NR # Required

sure, this is what I added in the cc sensor.py:

    allTrashNames = ['firstdate', 'firstwastetype', 'today', 'tomorrow', 'dat', 'next']
        today = datetime.today().strftime('%Y-%m-%d')
        dateConvert = datetime.strptime(today, '%Y-%m-%d') + timedelta(days=1)
        dateConvertDat = datetime.strptime(today, '%Y-%m-%d') + timedelta(days=2)
        tomorrow = datetime.strftime(dateConvert, '%Y-%m-%d')
        dat = datetime.strftime(dateConvertDat, '%Y-%m-%d')

        trashType = {}
        trashNext = {}
        trashToday = {}
        trashTomorrow = {}
        trashDat = {}
        multiTrashToday = []
        multiTrashTomorrow = []
        multiTrashDat = []
        trashSchedule = []

and

                    if item['date'] == dat:
                        trashType[name] = "dat"
                        trashDat['key'] = "dat"
                        trashSchedule.append(trashDat)
                        multiTrashDat.append(item['nameType'])
                        if len(multiTrashDat) != 0:
                            trashDat['value'] = ', '.join(multiTrashDat)

and trash_firstdate too please? really need that for the templates and automatons…

2 Likes

Using hassio or something? You need to pip install afvaldienst then (install Python library). With HASS (in Docker) this is done automatically by HASS.

Yes, running Hassio on a Odroid C2.

I don’t think I am able to do a pip install. Not sure, never had to need to do so…

@xirixiz ran the update, and updated the sensor, but it’s not updating the sensors anymore.

Do you have any idea?

sensor:
  - platform: afvalwijzer
    provider: mijnafvalwijzer
    zipcode: '6904XX'
    housenumber: '1'
    default_label: 'Geen'

Edit: an extra reboot solved it, but im getting a new error since the update. Cant figure out if it has to do anything with this update:

image

Will do. The library has been updated to 0.5.0 already, I only need to add it to the hass component :+1:t2:

Will do that Today or Tomorrow

1 Like

@xirixiz after my reboot yesterday the sensor updated, but todat it didnt automatically update anymore…

I noticed that too indeed. I just realeased a new version (4.1.0) Today.

  • Update of the sensors fixed
  • Added day after tomorrow sensor
  • Added first next pickup date sensor
1 Like

This looks like antother issue, not related to the custom_component.

1 Like

How do you make this?
i am new to this component so have to learn much!

I have version 4.1.1 installed via HACS. Should I see sensor.trash_pmd?
Are the sensors depending on you’re zipcode?