Two parter regarding automation conditions and enitity_id

Part one:

I’m trying to automate unlocking my door when I enter my home zone. That by itself works fine but as soon as I throw a condition on it to only run if the door is already locked the automation craps the bed with:

“ERROR (MainThread) [homeassistant.components.automation] mapping values are not allowed here
in “/config/automations.yaml”, line 80, column 14”

- alias: UnlockFrontDoorWhenHomeZone
  trigger:
    platform: zone
    entity_id: device_tracker.iphone
    zone: zone.home
    event: enter # Event is either enter or leave
  condition: state
    entity_id: lock.front_door_lock_locked
    state: "locked"
  action:
    service: lock.unlock
    entity_id: group.all_locks

That error is telling me it doesn’t like my entity_id ‘lock.front_door_lock_locked’ coming after ‘state:’ even though it’s a valid entity_id I use in other automations. So why doesn’t it like it there when I’ve seen plenty of examples like that?

Part two - minor thing that’s bugging me:

Why the heck did HA call that entity ‘lock.front_door_lock_locked’? When it can have a status of locked or unlocked? Why not just ‘lock.front_door_lock’ which is what I renamed the device to in the ZWave section?

Try single quotes round ‘locked’ instead of double quotes.

- alias: UnlockFrontDoorWhenHomeZone
  trigger:
    platform: zone
    entity_id: device_tracker.iphone
    zone: zone.home
    event: enter # Event is either enter or leave
  condition: 
    condition: state
    entity_id: lock.front_door_lock_locked
    state: "locked"
  action:
    service: lock.unlock
    entity_id: group.all_locks

Oh man. I can’t believed I missed the first condition: statement! After how long staring at online examples?

All good now.

Thanks!