Help with conditional light automation

I have an automation that runs when a light is turned on to reset the light to a default brightness and colour. I want to set a condition in the automation such that it only runs if the light has been off for more than an hour.

I tried the following with just a delay of 10 seconds but the automation never runs no mater how long the light has been off for:

  condition:
    condition: state
    entity_id: light.dining
    state: 'off'
    for:
      seconds: 10

I also tried the following from another thread but had no luck either (it’s a bit beyond me), the automation never ran:

  condition:
    condition: template
    value_template: '{% if states.light.dining.last_changed  %}{{(as_timestamp(now())-as_timestamp(states.light.dining.last_changed)) > 10 }}{% else %}True{% endif %}'

It would be really useful if there was an easy way to set a condition in an automation that only allows it to run if a given state hasn’t changed for at least a given duration.

This seems to be working for me for now:

>   condition:
>     condition: template
>     value_template: '{% if trigger.from_state.last_changed  %}{{(as_timestamp(now())-as_timestamp(trigger.from_state.last_changed)) > 10 }}{% else %}False{% endif %}'