Garbage pickup date (mijnafvalwijzer.nl) custom_component

I just had the same issue. I think you copied the previous version as well. Make sure the local location is as defined in: https://github.com/xirixiz/home-assistant-config/blob/master/custom_updater.json (seems this changed during the discussions above :slight_smile: )

1 Like

That’s correct indeed.

The location of sensors changed from:

  • /custom_components/sensors/mijnafvalwijzer.py

to:

  • /custom_components/mijnafvalwijzer/sensor.py

Soon this will be the default config for custom sensors in hass.

1 Like

since not everyone is on the latest HA version yet (0.84.3 here with still most of the custom-ui goodies that are deprecated upwards…), would it be possible for you to create a custom_updater_old.json so we can point the updater to that and make it backwards compatible?

No, sometimes breaking changes are just inevitable.
Making it comfortable for people only results in a lot of maintenance and people not upgrading to the latest version :slight_smile:

Hi @xirixiz ,

I just found out about your component and saw a lot of similarities between mijnafvalwijzer.nl and
afvalstoffendienstkalender.nl which is used for Den Bosch, Vught, Oisterwijk, Haaren and Heusden.

So I quick and dirty replaced mijnafvalwijzer.nl with afvalstoffendienstkalender.nl and it’s working for this site as well. Perhaps an idea to make the url configurable as well in the configuration.yaml?

Since I’m not very well known in the python language yet, I’m not able to make a pull request at this moment. But perhaps for the future.

Good job! I`ll make the url configurable and release it later Today.

…just drafted a new release…

- platform: afvalwijzer
  url: 'mijnafvalwijzer.nl or afvalstoffendienstkalender.nl'
  postcode: '1111AA'
  huisnummer: '1'
  toevoeging: 'A'
  label_geen: 'Geen'

Notice the breaking change everyone! The component has been renamed from mijnafvalwijzer to afvalwijzer.

Hmz, I now got an error on it. But not sure if it’s the component or the update to 0.89. Also my honeywell lyric custom component was broken.

edit: my bad, had a dummy value in my postalcode… doh! So it’s working. Great work, thanks!

Hmm, been away couple of weeks and updated everything today.
I think it’s broken over here again.
Used the new folder layout and config.

Error:
2019-03-08 13:31:35 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform afvalwijzer
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/afvalwijzer/sensor.py”, line 82, in setup_platform
json_obj = response.json()
File “/srv/homeassistant/lib/python3.6/site-packages/requests/models.py”, line 897, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/local/lib/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/local/lib/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/local/lib/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Yes, I had to rewrite it back to the json url as the scraper didn’t work anymore. Scraping is very sensitive and I didn’t want to rewrite a lot of code again. Also now more gemeentes can use this component. It’s to bad that the json url for your postal code and housenumber isn’t working, it’s a problem from mijnafvalwijzer as we know.

Maybe the scraping component version still works for you, you could try that ofcourse.

I can’t get the component to work after a reinstall

  File "/home/homeassistant/.homeassistant/custom_components/afvalwijzer/sensor.py", line 73
url = (f"https://json.{url}/?method=postcodecheck&postcode={postcode}&street=&huisnummer={huisnummer}&toevoeging={toevoeging}&platform=phone&langs=nl&")

Here is a modified version of the component. It works on Debian stable with the current python version 3.5.

I have the same issue.

  File "/home/homeassistant/.homeassistant/custom_components/afvalwijzer/sensor.py", line 73
url = (f"https://json.{url}/?method=postcodecheck&postcode={postcode}&street=&huisnummer={huisnummer}&toevoeging={toevoeging}&platform=phone&langs=nl&")
                                                                                                                                                      ^

Ill modify the component not to use f-strings. Ill draft a new release this week.

@jeweet Thanks! I used your version to draft version 3.0.6.

@xirixiz I love your component, my Google Home alerts me to take out the trash, haven’t missed a day yet. Thanks!

Could you perhaps provide installation instructions in the README on your Github? I’m just not sure what folders to create under custom_component etc. I think other users might benefit from a brief explanation as well :blush:

Thanks for the kind words Emphyrio!

On Github there’s a brief instruction available on how to configure the custom_component.

However, instructions for using custom_components is something for the HASS docu itself and can be found here:

I’ll add the link to the readme on Github.

HI @xirixiz
maybe I missed it, but is this https://github.com/home-assistant/home-assistant/pull/23163 in any way related to your CC?

Hope this won’t interfere with the fine results we get with the CC, when I see there’s only a few monitored conditions being tracked in that PR…?

Ive linked this thread in the PR

Hi everyone, just wanted to share how my setup looks. I just went down the route of scraping a Google Calendar I made myself and used code already provided here. If anyone wants the images I use for the wheelie bins, let me know and I’ll attach them.

garbagepickup

1 Like

Since the upgrade to 0.92.x this one stopped working on my side. Anyone else with this problem?

Same for me