Simple automation created in the UI driving me crazy

I’m new to using the automation editor in the UI but I love the simplicity; just can’t figure out what I’m doing wrong. Here’s what I’m trying to do: When the door goes from locked to unlocked wait 30 seconds and then lock the door.

I can successfully manually trigger the automation through the UI by clicking the info button and selecting “TRIGGER”. I can call the lock.lock service successfully in developer tools. But the automation won’t ever trigger by itself. What am I missing?

Trigger Type: State
Entity: lock.frontdoor_lock
From: locked
To: unlocked
For: 00:30

no conditions are set

Action Type: Call Service
Service: lock.lock
Service data: entity_id: lock.frontdoor_lock

Back in the version .7 to .8 range I had coded the same automation manually and I think this was my code. Note* the entity_id is correct in both examples. I have since changed it from lock.lock_front_door_lock to lock.frontdoor_lock

- id: '1550159043759'
  alias: Auto Lock Front Door
  - entity_id: lock.lock_front_door_lock
    for: 00:02:00
    from: locked
    platform: state
    to: unlocked
  condition: []
  - data:
      entity_id: lock.lock_front_door_lock
    service: lock.lock

The automation editor writes code in the automations.yaml. Can you post the code it created ?

I believe this means 30 minutes. The formats are HH:MM or HH:MM:SS. So if you want 30 seconds, then use For: 00:00:30.

But, yes, as @francisp suggested, it would be helpful if you could post the YAML code that the automation editor is creating for you.

To be complete the for option allows other time period formats as well. I just spelled them out in another topic, so as an FYI, see: