Garbage pickup date (mijnafvalwijzer.nl) custom_component

Correct the only thing now possible is to really exclude the “todays pickup type”
Meaning you would only see 2 type in the next pick up days part.

Edit:
Alho we do have trash_first_next_date and sensor.trash_first_next_item
But that would be really hard putting it altogether in the auto sorting part :smiley:

the only thing now is the configuration option count_today: true but this doesn’t do what I seek.

Or really excluding the today’s date in the auto-sorting entity part in lovelace.

That would mean you would end up with missing the today's pickup type for one day completely.
That’s still an option but not a perfect one :wink:

yes that’s what I meant here:

and no, that isnt really an option since it would have to be conditional for having a todays’ pickup. And would require yet again an extra binary_sensor on which we could do that. Even so, if we had it, we wouldn’t have the next 4 dates for the various trash-types.

1 Like

@Mariusthvdb
With the help of a friend i got it finally the way i like it.
There are only 2 sensors that i cannot get working.

First 1 is: sensor.trash_next_icon
I think i should be using this for it but when i add it to sensors it gives me errors (invalid slug) and adding it to customize.yaml doesn’t do anything.

sensor.trash_next:
friendly_name: Days to next pickup
templates:
icon: >
if (state === ‘Geen’) return ‘mdi:calendar-question’;
if (state === ‘0’ || state === ‘1’ || state === ‘2’ || state === ‘3’ || state === ‘4’
|| state === ‘5’ || state === ‘6’ || state === ‘7’ || state === ‘8’ || state === ‘9’)
return ‘mdi:numeric-’ + state + ‘-box-multiple-outline’;
return ‘mdi:numeric-9-plus-box-multiple-outline’;

And the second missing sensor is: sensor.trash_color

I found some old post (“markdown-card-with-template-wont-format-correctly”) but cannot figure out how to fit this in my setup.

dont know what your setup looks like, so not sure where you need help.

both sensors you mention above are standalone, and not parts of the template sensor you quote. Ive also added the trash_next_color, to use that in the markdown (and custom-header tab icon :wink: )

      trash_next_icon:
        value_template: >
          {% set days = states('sensor.saver_trash_first_next_in_days') %}
          {% if days != 'Geen' %}
            {% if days <= '9'%} mdi:numeric-{{days}}-box-multiple-outline
            {% else %} mdi:numeric-9-plus-box-multiple-outline
            {% endif%}
          {% else %} mdi:checkbox-blank-outline
          {% endif %}

      trash_next_color:
        value_template: >
          {% set next = states('sensor.saver_trash_first_next_item') %}
          {% set mapper = {'papier':'#00b2ef',
                          'gft':'green',
                          'pbd':'orange',
                          'restafval':'black'} %}
          {% set color = mapper[next] if next in mapper else 'grey' %}
          {{color}}

      trash_color:
        value_template: >
          {% set vandaag = states('sensor.saver_trash_today') %}
          {% set mapper = {'papier':'#00b2ef',
                          'gft':'green',
                          'pbd':'orange',
                          'restafval':'black'} %}
          {% set color = mapper[vandaag] if vandaag in mapper else 'grey' %}
          {{color}}

Note I have prefixed all my senors with saver_ so if you dont use that, take it out of the templates.

Hi thanks for your help (again).
Most is based on your code posted 19 days ago but this should get me further in finalizing the details.

Not 100% sure but for the icon changing part I think you also need CustomUI installed on your HA system.
Correct me if I’m wrong @Mariusthvdb

sure, but that would be useful for changing the icon of another sensor to show in the frontend. You can see here how to do that.

My sensor above is a template sensor with a value_template for the icon. This sensor isn’t used in the frontend itself, it is used in the markdown card to show an icon here:

I do that in places where the config of the markdown card, or other style sections would become to complicated and error prone, let alone difficult to read. using the state of this sensor is hassle free.

update

to illustrate what is happening even better, please see below. We have a pickup today: Papier.
the next_pickup_in_days shows todays pickup ( 0 days) ,

resulting in todays pickup still being listed under ‘Next pickups’ (which of course is my own Title, but you get the idea):


while we should preferably see the 4 next pickup days, next to todays pickup:

Note: there is no help in changing to count_today: false here.

1 Like

I have a little problem with showing the first next item.
The sensor sensor.trash_first_next_item only shows one item, but there are two pickups at that day (wo 17 jun).
Is there any way to show them both, instead of ‘restafval’, ‘restafval, gft’, just like sensor.trash_tomorrow does?

1 Like

I’d like to fix this, but I need your postal code and housenumber in order to simulate this.

Can you provide this? Or else provide a postal code and housenumber in the same neighbourhood with the same pickup dates. You can PM me.

Thanks for helping! Sent a PM.

Tested and fixed in release 4.3.0

image

2 Likes

It is working, thanks!

1 Like

Any chance anyone can put all this information in a custom card (like the darksky weather card)?
I’m not so good with the code editor.

@xirixiz have you read this note?
I am also struggling with this part.

Would be nice to get that solve in some kind of way

anyone else suddenly seeing this too:

do we have a bug, a Saver issue, or has the trash type been changed?? My regular Saver app still shows GFT, so I dont understand what’s happening here…

thanks for having a look!

Trash type has changed :wink:

Hi @xirixiz

Haven’t checked in the source code myself yet, but would it at all be possible to add the ‘Nieuws’ to a sensor ?

Not grabbing the app daily myself, this would seem a nice addition to the integration?

This add on seems to break my HA when installing through HACS. It appears to be overwriting/removing/replacing files in the “custom_components” directory and as a result HACS is corrupted causing HA to throw a fit when starting. Tried this on 2 individual HA installs and both ran into problems.

Anybody else facing this?