Custom component Afvalbeheer - Support for multiple waste collectors

https://github.com/custom-components/blueprint/blob/0a3a92db073d9bf7e1eb11bc00abd4778ec25889/custom_components/blueprint/.translations/sensor.nb.json

The key in the dict need to match the state, so "None": "Some translated string"

And the filename needs to be domain.langcode.json (sensor.nl.json)

Maybe this component is a good example: https://github.com/home-assistant/home-assistant/tree/dev/homeassistant/components/adguard

I think you need a file ‘strings.json’ and then corresponding translation-files, en.json, nl.json, etc.

But, after a quick look at the details, I’m not sure how the text in strings.json connects to the py-files…

Apparently, you need to follow this: https://developers.home-assistant.io/docs/en/internationalization_backend_localization.html
Look at the chapters States and Configuration Flow Localisation for details.

But, maybe you already got up to there?

Thank you @bouwew and @ludeeus. I’ll have a look!

Nice component, thank you Pippyn!
In my town we have collector Spaarnelanden. I can get a sensor for GFT right away, but not for “Duobak PBD/Papier”: https://afvalwijzer.spaarnelanden.nl/afvalstroom/1. What’s the resource name I should use for this fraction? I’ve tried different names from the github page and a number of my own guesses, but I gave up.
Would it be helpful to make an additional sensor that returns a list of the supported resources names for a collector?

What is your config? do you have an address for me to test with?

This is my config:

  - platform: afvalbeheer
    wastecollector: Spaarnelanden
    resources:
      - gft
      - duobak
    postcode: xxxxyy
    streetnumber: zzz
    upcomingsensor: 1
    dateformat: '%d %b'
#    dateonly: 0                      (optional)
#    name: ""                         (optional)
#    nameprefix: 1                    (optional)
    builtinicons: 1
    dutch: 1

A random address that has the same collector and fractions: 2014HJ, 314.
Thanks for looking into this!

I’ve found the issue. There is a bug in my code, the fraction is renamed to “Papier”. I will write a fix, but for now you can add “papier” as a resource.

Thank you Pippyn, this works for me!

Update to version 2.5.5 and change the fraction to “duobak”. And please let me know if it works for you.

1 Like

Is it possible that you create a changelog with breaking changes for the releases on Github? After the latest few patch-updates for this component, my UI and automations stopped showing or reporting on trash-days, because of name-changes in the component;
State ‘none’ changed to ‘geen’ a few versions ago, and now the names of my sensors changed as well. I’ve noticed that the release was titled: 'Support for name… ', but it did not mention that this would change the sensornames if I didn’t add that to the config.

Yes, this works - thanks once more!

Good point. I will do in the future! Sorry for the inconvenience.

1 Like

Hi there,
would it be possible to add the Avri?

https://www.avri.nl/inwoners/afval/afvalinzameling/afvalkalender-2019/

1 Like

that would be great, you can find the avri pick-up days on www.deafvalapp.nl.
Unfortunately I also do not know how I get this in home assistant.
Example zip code and house number: 6658GT 65

Followed all the steps, when adding the sensor:

- platform: afvalbeheer
    wastecollector: Circulus-Berkel  (required)
    resources:                       (at least 1 required)
      - restafval
      - gft
      - papier
      - pmd
    postcode: AAAA00                 (required)
    streetnumber: 5                  (required)
    upcomingsensor: 1                (optional)
    dateformat: '%d-%m-%Y'           (optional)
    dateonly: 0                      (optional)
    name: ''                         (optional)
    nameprefix: 1                    (optional)
    builtinicons: 0                  (optional)
    dutch: 0                         (optional)

I get this config error:
can not read a block mapping entry; a multiline key may not be an implicit key at line 165, column 13:
dateonly: 0 (optional)

Any idea?

indentation error. Use this;

- platform: afvalbeheer
  wastecollector: Circulus-Berkel
  resources:
      - restafval
      - gft
      - papier
      - pmd
  postcode: AAAA00
  streetnumber: 5
  upcomingsensor: 1
  dateformat: '%d-%m-%Y'
  dateonly: 0
  name: ''
  nameprefix: 1
  builtinicons: 0
  dutch: 0

:disappointed_relieved: does not help
after restart I get this:

Error loading /config/configuration.yaml: while parsing a block mapping
in “/config/sensors.yaml”, line 154, column 5
expected , but found ‘’
in “/config/sensors.yaml”, line 162, column 38

line 154= - platform: afvalbeheer
line 162= dateformat: ‘%d-%m-%Y’

Remove all the (), eg ```
(required)

I’m trying to use the ophaalkalender integration, but I don’t get any information in the sensor.
When I go to the ophaalkalender.be site, I also don’t get any info for my address… Does anyone know why it isn’t giving information for Antwerp? When I try the recycle app it finds the dates…

Hi, thanks for the rova component. But it does not work for me. A colleague of mine who is also experimenten with HA also tried the rova component, but he gets the same issue.

the issue:
image

Here is my log:

Log Details (ERROR)
Tue Jan 21 2020 21:05:05 GMT+0100 (Midden-Europese standaardtijd)
Update for sensor.rova_afvalkalender_gft fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/afvalbeheer/sensor.py", line 362, in update
    self.data.update()
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 240, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/afvalbeheer/sensor.py", line 260, in update
    response = requests.get(url).json()
  File "/usr/local/lib/python3.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.7/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.7/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)

This is my config in the sensors.yaml:

- platform: afvalbeheer
  wastecollector: Rova
  resources:
    - restafval
    - gft
    - pmd
  postcode: 8014kd #(a postal code in rova area)
  streetnumber: 48
  upcomingsensor: 1
  dateformat: '%d %b' 
  name: 'Afvalkalender'