Garbage pickup date (mijnafvalwijzer.nl) custom_component

woa, you’re fast!
thanks a bunch!

Is there also an icon for the combi of paper and gft?

Good job Frank!

Hi @xirixiz

did you eve get the chance to have a look at my request to have the next pickup dates not include todays pickup?

would be a major improvement if the 4 listed days could start with the first pickup date after todays pickup.

It’s already available, I thought you were using it for a while. For me it’s working properly.

count_today: vandaag meetellen # true or false

Here you go

im using this:

  - platform: afvalwijzer # Required
    provider: mijnafvalwijzer # Optional - mijnafvalwijzer (default) or afvalstoffendienstkalender
    zipcode: !secret postcode # Required
    housenumber: !secret huisnummer # Required
#    suffix: 'new' # Optional
#    count_today: false vandaag meetellen # Optional. true or false - Default = false
#    default_label: 'Geen' # Optional - Default is 'Geen'
    entity_namespace: saver
#    scan_interval: 1800

which is the default for count_today: false which makes the sensors

{{states('sensor.saver_trash_first_next_in_days')}}, {{states('sensor.saver_trash_first_next_date')|capitalize}} and
{{states('sensor.saver_trash_first_next_item')|capitalize}}

correct, as displayed in my screenshot above.

the listing below that is not correct though, because it also shows todays pickup.

this is what count_today: true does:

it changes the top sensors to include today, but doesn’t change the sensors listed below.

the glance card btw is this:

  - type: 'custom:auto-entities'
    card:
      type: glance
      title: Next pickups
#      title: "'! none'"
    filter:
      include:
        - attributes:
            next_pickup_in_days: '! none'
    sort:
      attribute: next_pickup_in_days
      method: attribute
      numeric: true

Great, thanks!

Are you still in a good mood :smiley: because I’m looking for a combi icon with rest garbage and plastic/can.

Here you go!

@xirixiz
there’s a typo in line 134 of the python library not sure if that was already picked up. Doesn’t seem to hurt anything though, I’ve never seen an error… :wink:

if you’re looking at it, semantics might be improved on that same first_next_in_days. Either trash_first_in_days, or maybe even better make it trash_next_in_days.
which would give the opportunity to also improve the naming of the other 2 sensors using first, into trash_next_date and trash_next_item.

thanks for considering.

Thank you very much, much appreciated !!

Fixed! https://github.com/xirixiz/python-afvalwijzer-afvalstoffendienst/blob/c69c1e7da7ff6eed13f279f700f0a316fdb27bda/Afvaldienst/Afvaldienst.py#L134

Based on the code from @xirixiz I changed the naming of the icons, added “christmastrees” and overall reworked the icon set a bit to be a bit more consistent. This is the last I am doing on these icons :slight_smile:

2 Likes

For any one who might be interested in dutch notation on the dates I have made the stuf below.
Not really small in code but does the job :smiley:

image

