Custom component Afvalbeheer - Support for multiple waste collectors

Just install the one you want trough HACS. Find “Home Assistant Sensor Afvalbeheer” and install.

1 Like

i made an automation to give me a notification on my mobile.
However i’m not 100 % sure about the state

i’ve set condition to if state is 1 of sensor tomorrow…
but i dont think that will work, will have to wait and see what the state will be thursday

Also, i need different text as notificiation. If its pmd it should say pmd, if its restafval it should say restafval…
then second for speech the same

anyone have examples for the states of the tomorrow sensor?

edit: is there a way to have the included icons a color? (im using glance card)
Also when i set dateonly to 0, you have the days before the date, if i set it to 1 , you dont get the date but is it possible to add a third option?

I would like to have tomorrow or today without the date, but when its further away, i would be nice to have only the date…

Hi @Pippyn,

I recently hit again upon this topic and because of the Belgian Ophaalkalender now been integrated in the ‘main’ CC I thought of giving it another shot (my first attempt - in July '19 - was a total failure, which never got solved).

Alas … I am plagued by the exact same failure, nl. all sensors are created, but with state “unknown”. Not surprising at all, because the log shows :

Error occurred while fetching data: SSLError(MaxRetryError(‘HTTPSConnectionPool(host=‘www.ophaalkalender.be’, port=443): Max retries exceeded with url: /calendar/findstreets/?query=Dennenlaan&zipcode=2220 (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘ssl_choose_client_version’, ‘unsupported protocol’)])”)))’))

And to be honest : because of the nature of the error, and because the ‘offending’ url works perfectly fine in Chrome, I am pretty sure this has nothing to do with my particular config and have to conclude that the Ophaalkalender simply does not work, not when it was a separate CC, not now when it is integrated with the rest.

I hope the error message is informative enough to put you on the right track - to which I can only add that Chrome mentions in its certificate/security information that ‘This site uses an outdated security configuration’ for Ophaalkalender …

Thanks for looking into this - just tell if I can be of any assistance, ok ?

What is your config?

Here goes :

 - platform: afvalbeheer
   wastecollector: Ophaalkalender
   resources:
     - restafval
     - gft
     - glas
     - papier
     - pmd
   postcode: 2220
   streetnumber: 123015
   upcomingsensor: 1
   dateformat: '%d %b'

Which brings me to a question I faced whilst testing : with the old, independent Ophaalkalender CC a config parameter called ‘streetname’ was required, of which no longer any mention is in the integrated CC. So I tested without it - reassured by the fact that the correct streetname was retrieved and used in the url …

You will need to add streetname to the config if you’re using ophaalkalender.be (the readme is not up to date yet). Can you test it without the upcomingsensor and dateformat options? and just one resource?
Does that work?

I’m afraid not. Testing with just :

- platform: afvalbeheer
  wastecollector: Ophaalkalender
  resources:
    - gft
  postcode: 2220
  streetnumber: 123015
  streetname: Dennenlaan

results in exactly the same error.
Not unexpectedly, because if you ask me the problem and thus the solution lies in allowing for the older, less secure, ssl protocol Ophaalkalender seems to still be using.

I’m also a bit surprised there’s still the need for the ‘streetname’ config entry, because even without it your CC seems to find the streetname just fine, presumably based on just ‘streetnumber’ ? Does this maybe mean that one of the two parameters suffices ?

But since you are the only one where it’s not working (your config works just fine on my HA installations), it’s more likely that your ha setup has a fault.

After some digging I found it’s most likely your openssl python package that is at fault. Are you running a venv? can you make sure all your packages are up to date?

@Pippyn I am also from Belgium and will test this, will post back here once I get the results :smiley:

Update, using the following config it just works here, using hassio in a vm:

  • platform: afvalbeheer
    wastecollector: Ophaalkalender
    resources:
    • restafval
    • papier
    • pmd
      postcode: ****
      streetnumber: **
      streetname: ********
      upcomingsensor: 1
      dutch: 1

