Show date when script last run

New to HA and try to show the date when a scrip last was run.

I have tried this, but only show None.

sensor:
  - platform: template
    sensors:
      sprinklers_last_run:
        friendly_name: 'Last Run'
        entity_id: script.start_spridare
        value_template: '{{ (as_timestamp(states.start_spridare.last_changed)) }}' #|   timestamp_custom("%A, %d %h %H:%M") }}'
  1. You need sensor.time to update the sensor. It won’t update on it’s own due to the nature of the information you are trying to display.
  2. You’re syntax was alittle off. You were missing the domain name between states and start_spridare.
  3. You should use device_class: timestamp so that it shows up nicely in the UI.
sensor:
  - platform: time_date
    display_options:
      - 'time'
  - platform: template
    sensors:
      sprinklers_last_run:
        friendly_name: 'Last Run'
        entity_id: sensor.time
        device_class: timestamp
        value_template: '{{ as_timestamp(states.script.start_spridare.last_changed) }}'

I don’t think that’s true. It should definitely find script.start_spridare and update whenever the state of the script does. Adding entity_id: sensor.time will just make it update way more often than it needs to.

And the timestamp sensor will properly update showing “x min ago” without sensor.time?

timestamp isn’t a sensor or sensor type, it’s a device class. The updating, I believe, happens in the frontend (browser, whatever.) The entity itself doesn’t have to update its state in the State Machine for the value shown in the browser to update. E.g., I have some entities for solar events (from my custom component, er, integration) that only update once a day, with a device class of timestamp, and the “x hours ago” or “in x hours” display updates as time goes by.

I’ve never used this specific device class, I wasn’t sure if it would update so I added it.