Garbage pickup date (mijnafvalwijzer.nl) custom_component

Just try to build it step by step. First the sensor and platform. After that next part. I have tried whole day and finaly got it worked.

This card looks great and since Home Assistant is pretty new for me i thought lets start with this to recreate what you have created here but I failed big time i think.

This is what i had after copy-paste

Those images arent the biggest obstacle but a few sensors are, for example:
sensor.vandaag.state
sensor.gft_formatted
sensor.papier_formatted
sensor.plastic_verpakkingsafval_formatted
sensor.restafval_formatted

I don’t have thos and can’t seem to find them also.
Any suggesitons/help?

sure, here you go:

  - platform: template
    sensors:
      restafval:
        friendly_name: 'Restafval'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      plastic_verpakkingsafval:
        friendly_name: 'Plastic'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      gft:
        friendly_name: 'Gft'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      papier:
        friendly_name: 'Papier'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      gft_formatted:
        friendly_name: 'Gft'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      papier_formatted:
        friendly_name: 'Papier'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      plastic_verpakkingsafval_formatted:
        friendly_name: 'Plastic'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      restafval_formatted:
        friendly_name: 'Restafval'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

note that those formatted sensors are purely made for displaying nicely in the Lovelace card.
sensor.vandaag.state isnt a sensor, its the silly way of templating for the useful-markdown card, which is no longer needed.
You can now simply use jinja templates in the native Hassio markdown card

      - type: markdown
        content: >
          Vandaag is het **<font color=green> {{states('sensor.vandaag')}}</font>**.

          Volgende afval-ophaal over **<font color=var(--secondary-text-color)>{{states('sensor.trash_next')}}</font>** dagen:

          **<font color=var(--secondary-text-color)>{{states('sensor.trash_firstdate')}}</font>** : **{{states('sensor.trash_firstwastetype')}}**

images:
asbest
elec gft
gft3
glas
goedbeter
kca
kliko_geen
kliko
kringloop
milieustraat
papier
papier3
plastic
plastic3
restafval
restafval3
textiel asbest.png
elec.png
gft.png
gft3.png
glas.png
goedbeter.png
kca.png
kliko_geen.png
kliko.png
kringloop.png
milieustraat.png
papier.png
papier3.png
plastic.png
plastic3.png
restafval.png
restafval3.png
textiel.png

You might want to use the full package. Note that this also holds info for legacy HA (eg the groups), and useful customization, using custom-u which is needed separately:

##########################################################################################
## MijnAfvalWijzer Custom Component 
## created by @xirixiz, more info on  https://github.com/xirixiz/home-assistant-config
## https://community.home-assistant.io/t/garbage-pickup-date-mijnafvalwijzer-nl-custom-component/34631
# place this package in /config/packages
# place the custom component mijnafvalwijzer.py in /config/custom_components/sensor
# @marijnthvdb
##########################################################################################
# manual edit in CC:
# 226 trashFirstDate['value'] = scraper_data.find('p', attrs={'class':'firstDate'}).text.capitalize()
# 232 firstWasteType['value'] = scraper_data.find('p', attrs={'class':'firstWasteType'}).text.replace('.','')

homeassistant:
  customize:
    group.trash_calendar:
      templates:
        icon: >
          if (entities['sensor.trash_today'].state === 'Geen') return 'mdi:delete-empty';
          return 'mdi:delete-restore';

    sensor.restafval:
      entity_picture: /local/mijnafvalwijzer/restafval.png
    sensor.plastic_verpakkingsafval:
      entity_picture: /local/mijnafvalwijzer/plastic.png
    sensor.gft:
      entity_picture: /local/mijnafvalwijzer/gft.png
    sensor.papier:
      entity_picture: /local/mijnafvalwijzer/papier.png

    sensor.restafval_formatted:
      entity_picture: /local/mijnafvalwijzer/restafval.png
    sensor.plastic_verpakkingsafval_formatted:
      entity_picture: /local/mijnafvalwijzer/plastic.png
    sensor.gft_formatted:
      entity_picture: /local/mijnafvalwijzer/gft.png
    sensor.papier_formatted:
      entity_picture: /local/mijnafvalwijzer/papier.png

    sensor.trash_gft:
      hidden: true
    sensor.trash_papier:
      hidden: true
    sensor.trash_plastic:
      hidden: true
    sensor.trash_restafval:
      hidden: true

    sensor.afval_vandaag:
      templates:
        theme: >
          if (state === 'Papier') return 'papier';
          if (state === 'Gft' ) return 'green';
          if (state === 'Plastic') return 'orange';
          if (state === 'Restafval') return 'black';
          return 'grey';

    sensor.afval_overmorgen:
      templates:
        theme: >
          if (state === 'Papier') return 'papier';
          if (state === 'Gft' ) return 'green';
          if (state === 'Plastic') return 'orange';
          if (state === 'Restafval') return 'black';
          return 'grey';

    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';

