Hi,
I have the following sensor code in configuration.yaml
today:
value_template: >
{% set dayofweek = ['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][now().weekday()] %}
{% set day = ['1st','2nd','3rd','4th','5th','6th','7th','8th','9th','10th','11th','12th','13th','14th','15th','16th','17th','18th','19th','20th','21th','22th','23th','24th','25th','26th','27th','28th','29th','30th','31th' ][ now().day-1] %}
{% set month = ['January','February','March','April','May','June','July','August','September','October','November','December'][now().month-1] %}
{{ dayofweek +', '+ day + ' ' + month + ' '+ now().strftime('%Y') }}
so when i call sensor.today in an entity, it will return for instance
Tuesday, 20th April 2020.
This is all good but i find that the sensor just does not get updated like sensor.date. A restart of home assistant will of course cause sensor.today to get the correct date but come tomorrow, the sensor card is outdated again. I don’t have this ussue with sensor.date.
There are no errors in the log related to this sensor.
What am I missing in the code? How do i fix this?
Thanks!