Garbage pickup date (mijnafvalwijzer.nl) custom_component


#66

Oké, the lay-out seems oké, but now i ran into the next issue. The data is only refreshing after restart. Do i need to trigger a refresh?


#67

Hmm, that must be a bug… I have the same issue. I`ll verify what the problem is. Thanks!


#68

Hi i’ve fixed the error. It was in the action field. I don’t know where. I replaced the action for my own notify and it works.
I think the errors are in the data_template:
message: >-
{% if (now().strftime("%Y-%m-%d")) == (as_timestamp(strptime(states.sensor.trash_gft.state, “%Y-%m-%d”)) - (1 * 86400 )) | timestamp_custom("%Y-%m-%d") %}.

After removed that it works…


#69

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


#70

Hi, is there any progress on this bug?


#71

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


Date formatting
#73

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


#74

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

#75

Have a look at Bin / Waste Collection


#76

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


#77

Because I thought it might help…:thinking:


#78

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.


#79

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.


#80

Edit line 121 mijnafvalwijzer.py

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


#81

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.


#82

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


#83

Here you go, added trash_today and trash_tomorrow sensors:


#84

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


#85

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


#86

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/).