Template condition not working

I believe the below should work but i get the below error in the template editor

Error rendering template: UndefinedError: ‘homeassistant.core.State object’ has no attribute ‘last_triggered’

 automation 18:
- alias: man cave mold alert
  trigger:
    platform: numeric_state
    entity_id: sensor.mold_indicator
    above: 80
  condition:
    - condition: template
      value_template: >
        {% if states.automation.man_cave_mold_alert.last_triggered is not none %}
          {% if as_timestamp(now()) | int   -  
as_timestamp(states.automation.man_cave_mold_alert.last_triggered) | int > 7200 %} true {% 
else %} false
          {% endif %}
        {% else %}
        false
       {% endif %}
  action:
    service: notify.webpush_device
    data:
      message: "Man Cave mold warning, currently: {{ states('sensor.mold_indicator') }}%"

Does it need to be states.automation.man_cave_mold_alert.attributes.last_triggered?

yep thats it, doh dunno how i missed that out!

Easily done, done it a few times myself :stuck_out_tongue: