How to get the relative time of the last cleaning of the vacuum cleaner?

I’m trying to set up a Vacuum Card. I need to get the relative time of last cleaning. Like last cleaning 1 hour ago. For this I use the sensor sensor.archik_last_clean_end. In another topic, I saw that such a template worked for @Stooovie. My configuration now looks like this

type: custom:vacuum-card
entity: vacuum.archik
actions:
  start:
    service: vacuum.start
    service_data:
      entity_id: vacuum.archik
stats:
  default:
    - entity_id: sensor.archik_last_clean_end
      value_template: {{ relative_time(as_datetime(states('sensor.archik_last_clean_end'))) }}
      subtitle: Last clean end

However, after saving the card configuration, I get this result

        '[object Object]': null

I get an error in the logs

homeassistant.components.websocket_api.http.connection
547406570944] Error handling message: expected str for dictionary value @ data['template']. Got {'[object Object]': None} (invalid_format) from fe80::e4cd:1fe5:c1b9:aa5

Please help to solve this problem

These options don’t work for me either

  1. value_template:'{{ relative_time(states.sensor.archik_last_clean_end)}}'

http://homeassistant.local:8123/frontend_latest/57a46f81.js:1:0 NS_ERROR_FAILURE:

  1. value_template: "{{(as_timestamp(now())-as_timestamp(states.sensor.archik_last_clean_end)) | int }}"
    http://homeassistant.local:8123/frontend_latest/a18df7ad.js:25:12597 TypeError: can’t convert undefined to object

The template works in the template editor, but not in the vacuum card

I managed to set up the correct configuration. It is worth noting that changes to the card occurred only after saving.

type: custom:vacuum-card
entity: vacuum.archik
actions:
  start:
    service: vacuum.start
    service_data:
      entity_id: vacuum.archik
stats:
  default:
    - entity_id: sensor.archik_last_clean_end
      value_template: '{{ relative_time(as_datetime(states(''sensor.archik_last_clean_end''))) }}'
      subtitle: Last clean end