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?
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.
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?
>
{% 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?
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!
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)
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!
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.
@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.
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.
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.
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?
Just starting using the integration and works pretty well, thanks! Managed to get the cards looking like this:
Was wondering if it is possible to have the same sorting functionality on a horizontal stack (or other way) to have it more look like this:
I had a similar few using the today formatted and tomorrow formatted sensors, however I would prefer not showing tomorrow if there is nothing getting picked up. Or can i modify the sensors to reflect like: today_formatted, next_formatted,