#    sensor.trash_today:
#      friendly_name: 'Afval vandaag'
#      templates:
#        entity_picture: >
#          if (state === 'papier') return '/local/mijnafvalwijzer/papier.png';
#          if (state === 'gft') return '/local/mijnafvalwijzer/gft.png';
#          if (state === 'plastic') return '/local/mijnafvalwijzer/plastic.png';
#          if (state === 'restafval') return '/local/mijnafvalwijzer/restafval.png';
#          return '/local/mijnafvalwijzer/kliko_geen.png';
#        theme: >
#          if (state === 'papier') return 'papier';
#          if (state === 'gft') return 'green';
#          if (state === 'plastic') return 'orange';
#          if (state === 'restafval') return 'black';
#          return 'grey';

    sensor.trash_tomorrow:
      friendly_name: 'Afval morgen'
      templates:
        entity_picture: >
          if (state === 'papier') return '/local/mijnafvalwijzer/papier.png';
          if (state === 'gft') return '/local/mijnafvalwijzer/gft.png';
          if (state === 'plastic verpakkingsafval') return '/local/mijnafvalwijzer/plastic.png';
          if (state === 'restafval') return '/local/mijnafvalwijzer/restafval.png';
          return '/local/mijnafvalwijzer/kliko_geen.png';
        theme: >
          if (state === 'papier') return 'papier';
          if (state === 'gft') return 'green';
          if (state === 'plastic verpakkingsafval') return 'orange';
          if (state === 'restafval') return 'black';
          return 'grey';

    sensor.trash_firstdate:
      friendly_name: First date
      icon: mdi:calendar-check
      templates:
        theme: >
          if (entities['sensor.trash_firstwastetype'].state === 'Papier en karton') return 'papier';
          if (entities['sensor.trash_firstwastetype'].state === 'Groente, Fruit en Tuinafval' ) return 'green';
          if (entities['sensor.trash_firstwastetype'].state === 'Plastic verpakkingsafval') return 'orange';
          if (entities['sensor.trash_firstwastetype'].state === 'Restafval') return 'black';
          return 'grey';

#    sensor.afval_soort:
    sensor.trash_firstwastetype:
      friendly_name: First waste type
      templates:
        entity_picture: >
          if (state === 'Papier en karton') return '/local/mijnafvalwijzer/papier.png';
          if (state === 'Groente, Fruit en Tuinafval') return '/local/mijnafvalwijzer/gft.png';
          if (state === 'Plastic verpakkingsafval') return '/local/mijnafvalwijzer/plastic.png';
          if (state === 'Restafval') return '/local/mijnafvalwijzer/restafval.png';
          return '/local/mijnafvalwijzer/kliko_geen.png';
        theme: >
          if (state === 'Papier en karton') return 'papier';
          if (state === 'Groente, Fruit en Tuinafval') return 'green';
          if (state === 'Plastic verpakkingsafval') return 'orange';
          if (state === 'Restafval') return 'black';
          return 'grey';

##########################################################################################
# Sensors
##########################################################################################

sensor:
  - platform: mijnafvalwijzer
    postcode: !secret postcode
    huisnummer: !secret huisnummer
    label_geen: 'Geen'
