Template Sensor for time and Sunset/rise not available because of unit_of_measurement

Hey,

since I installed HA 2023.5.x my template sensor for correct time, sunset and sunrise with unit of measurement stopped working and showing only unknown.
in my configuration.yaml

  - platform: template
        time_correct:
          friendly_name: "Uhrzeit"
          value_template: "{{ as_timestamp(now()) | timestamp_custom('%H:%M') }}"
          icon_template: 'mdi:clock'
          unit_of_measurement: 'Uhr'

  - platform: template
        time_correct:
          friendly_name: "Uhrzeit"
          value_template: "{{ as_timestamp(now()) | timestamp_custom('%H:%M') }}"
          icon_template: 'mdi:clock'
         # unit_of_measurement: 'Uhr'

So, is this a bug or did I need to change something? Is this a problem because the time is a string?

You can no longer use a unit of measurement for sensors that have state values containing strings, only for numbers.

There would have been an error in your system log about this.