Garbage pickup date ( custom_component

Perfect, ill send him a message. Thanks so far again. :grinning:

Yes, I just send you a pm :slight_smile:

fwiw, here’s an auto-entities card, based solely on the sensors the integration makes, (and ditches with my previous custom made template sensors). All I did was move these templates into the template-entity-row option, and had to exclude some of the other sensors:

  - type: custom:auto-entities
      type: entities
      title: Volgende ophaaldata
        - entity_id: sensor.afvalwijzer*next*
        - entity_id: sensor.afvalwijzer*to*

        - entity_id: sensor.afvalwijzer_*
            type: custom:template-entity-row
            state: >
                  |timestamp_custom('%-d %b')}}
            secondary: >
              {% set count = state_attr(config.entity,'days_until_collection_date')|int %}
              {% set day = as_timestamp(strptime(states(config.entity),'%d-%m-%Y'))
                 |timestamp_custom('%A') %}
              {% set dagen =
                {'Monday': 'Maandag',
                'Tuesday': 'Dinsdag',
                'Wednesday': 'Woensdag',
                'Thursday': 'Donderdag',
                'Friday': 'Vrijdag',
                'Saturday': 'Zaterdag',
                'Sunday': 'Zondag'} %}
              {% set dag = dagen[day] if day in dagen else day %}
              {% set unit = 'Dag' if count == 1 else 'dagen' %}

              {% if count >= 14 %} {% set phrase = dag + ' over 2 weken' %}
              {% elif count >= 7 %} {% set phrase = 'Volgende week ' + dag %}
              {% elif count >= 3 %} {% set phrase = 'komende ' + dag %}
              {% elif count == 2 %} {% set phrase = dag + ', overmorgen' %}
              {% elif count == 1 %} {% set phrase = 'morgen, ' + dag %}
              {% else %} {% set phrase = 'Vandaag, ' + dag %}
              {% endif %}
              {{phrase}} {% if count != 0%} ({{count}} {{unit}}) {% endif %}
      method: state
      numeric: true
1 Like

just to notify here too the sensors for today, tomorrow, and day after tomorrow are broken, as an issue was posted here.

Hi have intergrade my sensor but now i will a day before a notify to my phone that the garbage pickup.
Does anyone have a example how i make that easy?

This automation will send a push notification every hour between 17:00 and 20:00 the day before pickup:

- alias: Afval notificatie
    platform: time_pattern
    minutes: '/59'
    seconds: 00
    condition: and
      - condition: time
        after: '17:00:00'
        before: '20:00:00'
      - condition: template
        value_template: "{{ states('sensor.afvalwijzer_tomorrow') != 'Geen' }}"
    - service: notify.push
        title: "Afval"
        message: 'Morgen: {{ states.sensor.afvalwijzer_tomorrow.state }}'

thanks for the fast response! I think i need to make a template? I’m starting to understand it more and more but I don’t quite understand the templates yet.

You can use my automation as is, you only need to be sure that “notify.push” works in your configuration for pushing a notification.

but why would you want to trigger it each hour in the set interval?

  - alias: Afval morgen
    id: Afval morgen
      - platform: time
        at: '21:00:00'
      - platform: time
        at: '16:16:00'
      - >
          {{states.sensor.afvalwijzer_tomorrow is not none}}
      - >
          {{states('sensor.afvalwijzer_tomorrow') != 'Geen'}}
      - service: script.intercom_message
          message_nl: >
              Het is {{now().strftime('%d %B')}}: Morgen wordt
              {{states('sensor.afvalwijzer_tomorrow')|title}} opgehaald!
          message_en: >
              It is {{now().strftime('%d %B')}}: Tomorrow
              {{states('sensor.afvalwijzer_tomorrow')|title}} will be picked up!
      - service: script.notify_trash_tomorrow
      - service: script.persistent_trash_tomorrow
      - service: script.trash_outside_tomorrow

the second 16:16 trigger is only there to show you can trigger at more than 1 time.

Please note you dont need to use the ‘and’ in the conditions, they are and’ed by default

lastly, use

message: "Morgen: {{states('sensor.afvalwijzer_tomorrow')}}"

or multi-line:

message: >
  Morgen: {{states('sensor.afvalwijzer_tomorrow')}}

instead of

message: 'Morgen: {{ states.sensor.afvalwijzer_tomorrow.state }}'

