Convert a duration sensor into timestamp sensor

Hello everyone,

I’ve been trying like crazy for days to convert a sensor from duration to timestamp, but something just isn’t working. Can someone tell me what’s wrong with my template?

template:
  - sensor:
      - name: "Waschmaschine Fertig um"
        state: >
          {% set restzeit_minuten = states('sensor.aeg_waschmaschine_timetoend_2') | float %}
          {% if restzeit_minuten | is_number and restzeit_minuten >= 0 %}
            {{ (now() + timedelta(minutes=restzeit_minuten)).strftime('%H:%M Uhr') }}
          {% elif restzeit_minuten < 0 %}
            {{ 'Fehler: Negative Restzeit' }}
          {% else %}
            {{ 'unknown' }}  # Rückfallwert, falls der Wert ungültig ist.
          {% endif %}
        device_class: timestamp
        attributes:
          icon: mdi:clock-check

The timestamp device class requires that the value returned by the template be either a datetime object or timestamp string… not '%H:%M Uhr', 'Fehler: Negative Restzeit', or 'unknown'