saw something related today: this day was GFT at first, but later this had disappeared…no more dates in 2018 left.
maybe Mijnafvalwijzer have edited their page to 2019, and 2018 dates are gone?
saw something related today: this day was GFT at first, but later this had disappeared…no more dates in 2018 left.
maybe Mijnafvalwijzer have edited their page to 2019, and 2018 dates are gone?
Hi Marius,
Did you update to version 1.1.6 (15/12/2018)?
After I did the update, the problem you describe was solved…
Regards,
Henry
Correct Henry. Version 1.1.6 also checks pickup dates for the upcoming year if no pickup dates are found in the current year.
I`ll look into this after christmass…
I just did a simple test, and I already managed to add this functionality
I`ll publish the new release tomorrow.
Yes, I am on 1.1.6
cool, Fijne Kerst natuurlijk!
if you have a chance, please do have a look how this is possible:
scrape sensor afval_datum sees the next date, but the component doesn’t apparently.
errors on the log:
Update for sensor.trash_tomorrow 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 114, 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 181, in update
trashType[name] = labelToday
TypeError: unhashable type: 'dict'
and
Update for sensor.trash_today 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 114, 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 181, in update
trashType[name] = labelToday
TypeError: unhashable type: 'dict'
Hi Marius,
I found out what the issue is causing the errors. When you browse to mijnafvalwijzer.nl with your postal code and housenumber, you probably can’t see pickup dates for 2019. When you for example browse this address:
https://www.mijnafvalwijzer.nl/nl/5146DG/16/, you’ll notice a tab with 2019 pickup dates. I`ll make a check if 2019 is available, if not then the pickup date will be set to none. I think I have some spare time Tonight.
Cool, take it easy;-)
FYI today (afval_vandaag) works alright, which is a template sensor, made out of 2 scrape sensors:
afval_vandaag:
friendly_name: 'Afval vandaag'
value_template: >-
{% if is_state('sensor.afval_datum', 'vandaag') %}
{{states('sensor.afval_soort')}}
{% else %}
Geen
{% endif %}
entity_picture_template: >
{% set mapper = {'Papier': '/local/mijnafvalwijzer/papier.png',
'Groente, Fruit en Tuinafval': '/local/mijnafvalwijzer/gft.png',
'Plastic verpakkingsafval': '/local/mijnafvalwijzer/plastic.png',
'Restafval': '/local/mijnafvalwijzer/restafval.png'} %}
{% set state = states('sensor.afval_vandaag') %}
{{ mapper[state] if state in mapper else '/local/mijnafvalwijzer/kliko.png' }}
- platform: scrape
resource: !secret scrape_resource_date
name: Afval Datum
select: ".firstDate"
scan_interval: 60
- platform: scrape
resource: !secret scrape_resource_type
name: Afval Soort
select: ".firstWasteType"
scan_interval: 60
which at least indicates the correct date is still in the 2018 database/page
but sensor.trash_today is unknown:
as is sensor.trash_tomorrow
I just released a new version (1.1.7) with the following chages:
That’s coorect since i don’t see any pickup dates in the future. I won’t add “0 days” until the next pick-up. I will make it Geen instead of Unknown if no future pickups are found. Somerhing for the next release…
Maybe you can make te text for ‘unknown’, maintainable in the settings? Or is it an option already?
cool.
I now see on the mijnafvalwijzer page (never go there since the component works so good…) there are no future dates listed in fact… which is silly of course.
maybe another error/bug: your component still list yesterdays date as pickup day for today: plastic. Even got a notification through my today pickup automation.
(that’s my own automation, you don’t use an automation for today, at 7 am? I don’t see it listed on the GitHub page for the component ?)
I’ve made 2 smaller and less complex automations you might want to try, evaluating either trash_today or trash_tomorrow for actioning:
- alias: 'Afval morgen alt'
initial_state: on
trigger:
platform: time
hours: 20
minutes: 0
seconds: 0
condition:
- condition: template
value_template: >
{{ is_state('input_boolean.notify_utility', 'on')}}
- condition: template
value_template: >
{{states('sensor.trash_tomorrow') != 'Geen'}}
action:
- service: notify.notify
data_template:
message: >
Het is vandaag {{ now().strftime("%d %B") }}.
{{states('sensor.trash_tomorrow')}} wordt morgen opgehaald!
- condition: template
value_template: >
{{ is_state('input_boolean.persistent_notification_create', 'on')}}
- service: persistent_notification.create
data_template:
message: >
Het is vandaag {{ now().strftime("%d %B") }}.
{{states('sensor.trash_tomorrow')}} wordt morgen opgehaald!
title: >
Trash tomorrow:
- alias: 'Afval vandaag alt'
initial_state: on
trigger:
platform: time
hours: 7
minutes: 0
seconds: 0
condition:
- condition: template
value_template: >
{{ is_state('input_boolean.notify_utility', 'on')}}
- condition: template
value_template: >
{{states('sensor.trash_today') != 'Geen'}}
action:
- service: notify.notify
data_template:
message: >
Het is vandaag {{ now().strftime("%d %B") }}.
{{states('sensor.trash_today')}} wordt vandaag opgehaald!
- condition: template
value_template: >
{{ is_state('input_boolean.persistent_notification_create', 'on')}}
- service: persistent_notification.create
data_template:
message: >
Het is vandaag {{ now().strftime("%d %B") }}.
{{states('sensor.trash_today')}} wordt vandaag opgehaald!'
title: >
Trash today:
btw. here’s a small customization for the new sensor (using custom-ui):
sensor.trash_days_to_next_pickup:
friendly_name: Days to next pickup
templates:
icon: >
if (state === 0) return 'mdi:numeric-0-circle-outline';
if (state === 1) return 'mdi:numeric-1-circle-outline';
if (state === 2) return 'mdi:numeric-2-circle-outline';
if (state === 3) return 'mdi:numeric-3-circle-outline';
if (state === 4) return 'mdi:numeric-4-circle-outline';
if (state === 5) return 'mdi:numeric-5-circle-outline';
if (state === 6) return 'mdi:numeric-6-circle-outline';
if (state === 7) return 'mdi:numeric-7-circle-outline';
if (state === 8) return 'mdi:numeric-8-circle-outline';
if (state === 9) return 'mdi:numeric-9-circle-outline';
if (state > 9) return 'mdi:numeric-9-plus-circle-outline';
return 'mdi:calendar-question';
So, today the city of Oosterhout notified us that they will no longer provide paper Afvalkalenders and pushes us to mijnafvalwijzer.nl. I have got this component running on the frontpage in fully kiosk browser on a tablet on the ground floor. After explaining to #wife that the info in this component comes from afvalwijzer.nl she is fully reassured after a bit of panic
I like to thank the authors and all those who contributed to this great component! It works great and does really add tot the WAF of HA
Hi Keeze, always nice to receive appreciation! Thanks!
HI, finally the new dates are known, and downloaded correctly, the days to next pickup seems confused though…:
I think I remember you said the sensor changed, and see next_in_days
in the CC, but I can’t find that either and there’s nothing else in the dev-state with thrash…
Crap, I forgot to adjust some code, I just drafted a new release. I know tested it before I released it
The sensor name now is:
[sensor.trash_next_in_days] - 4
Last weekend I did a rewrite of the current code making it more efficient and easier to append new features. I will test it myself the next week, and if everything looks fine I`ll release it. It has the same features as the current release btw (1.1.9).
I`d like to make the component modular so other garbage pickup sources can be added as well.
cool:
just a note: my customization with mdi:numeric-5-circle-outline isn’t working yet, as the icon probably isn’t imported in HA yet. changed it into
sensor.trash_next_in_days:
friendly_name: Days to next pickup
templates:
icon: >
if (state === '0') return 'mdi:numeric-0-box-multiple-outline';
if (state === '1') return 'mdi:numeric-1-box-multiple-outline';
if (state === '2') return 'mdi:numeric-2-box-multiple-outline';
if (state === '3') return 'mdi:numeric-3-box-multiple-outline';
if (state === '4') return 'mdi:numeric-4-box-multiple-outline';
if (state === '5') return 'mdi:numeric-5-box-multiple-outline';
if (state === '6') return 'mdi:numeric-6-box-multiple-outline';
if (state === '7') return 'mdi:numeric-7-box-multiple-outline';
if (state === '8') return 'mdi:numeric-8-box-multiple-outline';
if (state === '9') return 'mdi:numeric-9-box-multiple-outline';
if (state > '9') return 'mdi:nnumeric-9-plus-box-multiple-outline';
return 'mdi:calendar-question';
note the quotes around the number, the state isn’t a number but a string.
Hey @xirixiz, since a few days I am getting an error
Error while setting up platform mijnafvalwijzer
Traceback (most recent call last):
File "/usr/local/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 "/config/custom_components/sensor/mijnafvalwijzer.py", line 57, in setup_platform
json_obj = response.json()
File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.6/site-packages/simplejson/__init__.py", line 518, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.6/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.6/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)
I am using 84.6, and 1.19 of your plugin. Any ideas what could be wrong?
I’m also having the same error
No idea how to fix this.
@robertjanb @Fietspomp Do you perhaps have a postal code and housenumber for me, so I can reproduce the issue? I havn’t got the issue myself, but it seams no data is received from mijnafvalwijzer.nl (empty).