Create sensor to show other sensor last update time

So I’m trying to create a sensor that shows the last time another sensor was updated but not having much luck, my code below but its not updating and just shows ‘unknown’ Can someone point me in the right direction?

  - platform: template
    sensors:
      oil_monitor_last_update:
        friendly_name: "Oil Monitor Last Update"
        value_template: "{{ relative_time(states.sensor.oil_monitor_last_recieved.last_updated) }}"

The state is unknown until the source sensor actually updates.

It seems to update now but shows 0 seconds? above is the sensor im trying to track.

image

If I put the template into dev tools it shows the below.

I find it way easier to use a trigger-based template sensor:


template:
  - trigger:
      - platform: time_pattern
        minutes: '*' ## updates the sensor value
    sensor:
      - name: 'Oil Monitor Last Update'
        state: '{{ relative_time(states.sensor.oil_monitor_last_recieved.last_updated) }}'


I tried this based on 5 minute interval still not showing what I would expect?

image