Create automation that locks door on dashboard?

Hey,

i need help.
For my security in my home i need a button on my dashboard. I have Homematic IP for this.
So i want an automation thats lock my door if the door sensor is closed. Thats not the problem. I want a button on the default dashboard. I have a wall panel at the door. If i go out and push the button the door closed if the sensor is on “closed”. I want that the boolean reset after 5 Minutes automatically.
I dont want that the door closed every time if the sensor goes on closed, so i need a trigger that resets after X minutes (or seconds). THats my automation. Thats locks door every time.

I need an “And if” trigger on the dashboards thats reset after time.

Please post the correctly-formatted YAML code for your automation.

description: "Button: Tür Auto schließen"
mode: single
trigger:
  - type: not_opened
    platform: device
    device_id: 247ef61f6ecb0d7c2296b5b7cce76802
    entity_id: a1c10ea736a385c9e238a5af7d763317
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: 10
condition: []
action:
  - device_id: 6a7b8ff64e8387fd5a51e1f6a7a6e2cd
    domain: lock
    entity_id: 401eb9969fe1dea28f60bb30d508e97d
    type: lock

I’m finding it hard to understand this. You have:

  • a door sensor, which is the binary sensor in your trigger
  • a door lock, which is the lock in the action.

This automation operates the lock when the door has been closed for 10 seconds.

Correct?

I don’t understand:

  • what the button on the wall panel is or does (real button?);
  • if you have or want control over the movement of the door in HA;
  • what you want the button on your dashboard to do.

What is the “boolean” that you want reset after 5 minutes?

I’m sure we can do this, but I’m not quite clear on what “this” actually is yet.

  • a door sensor, which is the binary sensor in your trigger
    Exactly. The sensor detects whether the door is open or closed

  • a door lock, which is the lock in the action.
    The door should be locked at the end of automation.

  • what the button on the wall panel is or does (real button?);
    The button should set a value to “True” or “False”, which I can incorporate into the automation. The automation currently works in such a way that the door is always locked as soon as the sensor detects that the door has been closed.

For this i have 2 devices from Homematic IP
Homematic IP Door Lock Drive
That locks the door.

Homematic IP Window and door contact – optical
Thats detect if the door open or close

The simplest thing to set up is an Input Boolean (Toggle) helper.

You can then create an automation that turns this off if it has been on for 5 minutes:

trigger:
  - platform: state
    entity_id: input_boolean.ID
    to: 'on'
    for: "00:05:00"
action:
  - service: input_boolean.turn_off
    target:
      entity_id: input_boolean.ID

In your main automation, I’d recommend using entity state triggers and actions rather than the device triggers and actions you currently have. It’s much easier to observe and debug these. So:

description: "Button: Tür Auto schließen"
mode: single
trigger:
  - platform: state
    entity_id: binary_sensor.DOOR_ID
    for:
      seconds: 10
action:
  - service: lock.lock
    target:
      entity_id: lock.LOCK_ID
1 Like

Perfect. That works. Thank you :slight_smile:

1 Like