to prevent errors if the template isnt initialized correctly

Because i want a push notification every hour between 17:00 and 20:00 :nerd_face:

haha, sure, why not. cool.

The push notifications need to push me to take out the container :rofl:

haha, this was unexpected:

auto-entities sort method not the right one:

      method: state
      numeric: true



      method: attribute
      attribute: days_until_collection_date

hope this wont error next December, when the dates aren’t set yet…


Maybee somebody can help me.

I’m new to HomeAssisent and I’m trying to add the garbagecalender. Everyting works as expected until a view dag ago the sorting stoped working. I think the the problem is that one of the componends is missing in the JSON files which comes from an API? If this is the problem, how can I prevent the sorting to stop?

type: vertical-stack
  - type: glance
    title: Afval
      - entity: sensor.afvalinfo_afval_today
        name: Vandaag
      - entity: sensor.afvalinfo_afval_tomorrow
        name: Morgen
  - type: entities
      - entity: sensor.afvalinfo_afval_gft
        type: 'custom:secondaryinfo-entity-row'
        secondary_info: >-
          <b style='color:[[ if(sensor.days_until_collection_gft > 3, "" ,  "orange") ]]' > 
          Over [[ sensor.days_until_collection_gft ]] >
          [[if(sensor.days_until_collection_gft > 1, "dagen" , "dag") ]] </b>
      - entity: sensor.afvalinfo_afval_restafval
        type: 'custom:secondaryinfo-entity-row'
        secondary_info: >-
          <b style='color:[[ if(sensor.days_until_collection_restafval > 3, "","orange") ]]'>
          Over [[ sensor.days_until_collection_restafval ]]>
          [[ if(sensor.days_until_collection_restafval > 1, "dagen" , "dag") ]] </b>
      - entity: sensor.afvalinfo_afval_papier
        type: 'custom:secondaryinfo-entity-row'
        secondary_info: >-
          <b style='color:[[ if(sensor.days_until_collection_paper > 3, "" ,"orange") ]]'>
          Over [[ sensor.days_until_collection_paper ]]>
          [[if(sensor.days_until_collection_paper > 1, "dagen" , "dag") ]] </b>
      - entity: sensor.afvalinfo_afval_pbd
        type: 'custom:secondaryinfo-entity-row'
        secondary_info: >-
          <b style='color:[[ if(sensor.days_until_collection_pbd > 3, "" , "orange") ]]'>
          Over [[ sensor.days_until_collection_pbd ]]>
          [[if(sensor.days_until_collection_pbd > 1, "dagen" , "dag") ]] </b>
        - entity_id: sensor.afvalinfo_gft
        - entity_id: sensor.afvalinfo_afval_papier
        - entity_id: sensor.afvalinfo_restafval
        - entity_id: sensor.afvalinfo_afval_pbd
      numeric: true
      method: attribute
      attribute: days_until_collection_date

check the post above yours. sorting works as expected.

where did you find these < > stylings? must admit, that’s new to me

For the html tags look at:
For this one I want to maken an function so that it can also show “Vandaag” and “Morgen” insteat of “dag” and “dagen”

For the filter I use:
numeric: true -> because 11 comes after 10 and not between 1 and 2
method: attribute -> I want to sort on an attribute
attribute: days_until_collection_date -> the attribute that I want to use.
(sensor.afvalinfo_*.days_until_collection_date )

Where do I make an mistake?

I have read the content above and I don’t see it…

great, there’s exactly 1 line with obscure tags, and of course I missed that. nice to know, so thanks for posting!

when you say the sorting ‘stops’, exactly what are you experiencing. Do you get any errors in the inspector or logs? What result is showing in the frontend?

Maybe you have incorrect entities (should show in the inspector as None), and your templates should guard those.

How, please give us some more information so we can help

btw, Vandaag and Morgen are available in my earlier post (s), eg here

Thnx for the quick response. The missing date is fixed and didn’t couse the problem(I have removed the item compleetly while testing).

What I meant with “the sorting stops” is that everyting looks alright but the order of the items is not sorted.
This has worked before and I don’t know why it isn’t working anymore. I don’t get any error messages.

What happens if you take out the numeric sort option ?

Working perfectly here:

Am I right that the time is based on utc time? So the change is at 1:00 in the morning?