not sure, wha would that take? never really worked with NR, only installed the add-in…
Hi Marius,
That is the problem I struggled with all the time…no good array to parse resulting in only a list of all pickup days in the current year.
I’ll check it again if I can create a more solid solution.
Cheers
cool, thanks!
please have a look why the "today’ automation doesnt work either. Its nice to be warned the day before, but id love to have the warning on the day itself too.
Ive just noticed (in my json-sensor) that they switch very quickly showing the next pickup day, while it is still ‘today’. might make it a bit difficult, if the pickupday=today condition is never met ;-((
Anyways, thanks for the component. I like it a lot!
-
platform: scrape
resource: http://www.mijnafvalwijzer.nl/nl/postalcode/housenumber/
name: Afval Datum
select: “.firstDate”
scan_interval: 60 -
platform: scrape
resource: http://www.mijnafvalwijzer.nl/nl/postalcode/housenumber/
name: Afval Soort
select: “.firstWasteType”
scan_interval: 60
Is also working, but it only shows what trash is going to be picked up Today.
well thats nice, and maybe an automation can be built on the other notification:
if tomorrow is a pickup day, show this scrape tomorrow…? something like that?
Seems a bit wird these scrape sensors, not as ‘programmable’ as the regular api sensors. But maybe there’s no other way…
btw, i think there’s also a Nextday? maybe thats scalable too? That way we would have both. Current and next.
thats very nice! How can we use that in Hassio? Don’t think i’ve ran a bash script before in the setup.
btw, might i ask if you have any experience with the techniques used in this Epson cartridge level program. I have it working up to the actual ink-levels, but down think i use the correct ‘scraping’ technique.
Maybe you can guide meow to proceed, thx!
Would you mind to share youre complete (working) code for this garbage collection . I’m fighting for several days
now but i’m not able to get this working. What I want is to trigger at let say 8:00PM and if there is a garbage pickup scheduled in the google calendar within the next 24 hours and then select , based on the message parameter (GFT, PLASTIC, RESTAFVAL), a correct message and picture to send a notify with telegram.
Thanks in advance.
@proton999
In order to keep this thread clean, I’ve created a new thread, See my solution here: https://community.home-assistant.io/t/another-way-of-garbage-pickup-notifications
hi,
its a bit off, have a look:
today is Restafval, not Papier…
maybe theres a typo in your sensor value, it’s showing the . after restafval?
made a customization for this:
sensor.afval_soort:
templates:
entity_picture: >
if (entity.state = 'Papier') return '/local/mijnafvalwijzer/papier.png';
else if (entity.state = 'Gft' ) return '/local/mijnafvalwijzer/gft.png';
else if (entity.state = 'Plastic verpakkingsafval') return '/local/mijnafvalwijzer/plastic.png';
else if (entity.state = 'Restafval') return '/local/mijnafvalwijzer/restafval.png';
else return '/local/mijnafvalwijzer/kliko.png';
cool.
Cheers,
Marius
Nice work!
As Marius stated, to keep this post clean, I’ve uploaded all code to Github:
I also made some modifications/improvements to the custom component.
- Now less sensors are needed
- The loop for parsing json from mijnafvalwijzer has been improved, no more nasty break!
- Dynamicaly built the Python TRASH_TYPES dictionary. No more static content.
Next steps:
- Add fault handling
nice, will install after reading this
as you can see in the screenshot above, the sensor Afval soort (showing papier) doesnt correspond with the AfvalDatum sensor (3 april in his case, where Gft will be picked up)…
might have to add some logic to the sensor, cause as i can see the full page, it is quite difficult to parse and scrape like this without getting the incorrect results…
Anyways, Cheers!
Marius
You could add this, that should help you resolve the issue you have:
- platform: template
sensors:
afval_vandaag:
friendly_name: “Afval vandaag”
value_template: >-
{% if is_state(‘sensor.afval_datum’, ‘vandaag’) %}
{{states.sensor.afval_soort.state}}
{% else %}
Geen
{% endif %}
will do, thanks!
unfortunately this is not working as hoped for:
the state is correct: Geen. still the value_template results in Papier, which is indeed the next pickup…sensor afval_datum is 3 april, not Vandaag so the template should point to the ‘else’ bit, resulting in Geen Don’t know why this doesnt happen (yet)
I noticed mijnafvalwijzer swtiches between the trash pickup today and the next pickup date using the same classname. Therefor the sensor probably isn’t reliable using the scrape platform.
ive found my customizing to be incorrect, this seems to be more to the point:
sensor.afval_soort:
templates:
entity_picture: >
if (state === 'Papier') return '/local/mijnafvalwijzer/papier.png';
else if (state === 'Groente, Fruit en Tuinafval' ) return '/local/mijnafvalwijzer/gft.png';
else if (state === 'Plastic verpakkingsafval') return '/local/mijnafvalwijzer/plastic.png';
else if (state === 'Restafval') return '/local/mijnafvalwijzer/restafval.png';
else return '/local/mijnafvalwijzer/kliko.png';
sensor.afval_vandaag:
templates:
entity_picture: >
if (state === 'Papier') return '/local/mijnafvalwijzer/papier.png';
else if (state === 'Groente, Fruit en Tuinafval' ) return '/local/mijnafvalwijzer/gft.png';
else if (state === 'Plastic verpakkingsafval') return '/local/mijnafvalwijzer/plastic.png';
else if (state === 'Restafval') return '/local/mijnafvalwijzer/restafval.png';
else return '/local/mijnafvalwijzer/kliko.png';
works for today
installed the latest version, which took some adjusting in the templating…
still, works out beautifully.
took out the double Afval Soort and Afval Vandaag, since they both pointed to the same, and Vandaag uses Soort as a value_template anyhow.
maybe you’re interested in the extra automation for an extra notification on the pick-up-day itself:
- alias: 'Afval vandaag'
trigger:
- platform: time
hours: 7
minutes: 0
seconds: 0
condition:
- condition: template
value_template: '{{ states.sensor.afval_datum.state == "vandaag" }}'
action:
- service: notify.notify
data_template:
message: 'Het is vandaag {{ now().strftime("%Y-%m-%d") }}.
Zet het {{states.sensor.afval_soort.state}} aan de straat!'
- service: persistent_notification.create
data_template:
title: 'Afvalmelding: {{states.sensor.afval_soort.state}}'
message: 'Het is vandaag {{ now().strftime("%Y-%m-%d") }}.
Zet het {{states.sensor.afval_soort.state}} aan de straat!'
shows:
hope this works too…
- alias: 'Afval morgen'
trigger:
- platform: time
hours: 20
minutes: 0
seconds: 0
condition:
- condition: template
value_template: '{{ now().strftime("%Y-%m-%d") ==
(as_timestamp(states.sensor.afval_soort.state) -
(24*3600)) | timestamp_custom("%Y-%m-%d") }}'
action:
- service: notify.notify
data_template:
message: 'Het is vandaag {{ now().strftime("%Y-%m-%d") }}.
{{states.sensor.afval_soort.state}} wordt morgen opgehaald!'
- service: persistent_notification.create
data:
message :
'Het is vandaag {{ now().strftime("%Y-%m-%d") }}.
{{states.sensor.afval_soort.state}} wordt morgen opgehaald!'
title: 'Morgen {{states.sensor.afval_soort.state}}'
if desired, one could further change the date of course, leaving out the year, as i’ve done in the group.
Anyways, lots of things to play with, maybe combine into one templated automation. Thanks to your efforts!
Cheers,
Marius
Great work, using a lot of your package! The only thing I’m missing are good entity_pics. Any change of you uploading them?
thanks!
sure:
cheers,
Marius
Holy pictogram Batman, you’re fast
Quick question: any idea why
trash_gft_date:
friendly_name: 'Gft'
value_template: '{{ as_timestamp(states.sensor.trash_gft.state) | timestamp_custom("%Y-%m-%d") }}'
Is returning None? sensor.trash_gft exists, with date, and …gft_date has friendly name Gft and the correct picure. Already trying a few hours, but untill now no luck…