that works indeed…but no data but the title as i dont have the sensors somehow.
nope. nothing with afvalwijzer. so i seem to missing a step. but dont know what/how
Post a screenshot of your afvalwijzer installation in HACS, and the settings you configured in configuration.yaml.
no use trying to create a lovelace card without entities… so first things first, why doesn’t the integration correctly initialize. your config seems ok, so maybe we have errors in the regular log. I suppose the logger error is because there is no custom component afvalwijzer in the system, so it cant log/debug that either.
this is my latest:
- type: custom:auto-entities
card:
type: entities
title: Volgende ophaaldata
filter:
include:
- entity_id: sensor.afvalwijzer_*_next
options:
type: custom:template-entity-row
state: >
{{state_attr(config.entity,'date')}}
secondary: >
{% set count = states(config.entity)|int %}
{% set day = state_attr(config.entity,'day') %}
{% 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 %}
sort:
method: state
numeric: true
Thanks, not working yet though. When i copy and paste the code, it looks like it is scrambling up the code:
yeah should look like this:
its not scrambling, this is what the card does, workout the templates, and if it cant do so, it shows the template itself. Do you have any errors sin the inspector window (Chrome shows inspector details best)
also this uses my self created template sensors:
afvalwijzer_restafval_next:
friendly_name: Restafval
entity_picture_template: /local/afvalwijzer/restafval_saver.png
value_template: >
{{state_attr('sensor.afvalwijzer_restafval','days_until_collection_date')}}
attribute_templates:
day: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))
|timestamp_custom('%A')}}
date: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))
|timestamp_custom('%a %d %b')}}
timestamp: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))}}
same for the other trash types
if you don’t have these, the card can not use them
Adding the “day” attribute in the sensor did the job, thanks! Great work!
seems your day isn’t correct ;-), always Friday. should check the template there.
Forgot to edit the copyed day attributes
haha, we don’t need pickups on Saterday do we
since it s always tue, wed, or thur here, I’ve never noticed.
thanks…
edited the post above for posterity.
I have the sensors now. Was a bloody typo :).
But is not showing the correct images somehow. (https://github.com/xirixiz/homeassistant-afvalwijzer/blob/772a09f003eb6791353476019cacac23c2a7b88c/afvalwijzer_lovelace.png)
So the middle one is not showing the icon. Nad the recycle images should also be the other ones.
cards:
- cards:
- entity: sensor.afvalwijzer_today
name: Vandaag
show_name: true
show_state: false
state_image:
GFT: /local/afvalwijzer/GFT.png
Geen: /local/afvalwijzer/Geen.png
PMD: /local/afvalwijzer/PMD.png
Papier: /local/afvalwijzer/Papier.png
Restafval: /local/afvalwijzer/Restafval.png
type: picture-entity
- entity: sensor.afvalwijzer_next_item
name: Morgen
show_name: true
show_state: false
state_image:
GFT: /local/afvalwijzer/GFT.png
Geen: /local/afvalwijzer/Geen.png
PMD: /local/afvalwijzer/PMD.png
Papier: /local/afvalwijzer/Papier.png
Restafval: /local/afvalwijzer/Restafval.png
type: picture-entity
- entity: sensor.afvalwijzer_day_after_tomorrow
show_name: false
show_state: false
state_image:
GFT: /local/afvalwijzer/GFT.png
Geen: /local/afvalwijzer/Geen.png
PMD: /local/afvalwijzer/PMD.png
Papier: /local/afvalwijzer/Papier.png
Restafval: /local/afvalwijzer/Restafval.png
type: picture-entity
type: horizontal-stack
- card:
type: glance
filter:
include:
- entity_id: sensor.afvalwijzer_gft
- entity_id: sensor.afvalwijzer_plastic
- entity_id: sensor.afvalwijzer_restafval
sort:
attribute: next_pickup_in_days
method: attribute
numeric: true
type: 'custom:auto-entities'
- entities:
- sensor.afvalwijzer_next_in_days
- style:
background: '#62717b'
height: 1px
margin-left: auto
margin-right: auto
type: divider
- input_boolean.waste_moved
- input_boolean.waste_reminder
show_header_toggle: false
type: entities
type: vertical-stack
Maybe use small letters instead of capital?
you’re sure your sensor for tomorrow is called ‘sensor.afvalwijzer_next_item’ ? and not ‘sensor.afvalwijzer_morgen’. And yes, the names should be exactly as they are in your system.
check my setup:
- type: horizontal-stack
cards:
- type: picture-entity
style: |
ha-card {
box-shadow: none;
animation: {% if is_state('persistent_notification.trash_notification', '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: &state_image
gft: /local/afvalwijzer/gft.png
papier: /local/afvalwijzer/papier.png
restafval: /local/afvalwijzer/restafval.png
plastic: /local/afvalwijzer/plastic.png
Geen: /local/afvalwijzer/kliko_geen.png
unknown: /local/afvalwijzer/kliko_geen.png
- type: picture-entity
style: |
ha-card {
box-shadow: none;
animation: {% if is_state('persistent_notification.trash_notification', '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: *state_image
- type: picture-entity
style: |
ha-card {
box-shadow: none;
}
entity: sensor.afvalwijzer_day_after_tomorrow
name: Overmorgen
show_state: false
state_image: *state_image
must admit to feel it would be better if you’d try to understand what’s happening, instead of copying other peoples data directly. this is a mixed setup of core HA yaml, custom integration (also sets default icons) and local customizations , next to the integrations sensors, and user made template sensors, all with their own settings.
take it bit by bit, and try to analyze an individual item. that will help you more than asking for code, and never to look back at that because we made it work for you
Totally agree. Some attribute names changed in the last couple of updates, be aware of that.
agree. it’s what i’m trying. Hardest (no developer) is the config.yaml. Do not understand that one completely yet.
i got it working for the images now indeed. (the first part)
the second part i cant figure out yet. It shows the data, but in the wrong order and wrong(standard) icons. This is where i expect that i need to add something to config.yaml first.
card:
type: glance
filter:
include:
- entity_id: sensor.afvalwijzer_gft
- entity_id: sensor.afvalwijzer_plastic
- entity_id: sensor.afvalwijzer_restafval
type: 'custom:auto-entities'
right now, how do you think it will order them?
also, did you read the documentation of the auto-entities card? where does it mention ordering the entities and how?
at this moment not indeed. When i follow the auto-entitie documentation i should set it up like this (i think)
card:
type: glance
filter:
include:
- entity_id: sensor.afvalwijzer_gft
- entity_id: sensor.afvalwijzer_plastic
- entity_id: sensor.afvalwijzer_restafval
type: 'custom:auto-entities'
sort:
method: attribute
attribute: afvalwijzer next_in_days
numeric: true
But this changes nothing. I can find anything if i need to do/set something in config.yaml as well for this to happen.
what is the attribute you want to filter on? be precise
hint: check /developer-tools/state
also, always check in inspector for errors