#    scan_interval: 3600 #1 keer per uur

  - platform: template
    sensors:
      restafval:
        friendly_name: 'Restafval'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      plastic_verpakkingsafval:
        friendly_name: 'Plastic'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      gft:
        friendly_name: 'Gft'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      papier:
        friendly_name: 'Papier'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) | timestamp_custom('%d %B') }}

      gft_formatted:
        friendly_name: 'Gft'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      papier_formatted:
        friendly_name: 'Papier'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      plastic_verpakkingsafval_formatted:
        friendly_name: 'Plastic'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      restafval_formatted:
        friendly_name: 'Restafval'
        value_template: >
          {{ as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) | timestamp_custom('%a %d %b') }}

      afval_vandaag:
        friendly_name_template: >
          Vandaag: {{states('sensor.afval_vandaag')}}
        value_template: >
          {{states('sensor.trash_today')|title}}
        entity_picture_template: >
          {% set mapper = {'papier': '/local/mijnafvalwijzer/papier.png',
                           'gft': '/local/mijnafvalwijzer/gft.png',
                           'plastic': '/local/mijnafvalwijzer/plastic.png',
                           'restafval': '/local/mijnafvalwijzer/restafval.png'} %}
          {% set state = states('sensor.afval_vandaag')|lower %}
          {{ mapper[state] if state in mapper else '/local/mijnafvalwijzer/kliko_geen.png' }}
        unit_of_measurement: Afval
# werkt niet zolang trash_next op de dag zelf niet de volgende trash soort toont
#      afval_overmorgen_2:
#        friendly_name: Afval overmorgen
#        value_template: >
#          {% if states('sensor.trash_next') == '2' %}
#            {{states('sensor.trash_firstwastetype')}}
#          {% 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_overmorgen') %}
#          {{ mapper[state] if state in mapper else '/local/mijnafvalwijzer/kliko_geen.png' }}

#      afval_overmorgen:
#        friendly_name: Afval overmorgen
#        value_template: >
#          {% set afval = states('sensor.trash_firstwastetype') %}
#          {% set overmorgen = states('sensor.trash_next') == '2' %}
#          {% if overmorgen %} {{afval[:-1]}}
#          {% else %} Geen
#          {% endif %}
#        entity_picture_template: >
#          {% set mapper = {'Papier': '/local/mijnafvalwijzer/papier.png',
#                           'Gft': '/local/mijnafvalwijzer/gft.png',
#                           'Plastic': '/local/mijnafvalwijzer/plastic.png',
#                           'Restafval': '/local/mijnafvalwijzer/restafval.png'} %}
#          {% set state = states('sensor.afval_overmorgen') %}
#          {{ mapper[state] if state in mapper else '/local/mijnafvalwijzer/kliko_geen.png' }}

      afval_overmorgen:
        friendly_name: Afval overmorgen
        value_template: >
          {% set date = (as_timestamp(now())+2*86400)|timestamp_custom('%d-%m-%Y') %}
          {% if date == states('sensor.trash_papier') %} Papier
          {% elif date == states('sensor.trash_gft') %} Gft
          {% elif date == states('sensor.trash_plastic') %} Plastic
          {% elif date == states('sensor.trash_restafval') %} Restafval
          {% else %} Geen
          {% endif %}
#            {% set papier = (as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) - 
#                  (2 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#            {% set gft = (as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) - 
#                  (2 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#            {% set plastic = (as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) - 
#                  (2 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#            {% set rest = (as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) - 
#                  (2 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#            {% set date = now().strftime('%d-%m-%Y') %}
#            {% if date == papier %} Papier
#            {% elif date == gft %} Gft
#            {% elif date == plastic %} Plastic
#            {% elif date == rest %} Restafval
#            {% else %} Geen
#            {% endif %}
        entity_picture_template: >
          {% set mapper = {'Papier': '/local/mijnafvalwijzer/papier.png',
                           'Gft': '/local/mijnafvalwijzer/gft.png',
                           'Plastic': '/local/mijnafvalwijzer/plastic.png',
                           'Restafval': '/local/mijnafvalwijzer/restafval.png'} %}
          {% set state = states('sensor.afval_overmorgen') %}
          {{ mapper[state] if state in mapper else '/local/mijnafvalwijzer/kliko_geen.png' }}


