Hey,
I’m using this automation but I also get a notification when it’s “geen”.
I only want the notification when it’s something but not “geen”
Any idea how I can fix it?
Hey,
I’m using this automation but I also get a notification when it’s “geen”.
I only want the notification when it’s something but not “geen”
Any idea how I can fix it?
I fixed it myself by renaming the afvalwijzer “sensor.afvalwijzer_gft_etensresten” to “sensor.afvalwijzer_gft” in the “main_functions.py”
I added the following to the “main_functions.py” in de afvalwijzer \custom_components\afvalwijzer\common\main_functions.py
“gft & etensresten”: “gft”,
I then deleted all the “pycache” folders and restarted. Everything works fine now. I have the feeling that the code cannot handle the “&” sign in the name
Hi,
I have similar problem as a few posts above, where next_item_formated shows Geen instead of the real value. And I can’t figure out why.
- platform: template
sensors:
afvalwijzer_next_item_formatted:
value_template: >-
{% if is_state('sensor.afvalwijzer_next_type', 'gft') %}GFT
{% elif is_state('sensor.afvalwijzer_next_type', 'papier') %}Papier
{% elif is_state('sensor.afvalwijzer_next_type', 'plastic') %}Plastic
{% elif is_state('sensor.afvalwijzer_next_type', 'restafval') %}Restafval
{% else %}Geen
{% endif %}
friendly_name: "Next pickup item"
If I read it correctly, it should check if the next type is ‘plastic’, and as the value is set to ‘grofvuil, plastic, takken’, it should print Plastic, right? It works well for all other sorts of trash, only PMD is problematic.
In the lovelace it shows properly when the next pick up dates are, it shows properly that next pick-up date is in 1 day but it displays Geen instead of Plastic.
Could you give me a tip where to look for solution here?
Hi,
I also have the same problem as above.
The date of today Is 08-05-2024. But as you can see is_collection_date_today is false. But it’s true.
Is there something is can do to get it right?
could it be it has to do with this setting:
exclude_pickup_today: true
which btw is the default.
Fwiw, here its the same date and we have a pickup, and the integration mentioned it correctly.
this is my config:
sensor:
- platform: afvalwijzer
provider: mijnafvalwijzer
postal_code: !secret postcode
street_number: !secret huisnummer
date_isoformat: false
I am running 2024.12.12.beta3 though
thanks thats it indeed.
Now it shows the date of today.
Now i have to figure out how i get today instead of the date. But saw it some where in a post above.
it’s all there…
check the value of the _next_type in your states and copy/paste that in your template
currently it checks for ‘plastic’:
{% elif is_state('sensor.afvalwijzer_next_type', 'plastic') %}Plastic
and not for grofvuil, plastic, takken
as that value is not among the listed ones in your current template, it moves to the ‘else’, which returns Geen
the template can only do it;s job if You provide it with the correct keys and values
I have been running this integration for a pretty long time now. There is one thing which annoys me a little.
On the right site the date is English while my frontend is Dutch. Now I have been searching this and to Localisation fix - Feature Requests - Home Assistant Community (home-assistant.io) which shows I have to edit my template. And by the likes I don’t know how to do that. I also read through this site where it has been mentioned a few times, but can’t seem to figure out what is needed to fix this. Any pointers?
The following code is responsible for the date:
type: custom:template-entity-row
state: |
{{as_timestamp(strptime(states(config.entity),'%d-%m-%Y'))
|timestamp_custom('%-d %B')}}
you mean you want it like this?:
works with this yaml, that is in itself using the easy_time.jinja
custom_templates plugin. you can find that in HACS or link directly
Note: I am running the 2024.12.12-beta3 version of the Afvalwijzer custom component, that returns true timestamp entities.
type: custom:mod-card
card_mod:
style: |
:host {
--stack-card-gap: 0;
}
card:
type: vertical-stack
cards:
- type: custom:button-card
name: Ophaaldata
template: button_default_title
hold_action:
action: navigate
navigation_path: >
[[[ return window.location.pathname.split('/')[2] == 'kalender'
? '/ui-data/samenvatting' : null; ]]]
- type: custom:hui-element
card_type: markdown
card_mod:
style: |
ha-card.type-markdown {
box-shadow: none;
}
content: >
<font color={{states('sensor.afval_kleur')}}><ha-icon icon= {{'mdi:delete-alert' if states('sensor.afvalwijzer_vandaag') != 'geen' else 'mdi:delete-outline'}}> </ha-icon></font> Vandaag, {{states('sensor.vandaag')}}: <font color= {{states('sensor.afval_kleur')}}>**{{states('sensor.afvalwijzer_vandaag')|capitalize}}</font>**
<font color={{states('sensor.volgende_afval_kleur')}}><ha-icon icon= {{states('sensor.volgende_afval_dagen_icon')}}> </ha-icon></font> Volgende afval-ophaal over **<font color={{states('sensor.volgende_afval_kleur')}}>{{states('sensor.afvalwijzer_next_in_days')}}</font>** {{'dag' if states('sensor.afvalwijzer_next_in_days') == '1' else 'dagen'}} op:
<ha-icon icon= {{states('sensor.volgende_afval_icon')}}> </ha-icon> {{states('sensor.volgende_afval_ophaal_dag')}}: **<font color={{states('sensor.volgende_afval_kleur')}}>{{states('sensor.afvalwijzer_next_type')|capitalize}}</font>**
- type: horizontal-stack
cards:
- type: picture-entity
card_mod:
style: |
ha-card {
box-shadow: none;
animation:
{% if is_state('input_boolean.afvalwijzer_vandaag_notificatie','on')
and states('sensor.afvalwijzer_vandaag') != 'geen' -%}
blink 2s linear infinite;
{% else -%} none
{% endif %}
}
@keyframes blink {
100% {opacity: 0;}
}
entity: sensor.afvalwijzer_vandaag
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
card_mod:
style: |
ha-card {
box-shadow: none;
animation:
{% if is_state('input_boolean.afvalwijzer_morgen_notificatie','on')
and states('sensor.afvalwijzer_morgen') != 'geen' -%}
blink 2s linear infinite;
{% else -%} none
{% endif %}
}
@keyframes blink {
100% {opacity: 0;}
}
entity: sensor.afvalwijzer_morgen
name: Morgen
show_state: false
state_image: *state_image
- type: picture-entity
entity: sensor.afvalwijzer_overmorgen
card_mod:
style: |
ha-card {
box-shadow: none;
}
name: Overmorgen
show_state: false
state_image: *state_image
# - type: custom:auto-entities
# card:
# type: glance
# filter:
# exclude:
# - entity_id: sensor.afvalwijzer*next*
# - entity_id: sensor.afvalwijzer_*orgen
# - entity_id: sensor.afvalwijzer_v*
# include:
# - entity_id: sensor.afvalwijzer_*
# options:
# format: date
# sort:
# method: state
- type: custom:auto-entities
card:
type: entities
filter:
exclude:
- entity_id: sensor.afvalwijzer*next*
- entity_id: sensor.afvalwijzer_*orgen
- entity_id: sensor.afvalwijzer_v*
include:
- entity_id: sensor.afvalwijzer_*
options:
type: custom:template-entity-row
# set in customize
# 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 %}
{% from 'easy_time.jinja' import month %}
{{as_datetime(states(trash)).day}}
{{month(as_datetime(states(trash)).month)}}
{% 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(0) %}
{% set dagnummer = as_datetime(states(trash)).strftime('%w')%}
{% from 'easy_time.jinja' import weekday %}
{% set dag = weekday(dagnummer|int) %}
{% 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:
- type: custom:fold-entity-row
head:
type: section
label: Automaten
card_mod: #!secret style_label_margin
style: |
.label {
margin-left: 0px !important;
}
group_config:
state_color: true
secondary_info: last-triggered
padding: 0
entities:
- entity: input_boolean.afval_reminder
secondary_info: last-changed
- entity: input_boolean.afval_staat_voor
secondary_info: last-changed
- type: divider
- entity: automation.afval_vandaag
name: Notify vandaag
- entity: automation.afval_morgen
name: Notify morgen
- entity: automation.saver_offline
- entity: automation.reset_trash_notification
- entity: automation.mark_trash_as_moved_outside_from_notification
Yes exactly.
In your code you’ve got:
>
{% 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 %}
{% from 'easy_time.jinja' import month %}
{{as_datetime(states(trash)).day}}
{{month(as_datetime(states(trash)).month)}}
{% endif %}
When I put this in my code it only shows ‘mei’, which is a huge improvement, but I’d like the numbers as well. And thanks for the easy_time custom template.
Any thoughts on why it won’t show the date number?
is returning that day, but as said, it requires the beta version of the CC
Didn’t get the point of needing the beta, but this clearly was my mistake. I’ve installed the beta and it works like a charm. Any thoughts on why it wasn’t pushed to the stable version? Since there is a newer stable version.
Many many thanks!
Love this!
no not really, at the time xirixiz did consider it to be breaking a bit, but we still worked on those timestamp versions, because they allow for a much better usability inside HA templating (as you can see in the above card)
Suppose life got in between for him until now
Thank you! The value is changing every time, sometimes with takken, sometimes with grofvuil, sometimes with both - I could not figure it out. Now it works like a charm!
nice, glad you got it working
Hi,
I just upgraded to version 2024.06.02. After restarting HA, no pick-up dates are showing up anymore. Any ideas on what’s happening here? Solutions are welcome.
Thanks a lot!
@hermanf72 Did you check the state in the enities overview in the developer tools section? Looking at the top of your screenshot, it does show PMD and some sort of date calculation. I assume you need to modify some code as the custom component switched to a more advanced date/time solution supported by hass.
@Mariusthvdb and @mhoogenbosch can provide you more info about this topic.
Maybe usefull for others for lovelace config (take language settings into account (today vs vandaag). More details: FR change to true datetime entities (timestamp) · Issue #253 · xirixiz/homeassistant-afvalwijzer · GitHub (special thanks to @Mariusthvdb)
- type: custom:auto-entities
card:
type: glance
filter:
exclude:
- entity_id: sensor.afvalwijzer_*next*
- entity_id: sensor.afvalwijzer_day_after_tomorrow*
- entity_id: sensor.afvalwijzer_today*
- entity_id: sensor.afvalwijzer_tomorrow*
- entity_id: sensor.afvalwijzer_kerstbomen*
include:
- entity_id: sensor.afvalwijzer_*
options:
format: date
sort:
method: state
Which results in:
Hello @xirixiz,
Thank you for your quick response.
I have checked the values and they are correct. The data is being retrieved correctly. I think it is a display issue. When I replace my code with the code you provided, everything displays correctly again. However, I am now missing the nice icons that I use.
Below is the code I originally used, which no longer works correctly. Perhaps it only needs a small adjustment to get it working again. Unfortunately, my programming skills are not advanced enough for this.
- 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 dagnummer = as_timestamp(strptime(states(trash),'%d-%m-%Y'))
|timestamp_custom('%w')|int(default=0) %}
{% set dagen =
['Zondag','Maandag', 'Dinsdag', 'Woensdag','Donderdag','Vrijdag',
'Zaterdag'] %}
{% set dag = dagen[dagnummer] %}
{% 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
Would it be possible to adjust my original code? It presents the retrieved data a bit more neatly than just displaying a plain date.
You all have a nice “SUNNY” Sunday!
Greetz Herman
Hello there,
I think I may have been a bit hasty. Since the issue was bothering me, I further investigated the links provided by @xirixiz in his response to my question. Via the link FR change to true datetime entities (timestamp) · Issue #253 · xirixiz/homeassistant-afvalwijzer · GitHub, the code is shown as I also used it in my script. I hadn’t realized that this was already the modified version. I implemented the piece of code in question into my script, and now everything works like a charm. I still don’t know exactly what is changed, but it works. If someone could point out the modification to me, I would appreciate it, as I don’t see it.
My apologies for all the commotion. I should have read a bit more carefully.
Thanks again for all the information.
Greetz,
Herman
Hello,
Since a few days, I have been seeing the number of days instead of the date something is collected. I don’t know if it’s because of an update to Afvalwijzer or Home Assistant.
Can I change that back?
type: custom:auto-entities
card:
show_name: false
show_icon: true
show_state: true
type: glance
state_color: false
filter:
include:
- entity_id: sensor.afvalwijzer_gft
- entity_id: sensor.afvalwijzer_papier
- entity_id: sensor.afvalwijzer_pmd
- entity_id: sensor.afvalwijzer_restafval
sort:
attribute: days_until_collection_date
method: attribute
numeric: true
show_empty: true