Garbage pickup date (mijnafvalwijzer.nl) custom_component

Its working thanks!

so far, I have no issues whatsoever with version 206. Won’t it hurt to update…? Couldn’t it have been something else bugging the output?

Thanks :slight_smile: That fixed it for me

@xirixiz
HI,
minutes after posting my question above, my sensors where gone, apparently the change kicked in.
Updated to 2.07, and now get this for all sensors:

Update for sensor.trash_ fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/mijnafvalwijzer.py", line 137, in update
    for item in self.data.data:
TypeError: 'NoneType' object is not iterable

anything else we need to change in the setup to get it back working again?

Hi, for me it’s working fine. However some people are still experiencing issues. What I need is a postcal code and housenumber in your region so I can debug what causes the problem. Can you provide me that (pm otherwise).

thanks for having a look, Pm sent!

Same here

Update for sensor.trash_gft fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 349, 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/mijnafvalwijzer/sensor.py", line 137, in update
for item in self.data.data:
TypeError: 'NoneType' object is not iterable

I think I`m going to switch back to json anyway, scraping mijnafvalwijzer is way to messy. Fingers crossed mijnafvalwijzer won’t complain again about this component. If so, I’ll discontinue this component. Tomorrow evening I have all night to fix this! :smile:

that would be way cool, thanks!

btw, if Saver or Afvalwijzer complain again this service is only for paying customers, there are 2 points to be made:

  • we all pay for this service, and rather directly, by means of the municipal contracts that have been agreed on. Not as a general tax, but as a direct, service contract paying for the services delivered.
  • based on European GDPR law, AVG Dutch, they might have a hard time denying customers access to their own data…

anyways, hope you can fix the component :wink:

2 Likes

Version 3.0.0 has been released! :partying_face:

:smile::+1:

Thanks for the newest version!
Seems like there is a small mistake in v3.0.2: on line 213 you are referencing url instead of scraper_url, causing some errors.

must be doing something wrong, because I still have this:

log:

pdate for sensor.trash_papier fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/mijnafvalwijzer.py", line 126, in update
    self.data.update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/util/__init__.py", line 324, in wrapper
    result = method(*args, **kwargs)
  File "/config/custom_components/sensor/mijnafvalwijzer.py", line 213, in update
    logger.debug(f"Scraper request url: {url}")
NameError: name 'url' is not defined

See my previous post, if you change line 213 to use scraper_url instead of url for now, everything works as expected.

yes, thanks, thought it right to post the full log error…

so change in logger.debug(f"Scraper request url: {scraper_url}") ?

though I was led to believe the new version stopped the scraping, so why this logger.debug then?

Already noticed the issue indeed :slight_smile: but didn’t had time this morning to fix it.
I’m going to release 3.0.3.

Scraper is still used for your needs Marius…, but only for the firstDate and firstWasteType stuff as the values aren’t available via json :wink:

When I use your postal code and housenumber the component is working just fine, must have something to do with you config I suppose.

Its working now !
Made the change and all sensors popped up;-)
Thx for all your efforts!

Only need to fix Overmorgen…and Plastic, but that’s the name only

edit:

fixed:-)

I am using the mijnafvalwijzer-json-beta.py instead of the mijnafvalwijzer.py, because the latter one needs py modules which are not installed in my py virtual environment (bs4 for instance). But it reports errors all the time, and this is what get’s reported:

2019-02-23 17:45:08 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.trash_pmd fails
Traceback (most recent call last):
File “/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/home/homeassistant/.pyenv/versions/3.6.3/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/custom_components/sensor/mijnafvalwijzer.py”, line 144, in update
self._data.update()
File “/home/homeassistant/.pyenv/versions/3.6.3/envs/homeassistant-3.6.3/lib/python3.6/site-packages/homeassistant/util/init.py”, line 315, in wrapper
result = method(*args, **kwargs)
File “/home/homeassistant/.homeassistant/custom_components/sensor/mijnafvalwijzer.py”, line 205, in update
next_out = [x for x in self._trashSchedule if x[‘date’] > self._today]
File “/home/homeassistant/.homeassistant/custom_components/sensor/mijnafvalwijzer.py”, line 205, in
next_out = [x for x in self._trashSchedule if x[‘date’] > self._today]
TypeError: ‘>’ not supported between instances of ‘int’ and ‘str’

My homeassistant version is 0.86.3

@xirixiz not been able to check yet, but did you have a look at Garbage pickup date (mijnafvalwijzer.nl) custom_component already?

secondly, would you know of a way to have the dates show in Dutch…?