# now in CC, so no need for manual sensor anymore:
#  - platform: scrape
#    resource: !secret scrape_resource_date
#    name: Afval Datum
#    select: '.firstDate'
#    scan_interval: 3600

#  - platform: scrape
#    resource: !secret scrape_resource_type
#    name: Afval Soort
#    select: '.firstWasteType'
#    scan_interval: 3600

##############################################################################################################
# Groups
##############################################################################################################

group:
  trash_pickup:
    name: 'Afvalwijzer ophaaldata'
    icon: mdi:delete-restore
    control: hidden
    entities:
      - sensor.trash_firstdate
      - sensor.trash_firstwastetype
      - sensor.trash_next
#      - sensor.trash_today
      - sensor.afval_vandaag
      - sensor.trash_tomorrow
      - sensor.afval_overmorgen
      - sensor.restafval
      - sensor.gft
      - sensor.plastic_verpakkingsafval
      - sensor.papier
      - automation.afval_vandaag
      - automation.afval_morgen
#      - input_boolean.trash_moved
#      - input_boolean.trash_reminder

  afval_data_formatted:
    name: Afval data
    icon: mdi:calendar
    entities:
      - sensor.plastic_verpakkingsafval_formatted
      - sensor.papier_formatted
      - sensor.restafval_formatted
      - sensor.gft_formatted


##############################################################################################################
# Automations
##############################################################################################################

automation:

##############################################################################################################
# Vandaag moet het afval worden voorgezet
##############################################################################################################
#datetime.date.today().strftime('%Y-%m-%d')

  - alias: 'Afval vandaag'
    id: 'Afval vandaag'
#    initial_state: 'on'
    trigger:
      platform: time
      at: '07:00:00'
    condition:
      condition: template
      value_template: >
        {{states('sensor.trash_today') != 'Geen'}}
    action:
      - service: script.intercom_message
        data_template:
          message_nl: >
            Het is {{now().strftime('%A %-d %B')}}: vandaag wordt {{states('sensor.trash_today')}} opgehaald!
          message_en: >
            It is {{now().strftime('%A %-d %B')}}: today {{states('sensor.trash_today')}} will be collected!
      - condition: template
        value_template: >
          {{ is_state('input_boolean.notify_utility', 'on')}}
      - service: notify.notify
        data_template:
          message: >
            {{ now().strftime('%d %B') }}: Afvalmelding vandaag wordt
              {{states('sensor.trash_today')|title}} opgehaald!
      - condition: template
        value_template: >
          {{ is_state('input_boolean.persistent_notification_create', 'on')}}
      - service: persistent_notification.create
        data_template:
          notification_id: >
            {{states('sensor.trash_today')}}-trash-notification
          title: >
            {{ now().strftime('%d %B') }}: Afvalmelding vandaag
          message: >
            {{states('sensor.trash_today')|title}} wordt opgehaald!

#werkt ook maar niet nodig als trash_today werkt
#  - alias: 'Afval vandaag 2'
#    initial_state: 'on'
#    trigger:
#      platform: time
#      hours: 7 
#      minutes: 0
#      seconds: 0
#    condition:
#      - condition: template
#        value_template: >
#           {{ states('sensor.trash_firstdate') == 'Vandaag' }}
#      - condition: template
#        value_template: >
#          {{ is_state('input_boolean.notify_utility', 'on')}}
#    action:
#      - service: notify.notify
#        data_template:
#          title: >
#            {{ now().strftime('%d %B') }}: Afvalmelding vandaag
#          message: >
#            Zet het {{states('sensor.trash_firstwastetype')|capitalize}} aan de straat!
#      - condition: template
#        value_template: >
#          {{ is_state('input_boolean.persistent_notification_create', 'on')}}
#      - service: persistent_notification.create
#        data_template:
#          title: >
#            {{ now().strftime('%d %B') }}: Afvalmelding vandaag
#          message: >
#            Zet het {{states('sensor.trash_firstwastetype')|capitalize}} aan de straat!
##############################################################################################################
# Morgen moet het afval worden voorgezet
##############################################################################################################

  - alias: 'Afval morgen'
    id: 'Afval morgen'