And of course thx for this nice add on :+1:

  - platform: template
    sensors:
      trash_first_next_date_formatted:
        entity_id: sensor.trash_first_next_date
        value_template: >
          {%- set tracker_timestamp = as_timestamp(strptime(states.sensor.trash_first_next_date.state, "%d-%m-%Y")) %}
          {%  set months = ["Jan", "Feb", "Mrt", "Apr", "Mei", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dec"] %}
          {%- set wdays = ["Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"] %}
          {%- set wday =  tracker_timestamp | timestamp_custom('%w') | int %}
          {%- set month =  tracker_timestamp | timestamp_custom('%m') | int %}
          {{ tracker_timestamp | timestamp_custom(wdays[wday]  + ' ' '%d' ' ' + months[month-1] ) }}
1 Like

nice indeed, thanks.

one small but significant edit: have it use the states() notation/function, to guard against ‘unknown’ issues:

  {%- set tracker_timestamp = as_timestamp(strptime(states('sensor.trash_first_next_date'), '%d-%m-%Y')) %}
1 Like

Hi! I got the sensors to work, and am able to display the ‘basic’ the UI. Great stuff!
On the GitHub page (https://github.com/xirixiz/Home-Assistant-Sensor-Afvalwijzer) I found an image that I found to be the best overview I’ve seen. Based on much of the discussion in this thread, I tried to replicate it, but I wasn’t successful. I installed all the custom components. Is the code for the layout of this image available somewhere?

‘this image’ is a stack of elements :wink:

you can try mine, Ive updated it yesterday to use @thomasloven 's new hui-element custom-card, so you can use an entities card as main card, and be done with the stack-in-card or vertical-stack-in-card custom cards, which all have their specific needs.

type: entities
entities:
  - type: custom:hui-element
    card_type: markdown
    style: |
      ha-card {
        box-shadow: none;
        margin: -16px -16px 0px -16px;
        }
    content: >
      # <font color = {{states('sensor.trash_color')}}>Afvalwijzer</font>

      <ha-icon icon= {{'mdi:delete-alert' if states('sensor.saver_trash_today') != 'Geen' else 'mdi:delete-outline'}}> </ha-icon> Vandaag, {{states('sensor.vandaag')}}: <font color= {{states('sensor.trash_color')}}>**{{states('sensor.saver_trash_today')|capitalize}}</font>**

      <ha-icon icon= {{states('sensor.trash_next_icon')}}> </ha-icon> Volgende afval-ophaal over **<font color={{states('sensor.trash_next_color')}}>{{states('sensor.saver_trash_first_next_in_days')}}</font>** {{'dag' if states('sensor.saver_trash_first_next_in_days') == '1' else 'dagen'}} op:

      <ha-icon icon= 'mdi:delete-alert'> </ha-icon> {{states('sensor.trash_first_next_date_formatted')}}: **<font color={{states('sensor.trash_next_color')}}>{{states('sensor.saver_trash_first_next_item')|capitalize}}</font>**

  - type: custom:hui-element
    card_type: horizontal-stack

    cards:
      - type: picture-entity
        style: |
          ha-card {
            box-shadow: none;
            margin: 0px -16px 0px -16px;
            animation: {% if is_state('persistent_notification.trash_notification', 'notifying') and
                               states('sensor.saver_trash_today') != 'Geen' %} blink 2s linear infinite;
                       {% else %} none
                       {% endif %}
            }
          @keyframes blink {
            100% {opacity: 0;}
            }

        entity: sensor.saver_trash_today
        name: Vandaag
        show_state: false
        state_image:
          'gft': /local/mijnafvalwijzer/gft3.png
          'papier': /local/mijnafvalwijzer/papier3.png
          'restafval': /local/mijnafvalwijzer/restafval3.png
          'plastic verpakkingsafval': /local/mijnafvalwijzer/plastic3.png
          'Geen': /local/mijnafvalwijzer/kliko_geen.png
      - type: picture-entity
        style: |
          ha-card {
            box-shadow: none;
            margin: 0px -16px 0px -16px;
            animation: {% if is_state('persistent_notification.trash_notification', 'notifying') and
                               states('sensor.saver_trash_tomorrow') != 'Geen' %} blink 2s linear infinite;
                       {% else %} none
                       {% endif %}
            }
          @keyframes blink {
            100% {opacity: 0;}
            }
        entity: sensor.saver_trash_tomorrow
        name: Morgen
        show_state: false
        state_image:
          'gft': /local/mijnafvalwijzer/gft3.png
          'papier': /local/mijnafvalwijzer/papier3.png
          'restafval': /local/mijnafvalwijzer/restafval3.png
          'plastic verpakkingsafval': /local/mijnafvalwijzer/plastic3.png
          'Geen': /local/mijnafvalwijzer/kliko_geen.png
      - type: picture-entity
        style: |
          ha-card {
            box-shadow: none;
            margin: 0px -16px 0px -16px;
            }
        entity: sensor.saver_trash_day_after_tomorrow
        name: Overmorgen
        show_state: false
        state_image:
          'gft': /local/mijnafvalwijzer/gft3.png
          'papier': /local/mijnafvalwijzer/papier3.png
          'restafval': /local/mijnafvalwijzer/restafval3.png
          'plastic verpakkingsafval': /local/mijnafvalwijzer/plastic3.png
          'Geen': /local/mijnafvalwijzer/kliko_geen.png

  - type: custom:hui-element
    card_type: custom:auto-entities
    card:
      type: glance
      style: |
        ha-card {
          box-shadow: none;
          margin: 0px -16px 0px -16px;
          }
      title: Next pickups
    filter:
      include:
        - attributes:
            next_pickup_in_days: '! none'
    sort:
      attribute: next_pickup_in_days
      method: attribute
      numeric: true

  - type: divider
#    style: |
#      div {
#        margin: 0 -16px;
#        border-style: solid;
#        border-width: thin;
#        border-color: red;
#      }
  - type: custom:hui-element
    card_type: custom:auto-entities
    card:
      type: entities
      style: |
        ha-card {
          box-shadow: none;
          margin: 0px -16px 0px -16px;
          }
    filter:
      include:
        - entity_id: sensor.*_trash_timestamp
          options:
            type: custom:template-entity-row
            state: >
              {{state_attr(config.entity,'date')}}
    sort:
      method: state

  - type: custom:hui-element
    card_type: entities
    style: |
      ha-card {
        box-shadow: none;
        margin: -16px -16px -16px -16px;
        background: url('/local/mijnafvalwijzer/background.png');
        background-size: cover;
        }
    show_header_toggle: false
    entities:
     - entity: automation.afval_vandaag
       name: Notify vandaag
     - entity: automation.afval_morgen
       name: Notify morgen
     - entity: input_boolean.trash_reminder
     - entity: input_boolean.trash_outside

Note I do use some custom sensors and templates, but you can have a look how it is done.

Also, I use 3 pictures adding ‘Overmorgen’

1 Like

didnt notice it when I posted above, but now that I did:
because of the change to the entities card listing entities, among these the horizontal stack with picture entities, the formatting went off… If you look closely you see the right picture to be larger than the other 2, the middle being smallest.
Ive tried to take out the style formatting for the 3 picture elements, and bring that 1 level up to the horizontal stack, but that doesnt work.

what does work (almost) is changing the styling to:

left image: margin: 0px 0px 0px -16px;
middle: margin: 0px -8px 0px -8px;
right image: margin: 0px -16px 0px 0px;

but even with that, there s a tiny scratch of separation visible, which I find very annoying. Especially since that wasnt the case before, so I’ll return to the previous setup.

second thing I noticed: my afvalwijzer apparently stopped ending plastic, but now does pbd… no issue of course, but just explaining why the above image shows an mdi icon (and ‘none’ ) instead of the nice button image…

nice plugin! i’am new to Home Assistant…Is it possible to add two addresses? I created a second trash.yaml (inside /packages)
changed all sensor.trash_xxx to sensor.trash_xxx_2 but that unfortunately doesnt work.