DayofMonth sensor not update

I’m using the following sensor to get the current day of the month

- platform: template
      entity_id: sensor.time_date
      value_template: "{{ now().day }}"

Today it didn’t switch to ‘1’ as I expected, but instead stayed at 30. Running service homeassistant.update_entity sensor.dayofthemonth made the sensor change to the correct value.
Is the update no longer done automatically? I’m running version 115.6

This is what I use

platform: template
    value_template: >
        {% set x = states('') %}
        {% set suffix = ['st', 'nd', 'rd'] %}
        {% set day = now().day %}
        {% set index = 3 if day // 10 == 1 or day % 10 == 0 else (day % 10) - 1 %}
        {{ day~'th' if index > 2 else day~suffix[index] }}

A recent Home Assistant update caused us not to be able to use entity_id: anymore.

To fix it you can use what I have above or change the entity_id: to something like the set x = states etc which is now the recommended method in Home Assistant.


Thanks for sharing VPC. I’ll give it a try. Must say the ‘old’ way was easier, but others may have a different view.