#    initial_state: 'on'
    trigger:
      platform: time
      at: '20:00:00'
    condition:
      - condition: template
        value_template: >
          {{states('sensor.trash_tomorrow') != 'Geen'}}
    action:
      - service: script.intercom_message
        data_template:
          message: >
              Het is {{ now().strftime('%d %B') }}: Morgen wordt
              {{states('sensor.trash_tomorrow')|title}} opgehaald!
      - condition: template
        value_template: >
          {{ is_state('input_boolean.notify_utility', 'on')}}
      - service: notify.notify
        data_template:
          title: >
            {{ now().strftime('%d %B') }}: Afvalmelding morgen
          message: >
            {{states('sensor.trash_tomorrow')|title}} wordt morgen opgehaald!
      - condition: template
        value_template: >
          {{ is_state('input_boolean.persistent_notification_create', 'on')}}
      - service: persistent_notification.create
        data_template:
          notification_id: >
            {{states('sensor.trash_tomorrow')}}-trash-notification
          title: >
            {{ now().strftime('%d %B') }}: Afvalmelding morgen
          message: >
            {{states('sensor.trash_tomorrow')|title}} wordt morgen opgehaald!


#
#
#
#  - alias: Reset trash notification
#    trigger:
#      platform: state
#      entity_id: input_boolean.trash_moved
#      to: 'on'
#      for:
#        hours: 12
#    action:
#      - service: input_boolean.turn_off
#        entity_id: input_boolean.trash_moved
#      - service: input_boolean.turn_on
#        entity_id: input_boolean.trash_reminder
#
#  - alias: Mark trash as moved from notification
#    trigger:
#      platform: event
#      event_type: ios.notification_action_fired
##      event_data:
##        actionName: MARK_TRASH_MOVED
#    condition:
#      condition: template
#      value_template: >
#        {{(trigger.event.data.actionName == 'MARK_TRASH_MOVED')}}
#    action:
#      service: input_boolean.turn_on
#      entity_id: input_boolean.trash_moved
#
#  - alias: Trash has not been moved
#    trigger:
#      platform: time_pattern
#      minutes: '/30'
#      seconds: 00
#    condition:
#      condition: and
#      conditions:
#        - condition: template
#          value_template: >
#            {{is_state('input_boolean.trash_moved','off')}}
#        - condition: template
#          value_template: >
#            {{is_state('input_boolean.trash_reminder','on')}}
#        - condition: time
#          after: '18:00:00'
#          before: '23:00:00'
#        - condition: template
#          value_template: >
#            {{ states('sensor.trash_tomorrow') != 'Geen' }}
#    action:
#      service: notify.ios_telefoonmhb
#      data_template:
#        title: 'Afval'
#        message: >
#          {{ states('sensor.trash_tomorrow') }} wordt morgen opgehaald, zet het afval aan de straat
#        data:
#          push:
#            badge: 0
#            sound: https://hvb.duckdns.org:8124/local/sounds/sound_bites/siren.mp3
#            category: 'afval'
##            action_data:
##              entity_id: input_boolean.trash_moved
###############################################################################################################
## Ios
###############################################################################################################
#
#ios:
#  push:
#    categories:
#      - name: Afval
#        identifier: 'afval'
#        actions:
#          - identifier: 'MARK_TRASH_MOVED'
#            title: 'Afval verwerkt'
#            activationMode: 'background'
#            authenticationRequired: yes
#            destructive: yes
#            behavior: 'default'
#
###############################################################################################################
## Inputs
###############################################################################################################
#
#input_boolean:
#  trash_moved:
#    name: Trash has been moved
#    initial: 'off'
#    icon: mdi:delete-empty
#  trash_reminder:
#    name: Trash reminder enabled
#    initial: 'on'
#    icon: mdi:cellphone-message

#  - alias: 'Afval morgen'
#    id: 'Afval morgen'
#    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.afval_soort')|replace('.','')}} 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.afval_soort')|replace('.','')}} wordt morgen opgehaald!, 
#                    Trash tomorrow: {{states('sensor.trash_tomorrow')}}'
#          title: >
#            Afvalmelding Morgen: {{states('sensor.afval_soort')|replace('.','')}} : {{states('sensor.trash_tomorrow')}}

