Hi all,
I wanted to show the timestamp of a sensor date in a customizes format. I found a solution, but this is a vey complicated way. If there is anyone who can shorten my code to better onde, please let me know. I think the part, do extract month, day and year from the sensor is too complicated and needs to be reworked.
Here is what I have:
DST:
{{ now().timetuple().tm_isdst > 0 }}
{%set d=(as_timestamp(states("sensor.daylight_savings_next"))|timestamp_custom('%d'))|int%}
{%set t=(as_timestamp(states("sensor.daylight_savings_next"))|timestamp_custom('%m'))|int%}
{%set y=(as_timestamp(states("sensor.daylight_savings_next"))|timestamp_custom('%Y'))|int%}
{% set dst_date = now().replace(day=d, month=t, year=y)%}
nächste Zeitumstellung:
{{ days[dst_date.weekday()]}}, {{dst_date.day | string }}. {{months[dst_date.month-1]}} {{dst_date.strftime('%Y')}}
Results: