HA automation with Nuki Smartlock

Hello,

I have created an authorization with a door sensor connected to my nuki smartlock so that the door locks every time the sensor detects the door close so I don’t need to spend 50 euros on the Nuki sensor which does the same and is slower because it takes 20 seconds to update.

Automation is this but I would like to add that the nuki does not close when the door is open , but I can not find how todo it, someone can help me?
cheers.

alias: Nuki allways lock at 9:00 to 15:00
description: ""
trigger:
  - type: not_opened
    platform: device
    device_id: xxx
    entity_id: xxx
    domain: binary_sensor
condition:
  - condition: time
    after: "09:00:00"
    before: "15:00:00"
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
      - sat
      - sun
action:
  - action: lock.lock
    metadata: {}
    data: {}
    target:
      device_id: xxx
  mode: single

Hi Marcos, can’t you use the entity as the trigger and use from open to closed as a trigger?