#  - alias: 'Trash tomorrow'
#    id: 'Trash tomorrow'
#    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: or
#        conditions:
#          - condition: template
#            value_template: >
#              {{ (now().strftime('%d-%m-%Y')) == 
#              (as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) - 
#              (1 * 86400 )) | timestamp_custom('%d-%m-%Y') }}
#          - condition: template
#            value_template: >
#              {{ (now().strftime('%d-%m-%Y')) == 
#              (as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) - 
#              (1 * 86400 )) | timestamp_custom('%d-%m-%Y') }}
#          - condition: template
#            value_template: >
#              {{ (now().strftime('%d-%m-%Y')) == 
#              (as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) - 
#              (1 * 86400 )) | timestamp_custom('%d-%m-%Y') }}
#          - condition: template
#            value_template: >
#              {{ (now().strftime('%d-%m-%Y')) == 
#              (as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) - 
#              (1 * 86400 )) | timestamp_custom('%d-%m-%Y') }}
#    action:
#      service: notify.notify
#      data_template:
#        title: >
#          {{ now().strftime('%d %B') }}: Morgen afval voor zetten!
#        message: >-
#          {% if (now().strftime('%d-%m-%Y')) == 
#          (as_timestamp(strptime(states('sensor.trash_gft'), '%d-%m-%Y')) - 
#          (1 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#             De groene bak wordt geleegd op: {{ states('sensor.trash_gft')}}!
#          {% endif %}
#          {% if (now().strftime('%d-%m-%Y')) == 
#          (as_timestamp(strptime(states('sensor.trash_restafval'), '%d-%m-%Y')) - 
#          (1 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#             De grijze bak wordt geleegd op: {{ states('sensor.restafval')}}!
#          {% endif %}
#          {% if (now().strftime('%d-%m-%Y')) == 
#          (as_timestamp(strptime(states('sensor.trash_papier'), '%d-%m-%Y')) - 
#          (1 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#             Papier wordt opgehaald op: {{ states('sensor.trash_papier')}}!
#          {% endif %}
#          {% if (now().strftime('%d-%m-%Y')) == 
#          (as_timestamp(strptime(states('sensor.trash_plastic'), '%d-%m-%Y')) - 
#          (1 * 86400 )) | timestamp_custom('%d-%m-%Y') %}
#             Plastic wordt opgehaald op: {{ states('sensor.trash_plastic')}}!
#          {% endif %}
1 Like

I tried but still no Module bs4. What do I miss? :unamused:

pi@piname:~ $ sudo su
root@piname:/home/pi# sudo -u homeassistant -H -s
homeassistant@piname:/home/pi $ cd /srv/homeassistant/
homeassistant@piname:/srv/homeassistant $ python3 -m venv .
homeassistant@piname:/srv/homeassistant $ source bin/activate
(homeassistant) homeassistant@piname:/srv/homeassistant $ python3 -m pip install bs4
Looking in indexes: Simple index, piwheels - Simple index
Collecting bs4
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x75412d70>: Failed to establish a new connection: [Errno 101] Network is unreachable’)': /simple/bs4/

^CERROR: Operation cancelled by user
(homeassistant) homeassistant@piname:/srv/homeassistant $ python3 -m pip install beautifulsoup4
Looking in indexes: Simple index, piwheels - Simple index
Collecting beautifulsoup4
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x753aa2f0>: Failed to establish a new connection: [Errno 101] Network is unreachable’)': /simple/beautifulsoup4/

Updated my Lovelace card a bit:

  - type: custom:vertical-stack-in-card
    cards:
      - type: markdown
        content: >
          # <font color={{'green' if states('sensor.trash_firstdate') == 'vandaag' else 'grey'}}>Afvalwijzer</font>

          **<font color=green> {{states('sensor.vandaag')}}</font>**.


          **<font color=var(--secondary-text-color)>{{states('sensor.trash_firstdate')}}</font>** : **{{states('sensor.trash_firstwastetype')}}**

          Volgende afval-ophaal over **<font color=var(--secondary-text-color)>{{states('sensor.trash_next')}}</font>** dagen
      - type: horizontal-stack
        cards:
          - type: picture-entity
            entity: sensor.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': /local/mijnafvalwijzer/plastic.png
              'Geen': /local/mijnafvalwijzer/kliko_geen.png
          - type: picture-entity
            entity: sensor.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': /local/mijnafvalwijzer/plastic3.png
              'Geen': /local/mijnafvalwijzer/kliko_geen.png
          - type: picture-entity
            entity: sensor.afval_overmorgen
            name: Overmorgen
            show_state: false
            state_image:
              'Gft': /local/mijnafvalwijzer/gft3.png
              'Papier': /local/mijnafvalwijzer/papier3.png
              'Restafval': /local/mijnafvalwijzer/restafval3.png
              'Plastic': /local/mijnafvalwijzer/plastic3.png
              'Geen': /local/mijnafvalwijzer/kliko_geen.png

      - type: glance
        entities:
         - entity: sensor.gft_formatted
           name: GFT
         - entity: sensor.papier_formatted
           name: Papier
         - entity: sensor.plastic_verpakkingsafval_formatted
           name: Plastic
         - entity: sensor.restafval_formatted
           name: Restafval

      - type: divider

      - type: entities
        entities:
         - entity: automation.afval_vandaag
           name: Notify vandaag
         - entity: automation.afval_morgen
           name: Notify morgen
5 Likes

Thanks for explaining and the needed files, works as expected now :wink:

1 Like

sure, you’re welcome.

If you’d like the text in the Lovelace card to follow the type of trash to be picked up, have a look here:

The configuration checker for 0.99.2 warns me something is wrong with my configuration:

- Platform error sensor.afvalwijzer - No module named 'bs4'

I am running Hassio in Docker on Ubuntu Server 18.04, and because it’s Hassio I don’t think I can install any module myself.

Is this a known issue? With hopefully a known solution? :slight_smile:

Small edit: I installed afvalwijzer through HACS, perhaps that matters?

Got a basic version running now but keep struggling with sensor.vandaag. I have read in other topic that it’s a basic date sensor but or I’m searching in the wrong place for it or I’m blind :stuck_out_tongue:
Can you point me to this sensor or examples of it?
Following trash is on my todo list, currently reorganizing my configuration after seeing some setups from other users

put this under your template sensors config:

      vandaag:
        friendly_name: Vandaag
        entity_id: sensor.date
        value_template: >
          {{ now().strftime('%A %-d %B %Y') }}
1 Like

For anyone running Hassio and wanting to upgrade to 0.99.3 I just want to mention: version 0.3.10 of the afvalwijzer component seems to fix the bs4 dependency requirement for Hassio. Through this PR. So you can upgrade now :slight_smile:

been running 99.3 since available and have no issues at all, without the PR… no need to set the bs4 dependency at all? At least not in a general sense, maybe your specific setting requires it?

I just know checking the configuration gave the bs4 error for me (see my post 9 days ago). Updated to 0.3.10 and no more warning, so I took the plunge to 0.99.3.

yes, Ive seen that, and commented there. Don’t think generic PR’s should be used for fixing individual issues.

In this case it’s only adding a depency, so might not be too bad (ill simply leave it out)…
as a general practice I feel it would be unwise to change code, when the component itself is working just fine, and an individual case is not functioning.

We’re talking about different things I believe. But all is well and I am happy with an up to date HA, no configuration errors and still taking out the trash on the right days :upside_down_face:

