Custom component Afvalbeheer - Support for multiple waste collectors

yes only one. It is really rare to get 2 pickups a day

every 2 weeks here 2 pick-ups
restafval + papier
restafval + pmd
restafval + plastic

2 Likes

i have just the same every 2 weeks gft and pmd?

Hey @Pippyn,

Thank you so much for the great work. I tried to set up all. But got the following message:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 471, in async_device_update
    await self.hass.async_add_executor_job(self.update)  # type: ignore
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/afvalbeheer/sensor.py", line 1367, in update
    collection = self.data.collections.get_first_upcoming_by_type(self.waste_type)
  File "/config/custom_components/afvalbeheer/sensor.py", line 443, in collections
    return self.collector.collections
AttributeError: 'NoneType' object has no attribute 'collections'

My sensor Yaml:

- platform: afvalbeheer
  wastecollector: Twente Milieu
  resources:
    - restafval
    - gft
    - papier
    - pmd
  postcode: 0000XX
  streetnumber: 00               
  upcomingsensor: 0
  dateformat: '%d-%m-%Y'
  dateonly: 0
  dateobject: 0
  name: ''
  nameprefix: 1
  builtinicons: 0
  disableicons: 0
  dutch: 0

Can you help me figure out what is wrong?

Can you DM me an address that is in your neighbourhood? So I can do some tests?

1 Like

Same here. I have GFT & Papier en Karton the same day, only GFT in the sensor :frowning:

I have the same situation here but the below config results in 5 sensors with the 5 states
sensor.recycleapp_vandaag > geen
sensor.recycleapp_morgen > restafval, pmd
sensor.recycleapp_papier > 23-11-2020
sensor.recycleapp_pmd > Morgen, 16-11-2020
sensor.recycleapp_restafval > Morgen, 16-11-2020

  - platform: afvalbeheer
    wastecollector: RecycleApp
    resources:
      - restafval
      - papier
      - pmd
    postcode: 1234
    streetname: xxxxx
    streetnumber: xx
    upcomingsensor: 1
    dateformat: '%d-%m-%Y'
    dateonly: 0
    dateobject: 0
    dayofweek: 1
    alwaysshowday: 0
    name: ''
    nameprefix: 1
    builtinicons: 1
    disableicons: 0
    dutch: 1
#    printwastetypes: 1

According to me this is how I should expect it.

Another thing I saw is that in the recycle app I only have 1 collection on the “home” screen, but when I go to the calendar, I have the 2 collections that appear… Could be linked perhaps?

I have sent a message through the reycle app to the developers

I think my email worked :slight_smile:

Seems they fixed the bug in the recycleapp API

image

How do you add Nog 0 dag(en) to the card?

This looks nice
Tnx

card:
  show_header_toggle: false
  type: entities
filter:
  include:
    - attributes:
        Days-until: < 3
      entity_id: sensor.recycle*
      options:
        secondary_info: 'Nog [[ {entity}.attributes.Days-until ]] dag(en)'
        type: 'custom:secondaryinfo-entity-row'
show_empty: false
sort:
  method: state
  numeric: true
type: 'custom:auto-entities'

which gives then this:
image

Sorts the most upcoming event, and only the ones due in 3 days (but this you can change of course :slight_smile:)

3 Likes

Hi,

I just installed the code on my HA (Docker image) and get these errors in the log of HA

Logger: homeassistant
Source: custom_components/afvalbeheer/sensor.py:927
First occurred: 9:14:44 PM (1 occurrences)
Last logged: 9:14:44 PM

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/afvalbeheer/sensor.py", line 437, in async_update
    await self.collector.update()
  File "/config/custom_components/afvalbeheer/sensor.py", line 949, in update
    await self.hass.async_add_executor_job(self.__fetch_address)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/afvalbeheer/sensor.py", line 927, in __fetch_address
    response = requests.get(
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Is there anyone who knows what i’m doing wrong?

Please make a new issue at my github, with these errors, your config and an address in your neighbourhood.

1 Like

Hi Pippyn,

Firstly, a big thank you for developing and maintaining this component ! You truly make a difference to many households.

I would like to point out that RecycleApp.be seems to have additional waste fractions to what is currently reported by the component:

  • currently 5 fractions reported by parameter ‘printwastetypes: 1’ : gft, papier, pmd, restafval, takken
  • the website calendar (see screenshots) reports also: ‘grofvuil aan huis’

Would it please be possible to add fraction ‘grofvuil’ ?

Thanks in anticipation !!!

Thank you for your kind words!

I’ll have a look

“Grofvuil” is not included in the api sadly. So there’s no way of implementing it

Many thanks for checking !

BTW: I sent a message to RecycleApp.be asking them to include “grofvuil” into the API.
Fingers crossed.

Hi Pippyn,
On Github you mention Avri wastecollector is available, at the top of this thread Avri is not listed. I installed it anyhow and got a startup notice that gft, papier, pmd are the waste types available. Good!
Bu the only sensors created are as per screenshot which doesn’t seem right.

Do I need to check further or is Avri not supported?

What is your config? It looks like you included 1 resource named “restafval_gft_papier_pmd”, these should be all unique entries. Look at the github for more detail