Garbage pickup date (mijnafvalwijzer.nl) custom_component

Hi,

I have a feature request. Is it possible to order the sensors for each garbage type by date ascending? I’m aware that sensors now are shown i the order the are defined in the group. So i guess it’s not so easy…

(btw, how do i add this feature request to github? In the issue section?)

thanks in advance,

Rudolf

Hi, is there any progress on this bug?

Hi Rudolf,

You could use this version (without Today and Tomorrow sensors): https://github.com/xirixiz/home-assistant/blob/c3d0ad38fda1df01a0912381e697eb68b3621e52/custom_components/sensor/mijnafvalwijzer.py

That version is working as it should. Sorting isn’t possible within this component, since it depends on the group order, for example:

group:
trash_pickup:
name: “Trash Pickup”
control: hidden
entities:
- sensor.trash_gft
- sensor.trash_restafval
- sensor.trash_papier
- sensor.trash_pmd

So i created this custom components… looks great… but my date stamps are in english format. How can I change it to duch format ?

Placed the .py file in the right location and edited my platform sensors.

But i am still getting the following error:

Blockquote
Log Details (ERROR)
Thu Jul 05 2018 16:08:33 GMT+0200 (Central European Summer Time)

Error while setting up platform mijnafvalwijzer
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_platform.py”, line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/lib/python3.5/asyncio/tasks.py”, line 400, in wait_for
return fut.result()
File “/usr/lib/python3.5/asyncio/futures.py”, line 293, in result
raise self._exception
File “/usr/lib/python3.5/asyncio/tasks.py”, line 239, in _step
result = coro.send(None)
File “/usr/lib/python3.5/asyncio/coroutines.py”, line 210, in coro
res = func(*args, **kw)
File “/home/homeassistant/.homeassistant/custom_components/sensor/mijnafvalwijzer.py”, line 45, in async_setup_platform
json_obj = response.json()
File “/srv/homeassistant/lib/python3.5/site-packages/requests/models.py”, line 892, in json
return complexjson.loads(self.text, **kwargs)
File “/usr/lib/python3.5/json/init.py”, line 319, in loads
return _default_decoder.decode(s)
File “/usr/lib/python3.5/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib/python3.5/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)

Blockquote

  • platform: mijnafvalwijzer
    postcode: !secret afvalwijzer_postcode
    huisnummer: !secret afvalwijzer_huisnummer

Have a look at Bin / Waste Collection

why?
seems this mijnafvalwijzer.nl CC does the trick just fine and your link shows many quests yet to be solved… :wink:

Because I thought it might help…:thinking:

lol, sure, should have been a bit more elaborate in my question why… sorry.
What would be the added value of that way of handling waste management scripting for this Custom Component? Given the fact this is another website and data altogether.Unfortunately I must admit.

Well I think in many ways, maybe not specific to this exact component

But here goes:

-For others, who come here and can’t use it for their location.
-For people who can use it, but might get an idea from what’s been achieved in the other thread, eg the use of cURL, scraping and interacting with the waste site they are parsing
-Also there have been some innovative suggestions for the use of a waste component in the thread, eg the use of coloured LEDs to show the bin that needs to go out, automations etc.
-For people who want to take this component, edit it and adapt.
-A stretch but, potentially help the original developer branch out this to a universal component for more regions.
-The other thread links back to this one so people can see this thread also. I think this helps keep the topics connected from a category perspective.

… I could go on.

I started with this component but could not get it to work for my location. If at the time I had seen a link that was to another thread showing how I might be able to do it then that would have greatly helped.

Edit line 121 mijnafvalwijzer.py

Change it to
dateConvert = d.strftime("%d-%m-%Y")

Great news, I just released a new version! Finally scan interval (update) is working again!
The next release will contain today and tomorrow sensors with the type of trash to be picked up. Should be released this month.

https://github.com/xirixiz/home-assistant-config/blob/master/custom_components/sensor/mijnafvalwijzer.py

1 Like

nice!, though the previous version is working just fine, I will most certainly check to see the difference and progress you’ve made.

Have you ever given the ‘overmorgen’ (day after tomorrow) any thoughts?
In our location trash is always picked up on tuesdays and thursdays, and in the Saver app, vandaag and overmorgen are displayed by default (if on a tuesday).
Maybe its possible to have that in the sensor too? It is calculated (scraped) correctly:

0716

Here you go, added trash_today and trash_tomorrow sensors:
https://github.com/xirixiz/home-assistant/blob/master/custom_components/sensor/mijnafvalwijzer.py

Feature request. Config locally or on gcalendar the waste days … The Dutch site does not cover the world :wink:

I think I will modify your component to point at my server and serve a handmade Json.
Actually this could be a minimal mod. A switch to point either at the site or at a local json

A switch point is a good idea indeed! …I tried to parse local json, but I couldn’t get it working with the file sensor (https://www.home-assistant.io/components/sensor.file/).

Have it served from homeassistant itself
https://my-ip:8123/local/file.json

json file in local folder

Now we just need a switch :slight_smile:
:wink:

Could someone help with how to use this component?

  1. I’ve placed the script in: /config/custom_components/sensor/
  2. But the sensor is not displayed in the states.

What steps am I missing?

You have to add the sensor under your sensor attribute:

- platform: mijnafvalwijzer
  postcode: !secret afvalwijzer_postcode
  huisnummer: !secret afvalwijzer_huisnummer
  toevoeging: !secret afvalwijzer_toevoeging
1 Like