As Chris said, you need to remove the quotes. However, I’d also add that it’s not advisable to look up the object in the states table; instead the trigger object is already provided and you can access the parameter directly: this. attributes.last_triggered
I’m also not sure what the intention of the first not statement is.
This is the statement I recommend when someone wants a cooldown and doesn’t want to use a delay at the end of the automation (which is fine for short cooldowns).
The not statement was to capture the first occurrence of the automation when it says “never” as last trigger time. Thank you mekaneck, I will use that.
@mekaneck has the correct answer. Lots of other examples have overly convoluted solutions as they mentioned. All you need is this.attributes.last_triggered with exactly the code in their example. It’s what I have as well and works perfectly.
Just FYI, when it says “never” because it hasn’t been run, it means the last_triggered attribute is not defined. Using not this.attributes.last_triggered will generate an error, so instead you can send it to the default filter which will prevent the error. This is why default appears in the code I recommended.