Hey Guys,
I have 2 years experience with HA and got quite far with a lot of Tutorials, Copy+Pase and reading in this Forum.
I now want to set a Date Helper or alternatively a Text Helper (if the Date helper doesnt work) so instead of the last Date set (lets say 11-11-2023) it shows today or yesterday if it was the day before. I Also do not mind using a Text Helper which I trigger several times a day so it checks the value of the Date Sensor (The date is set by scanning a NFC Chip) and inputs either Today, Yesterday, 2 Days ago or 3 Days ago.
I tried the format in this topic Check date against current day but it did not help me. Maybe someone can assist me here.
currently I tried this but it did not help. When I want to safe it I get this:
Message Malformed: template value is None of dictionary value @ data [‘action’][1][‘data’]
service: input_text.set_value
data:
value: "{% set days = {timedelta(days=-1): 'yesterday', timedelta(days=0): 'today', timedelta(days=-2): '2 Days ago'} %} {% set t = states('input_datetime.duschentime') %} State {{ days.get(t | as_datetime | as_local - today_at(), t) }}"
target:
entity_id: input_text.duschentext
Thanks a lot in Advance