Thx for chiming in @Jdruwe, and more or less confirming @Pippyn’s assumption.
I’m all for accepting the blame being on my installation, but I have a hard time putting my finger on it because :

  • I’m a bit of a maniac in keeping a tight ship, meaning I keep both OS & HA rigorously up to date (running Hassbian on Pi, so HA in venv indeed)
  • so it’s a bit unlikely that my openssl subsystem has been faulty/not updated all this time (I encountered this problem already in July '19 with the ‘old’ CC)
  • what is also bothersome to me is that I never ever see the same error on any other part of HA, or any other ssl-related error for that matter …

Based upon your inputs I however start wondering whether the real culprit could be the reverse proxy I’m running (Caddy) - as I’m pretty sure this also has a say about ssl and related protocols …
Funny though, as this would be the first and only time it’s putting sand in the machine. Oh well, never say never, as I’m used to say …
What do you guys think ?

Yes caddy can be the culprit for sure. However on my HA instances I do use Caddy and the sensor is working fine.

That being said, I’m not a expert on reverse proxies/caddy and this topic is not the right place for this discussion. I would recommend opening a new topic and let the network experts help you further.

Hi @Pippyn, just wanted to reasssure you that I got it working. Being a bit stubborn, I dove in and finally found that weakening the openssl settings by allowing for tlsv1.0 (which is what the Ophaalkalender site is still using - shame on them) did the trick, as shown here :
afval
So now that I’ve got my sensors working (by the way : thx for the assistance) I seem to hit a little flaw, or at least something I’d like you to shed some light on. In the doc you say about the dateonly parameter ‘If you don’t want to add dayname, tomorrow or today in front of date activate this option. Default is 0.’
Well … in my config I have no dateonly parameter whatsoever, so I guess the default must apply, but I fail to see any ‘dayname’ or ‘tomorrow/today’ prefix with my sensors ?

dayname only works within a week. It has no use when the date is for example 2 months away.

When the date is monday 20-04 it always means next monday.

Glad you got it working

Hi all,
This morning I was testing to get this to work. I found out that Meerlanden is not valid anymore. But don’t know if it is available on Ximmio. I tried my zip code, but nothing came.
Then I tried some other postcodes in other places but also no result

sensor:

  • platform: dsmr
    port: /dev/ttyUSB0
    dsmr_version: 4
  • platform: afvalbeheer
    wastecollector: MijnAfvalwijzer
    resources:
    • restafval
    • gft
    • papier
    • pmd
      postcode: 9721TR
      streetnumber: 2
      upcomingsensor: 1
      dateformat: ‘%d-%m-%Y’
      dateonly: 0
      name: ‘’
      nameprefix: 1
      builtinicons: 0
      disableicons: 0
      dutch: 0

As you can see I have now used a different zip code and collector but that is not being updated either. I don’t see a date either.
So I think it’s up to me …
No Waste data found!

This is what i found in the log

15:55:18 – custom_components/afvalbeheer/sensor.py (ERROR) - bericht kwam voor het eerst om 15:09:54 en verschijnt 178 malen

Update fixed. I think the map /custom_components/afvalbeheer/ didn’t have the right rights :slight_smile:

I have the custom compoent ‘afvalbeheer’ working and I can see that the Wastecollector: circulus-berkel is collecting my PMD today. Only the [sensor.vandaag] shows: ‘unknown’ also the [sensor.morgen] shows always ‘unknown’. What could be wrong?

There is probably a fraction sensor also unknown, which causes the today and tomorrow sensors to malfunction.
I just released version 4.0.0, can you check if the error persists?

Hi Pippyn,

I performd the update and I got now:
[sensor.vandaag] state: ‘Geen’
[sensor.pmd] state: ‘unknown’ ; before the update the state was: ‘vandaag, 20 Apr’

Version 4.0.1 should fix this. Can you test please?
If this doesn’t fix the problem; can you DM me your config?

Hi, after the update, icons gone, and status Unkown

I did not change my configuration:

  - platform: afvalbeheer
    wastecollector: !secret wastecollector  
    resources:                       
          - papier
          - pmd
          - best
    postcode: !secret postcode                
    streetnumber: !secret streetnumber                 
    upcomingsensor: 1               
    dateformat: '%d-%m-%Y'            
    dateonly: 0                     
    name: ''                            
    nameprefix: 1                   
    builtinicons: 0                  
    dutch: 0                  

DM me the config without the !secrets please. Now I don’t even know which wastecollector you are using