Hello all,
I’m trying to add a date and time on a card.
Because I’m Dutch-speaking, I have a function to translate this info to Dutch.
(and for the time, I also want to add the weeknumber and daynumber)
This is all working fine, but my time only gets updated periodically, not every minute.
I have this in my configuration.yaml, to have a date and a time sensor.
- platform: time_date
display_options:
- 'date'
- 'time'
Furthermore, I have this in my template/sensors section:
template:
sensors:
datum_nederlands:
value_template: >-
{% set months = ["januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"] %}
{% set month = months[now().strftime('%m') | int -1] %}
{% set days = ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"] %}
{% set day = days[now().strftime('%w') | int] %}
{{ day + ', ' + now().strftime('%d') + ' ' + month + ' ' + now().strftime('%Y') }}
friendly_name: 'datum nederlands'
tijd_nederlands:
value_template: >-
{{ ' (W' + now().strftime('%U') + '/D' + now().strftime('%j') + ') ' + now().strftime('%H') + ':' + now().strftime('%H') }}
friendly_name: 'tijd nederlands'
This is giving the data that I want, only, it’s not updated every minute
I tried to add {% set x = sensor.time %} for the time-piece and {% set x = sensor.date %} for the date-piece, but this gives me an error.
Can someone please help me out with this ?
Thank you & best regards from Belgium,
Kris