diff --git a/include/sensors/time.yaml b/include/sensors/time.yaml new file mode 100644 index 0000000..991df8f --- /dev/null +++ b/include/sensors/time.yaml @@ -0,0 +1,14 @@ +- platform: time_date + display_options: + - 'time' + - 'date' + +- platform: template + sensors: + dato: + friendly_name: "Dagens dato" + value_template: >- + {% set timestamp = strptime(states('sensor.date'), '%Y-%m-%d').timestamp() %} + {% set weekdays_DK = ['Man', 'Tirs', 'Ons', 'Tors', 'Fre', 'Lør', 'Søn'] %} + {% set months_DK = ['Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December'] %} + {{ weekdays_DK[timestamp | timestamp_custom('%w') | int - 1] }}dag den {{ timestamp | timestamp_custom('%-d.') }} {{ months_DK[timestamp | timestamp_custom('%-m') | int - 1] }} {{ timestamp | timestamp_custom('%Y') }}