Hi folks here I am again.
First of all my deep respect to @xirixiz the creator of “Afvalwijzer”. Thanks for this beautiful piece of work!
Occasionally it wil be the case that on the same day two garbage types will be collected. For example last week august 22 the types “Restafval” and “Papier” has bin collected. As you can see in the screenshot the integration does not handle this correctly. It would be nice if the image would be split into half to display both garbage types. I saw on the forum that some of you have this working but I cannot see how its done.
Again, I am not a coding specialist so please don’t be to harsh with me
Would appreciate very much if you guys have tips for me and push me in the right direction
This is the full code of the card I use. Please ask if you need more info.
Thanks in advance!
Regards, Herman F.
type: custom:mod-card
card_mod:
style: |
:host {
--stack-card-margin: 0px;
}
card:
type: vertical-stack
cards:
- type: custom:button-card
name: Afvalwijzer
template: null
hold_action:
action: navigate
navigation_path: |
[[[ return window.location.pathname.split('/')[2] == 'calendar'
? '/ui-overview/home_summary' : null; ]]]
styles:
card:
- background-color: var(--background-color-off)
- color: Darkgreen
- font-size: 20px
- font-weight: Bold
- padding: 12px
name:
- justify-self: left
- type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card.type-markdown {
box-shadow: none;
}
content: >
<ha-icon icon= {{'mdi:delete' if states('sensor.afvalwijzer_today') ==
'Geen' else 'mdi:delete-outline'}}> </ha-icon> Vandaag,
{{states('sensor.today')}}: **{{states('sensor.afvalwijzer_today') |
capitalize}}**
<ha-icon icon= {{states('sensor.afvalwijzer_next_icon')}}> </ha-icon>
Volgende afval-ophaaldag over
**{{states('sensor.afvalwijzer_next_in_days')}}** {{'dag' if
states('sensor.afvalwijzer_next_in_days') == '1' else 'dagen'}} op:
<ha-icon icon= 'mdi:delete'> </ha-icon>
{{states('sensor.afvalwijzer_next_date')}}:
**{{states('sensor.afvalwijzer_next_type') | capitalize}}**
- type: horizontal-stack
cards:
- type: picture-entity
card_mod:
style: |
ha-card {
box-shadow: none;
animation: {% if is_state('persistent_notification.trash_notification_today','notifying') and
states('sensor.afvalwijzer_today') != 'Geen' %} blink 2s linear infinite;
{% else %} none
{% endif %}
}
@keyframes blink {
100% {opacity: 0;}
}
entity: sensor.afvalwijzer_today
name: Vandaag
show_state: false
state_image:
gft: /local/afvalwijzer/gft.png
papier: /local/afvalwijzer/papier.png
restafval: /local/afvalwijzer/restafval.png
pmd: /local/afvalwijzer/pmd.png
Best-tas: /local/afvalwijzer/best-tas.png
Snoeiafval: /local/afvalwijzer/snoeiafval.png
Geen: /local/afvalwijzer/geen.png
- type: picture-entity
card_mod:
style: |
ha-card {
box-shadow: none;
animation: {% if is_state('persistent_notification.trash_notification_tomorrow','notifying') and
states('sensor.afvalwijzer_tomorrow') != 'Geen' %} blink 2s linear infinite;
{% else %} none
{% endif %}
}
@keyframes blink {
100% {opacity: 0;}
}
entity: sensor.afvalwijzer_tomorrow
name: Morgen
show_state: false
state_image:
gft: /local/afvalwijzer/gft.png
papier: /local/afvalwijzer/papier.png
restafval: /local/afvalwijzer/restafval.png
pmd: /local/afvalwijzer/pmd.png
Best-tas: /local/afvalwijzer/best-tas.png
Snoeiafval: /local/afvalwijzer/snoeiafval.png
Geen: /local/afvalwijzer/geen.png
- type: picture-entity
entity: sensor.afvalwijzer_day_after_tomorrow
card_mod:
style: |
ha-card {
box-shadow: none;
}
name: Overmorgen
show_state: false
state_image:
restafval: /local/afvalwijzer/restafval.png
gft: /local/afvalwijzer/gft.png
papier: /local/afvalwijzer/papier.png
pmd: /local/afvalwijzer/pmd.png
Best-tas: /local/afvalwijzer/best-tas.png
Snoeiafval: /local/afvalwijzer/snoeiafval.png
Geen: /local/afvalwijzer/geen.png
- type: custom:auto-entities
card:
type: entities
filter:
exclude:
- entity_id: sensor.afvalwijzer*next*
- entity_id: sensor.afvalwijzer*to*
- entity_id: sensor.afvalwijzer*until*
include:
- entity_id: sensor.afvalwijzer_*
options:
type: custom:template-entity-row
image: >
{% set type = config.entity.split('afvalwijzer_')[1] %}
/local/afvalwijzer/{{type}}.png
state: >
{% set trash = config.entity %} {% set today =
state_attr(trash,'is_collection_date_today') %} {% set future =
state_attr(trash,'days_until_collection_date') %} {% if future
is none or
(is_state(trash,'Geen') and future == 0) %} Tba
{% else %} {{as_timestamp(strptime(states(trash),'%d-%m-%Y'))
|timestamp_custom('%-d %b')}}
{% endif %}
secondary: >
{% set trash = config.entity %} {% set today =
state_attr(trash,'is_collection_date_today') %} {% set future =
state_attr(trash,'days_until_collection_date') %} {% if future
is none or
(is_state(trash,'Geen') and future == 0) %} Nog niet gepubliceerd
{% else %}
{% set count = state_attr(trash,'days_until_collection_date')|int(default=0) %}
{% set day = as_timestamp(strptime(states(trash),'%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 >= 28 %} {% set phrase = dag + ' over 4 weken' %}
{% elif count >= 21 %} {% set phrase = dag + ' over 3 weken' %}
{% elif 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 %}
{% endif %}
sort:
method: attribute
attribute: days_until_collection_date
numeric: true
entities: null