he’s not using that template, he’s using this one →
whoops, more needed
Yes it then showed all the once which was not overdue, so its kinda weird , now i tried the other template
Ok, so based on what you are showing me, the template is working fine.
The only overdue chore you have is the second 1. The first chore is not overdue.
If you want it to list all chores including overdue, that would be a different template.
what does this show in devtools > template
{%- set entities = [
'sensor.clean_doors',
'sensor.clean_drain',
'sensor.clean_fridge',
'sensor.clean_behind_furnitures',
'sensor.clean_humdifier'
] %}
{% set n = utcnow() %}
current time: {{ n }}
{%- for chore in entities %}
{%- set name = states[chore].name %}
{%- set state = states(chore) %}
Chore: {{ name }} || State: {{ state }} || Overdue: {{ as_datetime(state) | default(n, true) < n }}
{%- endfor %}
Ok, what am I doing wrong then
this is the code in template
{% set sensor_entities = [
'sensor.clean_doors',
'sensor.clean_drain',
'sensor.clean_fridge',
'sensor.clean_behind_furnitures',
'sensor.clean_humdifier'
] %}
{% set current_date = now().date() %}
{%- for sensor_entity in sensor_entities if as_datetime(states(sensor_entity)) > now() %}
{% set chore_name = state_attr(sensor_entity, 'friendly_name') %}
{{ "Overdue Chore: " + chore_name }}
{% else %}
{{ "No overdue chores today." }}
{%- endfor %}
Your’e not using the template I provided…
Use this
chores: |
{%- set entities = [
'sensor.clean_doors',
'sensor.clean_drain',
'sensor.clean_fridge',
'sensor.clean_behind_furnitures',
'sensor.clean_humdifier'
] %}
{%- for name in expand(entities) | selectattr('state', '<', utcnow().isoformat()) | map(attribute='name') %}
Overdue Chore: {{ name }}
{%- else %}
No overdue chores today.
{%- endfor %}
you are using >
where you should use <
Do me a favor, post the output of this:
{%- set entities = [
'sensor.clean_doors',
'sensor.clean_drain',
'sensor.clean_fridge',
'sensor.clean_behind_furnitures',
'sensor.clean_humdifier'
] %}
{{ entities | map('states') | list }}
[
"2023-10-28T15:59:57+00:00",
"2023-10-28T15:59:53+00:00",
"2023-07-30T15:59:18+00:00",
"2023-11-02T18:49:12+00:00",
"2023-08-02T13:00:51+00:00"
]
All of these datetimes are in the past. So that explains why they all show up as overdue.
yeah, exactly my point, so the template I provided 898249384 posts ago is correct. I’m not sure what you want then @larsvb88
ahh, I’m stupid and blind, of course, the due date is the date set + the cycle days - so its correct that the template is working, I just need to add the cycle days attr to the due date