Tried to get the : custom:vertical-stack-in-card to work (just like @Mariusthvdb did) . But after day’s of trying :slight_smile:

  - title: Afval
    icon: 'mdi:trash-can-outline'
    type: 'custom:vertical-stack-in-card'
    cards:
      - entities:
          - entity: sensor.gft_formatted
            name: GFT
          - entity: sensor.papier_formatted
            name: Papier
          - entity: sensor.plastic_verpakkingsafval_formatted
            name: Plastic
          - entity: sensor.restafval_formatted
            name: Restafval
        type: glance
      - cards:
          - entity: sensor.trash_today
            name: Vandaag
            show_state: false
            state_image:
              Geen: /local/mijnafvalwijzer/kliko.png
              gft: /local/mijnafvalwijzer/gft3.png
              papier: /local/mijnafvalwijzer/papier3.png
              plastic verpakkingsafval: /local/mijnafvalwijzer/plastic3.png
              restafval: /local/mijnafvalwijzer/rest3.png
            type: picture-entity
          - entity: sensor.trash_tomorrow
            name: Morgen
            show_state: false
            state_image:
              Geen: /local/mijnafvalwijzer/kliko.png
              gft: /local/mijnafvalwijzer/gft3.png
              papier: /local/mijnafvalwijzer/papier3.png
              plastic verpakkingsafval: /local/mijnafvalwijzer/plastic3.png
              restafval: /local/mijnafvalwijzer/rest3.png
            type: picture-entity
        type: horizontal-stack
      - content: >
          # <font color={{'green' if states('sensor.trash_firstdate') ==
          'vandaag' else 'grey'}}>Afvalwijzer</font>

          **<font color=green> {{states('sensor.vandaag')}}</font>**.


          **<font
          color=var(--secondary-text-color)>{{states('sensor.trash_firstdate')}}</font>**
          : **{{states('sensor.trash_firstwastetype')}}**

          Volgende afval-ophaal over **<font
          color=var(--secondary-text-color)>{{states('sensor.trash_next')}}</font>**
          dagen
        type: markdown

The stack card is still separated
a

Anybody who can tell me what’s wrong within my card ?

give this a shot, I always add the type: after the cards: which makes reading the config so much easier.

  - title: Afval
    icon: 'mdi:trash-can-outline'
    type: 'custom:vertical-stack-in-card'
    cards:
      - type: glance
        entities:
          - entity: sensor.gft_formatted
            name: GFT
          - entity: sensor.papier_formatted
            name: Papier
          - entity: sensor.plastic_verpakkingsafval_formatted
            name: Plastic
          - entity: sensor.restafval_formatted
            name: Restafval
      - type: horizontal-stack
        cards:
          - type: picture-entity
            entity: sensor.trash_today
            name: Vandaag
            show_state: false
            state_image:
              Geen: /local/mijnafvalwijzer/kliko.png
              gft: /local/mijnafvalwijzer/gft3.png
              papier: /local/mijnafvalwijzer/papier3.png
              plastic verpakkingsafval: /local/mijnafvalwijzer/plastic3.png
              restafval: /local/mijnafvalwijzer/rest3.png
          - type: picture-entity
            entity: sensor.trash_tomorrow
            name: Morgen
            show_state: false
            state_image:
              Geen: /local/mijnafvalwijzer/kliko.png
              gft: /local/mijnafvalwijzer/gft3.png
              papier: /local/mijnafvalwijzer/papier3.png
              plastic verpakkingsafval: /local/mijnafvalwijzer/plastic3.png
              restafval: /local/mijnafvalwijzer/rest3.png
      - type: markdown
        content: >
          # <font color={{'green' if states('sensor.trash_firstdate') ==
          'vandaag' else 'grey'}}>Afvalwijzer</font>

          **<font color=green> {{states('sensor.vandaag')}}</font>**.


          **<font
          color=var(--secondary-text-color)>{{states('sensor.trash_firstdate')}}</font>**
          : **{{states('sensor.trash_firstwastetype')}}**

          Volgende afval-ophaal over **<font
          color=var(--secondary-text-color)>{{states('sensor.trash_next')}}</font>**
          dagen
1 Like

thnx for you’re reply, but stil not one card but spaces .
When want to edit this “card” it’s also displayed as separate cards:

yes I feared you are using the UI editor, hence the strange order of keys… using yaml mode here.

must be an indent, I only changed your own code, to have the better readable order. If you check carefully with my setup, you might find one or the other card listed under another main type?

Check the types that stack the other cards with special attention.
Maybe check the order also? As I have it, just to see if that makes a difference?

Using the UI , and then the RAW editor