MQTT lock.open

Dear maintainers, hope this finds you all well.
I’m switching from fhem to homeassistant and as i have my homematic devices connected to fhem i use mqtt to send cmnds to devices. what i have now i can’t use lock.open service as it is not implemented in mqtt, i get following error:

File “/usr/src/homeassistant/homeassistant/components/lock/ init .py”, line 116, in open
raise NotImplementedError()
NotImplementedError

Thank you,
mod25

Can you use the lock.unlock service?

It’s true that lock.open is not implemented in the MQTT Lock integration. However, lock.unlock is definitely available:

yes i can use lock.unlock but how do i unlatch the door?
I need lock.open service for unlatching the door as my HomeMatic Keymatic do have this feature.

I admit to not understanding the difference between lock.open and lock.unlock. The documentation doesn’t reveal the difference:

open:
  description: Open all or specified locks.
  fields:
    entity_id:
      description: Name of lock to open.
      example: "lock.front_door"
    code:
      description: An optional code to open the lock with.
      example: 1234

unlock:
  description: Unlock all or specified locks.
  fields:
    entity_id:
      description: Name of lock to unlock.
      example: "lock.front_door"
    code:
      description: An optional code to unlock the lock with.
      example: 1234

It appears to be the same action.

no sorry but it is not. unlock is that the door is “unsafe” and you can’t get into the house, open will hold the cylinder for some seconds (unlatch).
https://www.home-assistant.io/integrations/lock/ is it explained.

PH89 nailed it
lock.open is only for locks that supports opening the door by pulling the door latch

I’ll have to take your word for it because the link where you said “it is explained” doesn’t explain it. It uses the word “unlatch” with no further explanation. In fact, your explanation is more detailed than the documentation.

I currently use MQTT Lock to control a motorized deadbolt (similar to this one). If I execute lock.unlock, the deadbolt is retracted allowing for the door to be opened without entering a PIN or using the key.

How would it behave differently if MQTT Lock supported lock.open?

sorry you are right. we use in germany a lock latch as pictured Schlossfalle – Wikipedia
this latch needs to be pulled from outside (via key) and inside (key or door handle) so that the door can be opened.
if it is possible to send cmnd open via mqtt everything works great. i have already tested it via mqtt cover as entity so the lock gets open as cmnd and it does what i like to have in mqtt locks.

it will get open as cmnd and unlatch lock

I wonder if ‘schlossfalle’ is the same as ‘deadbolt’?

A deadbolt is a solid block of metal that can be extended or retracted. In the linked photo you provided, the lower rectangular metal part is what North Americans would call a deadbolt. The upper part is what is known as a ‘striker’. In North America, the location of the two parts is typically reversed (striker on the bottom, deadbolt on the top).

On my door, the striker is what simply keeps the door shut (door won’t open if someone leans on it or due to a gust of wind) but not locked. The deadbolt can be locked. It is unlocked using either a key or by entering a numeric code on a keypad (or remotely via a command). The deadbolt portion is what I refer to when I use the word “lock”. To unlock means to retract the deadbolt.

At least in the case of my door’s lock, I see little difference between “unlock” or “open”. Both operations can only do one thing and that’s to retract the deadbolt.

i think “schlossfalle” is the striker. which will be in the plate until we hit the door handle or use the key .
in my door we don’t have a handle on the outside so the striker will still be ‘active’. So to get it out the plate ‘lockbox’ the motorized lock (nuki, danalock, homematic etc.) needs to rotate a little bit so the strike be hold.
have a lock on following which show door + lock similiar to mine

Ah-hah! It not only controls the deadbolt but the striker as well. Retracting the deadbolt unlocks the door but also retracting the striker will open the door (i.e. allow the door to be pushed open without having to manually operate a knob or handle).

Thanks! Now I now understand how unlock and open can be different.

NOTE

In that video the large rectangular portion is what we call a deadbolt and the smaller, sloped portion is the striker.

Nice. Do you see a way to get it featured?

Based on my understanding of what you’ve described, the two services unlock and open control two different portions of the lock (assuming the lock has two controllable parts; my lock has only one controllable part, the deadbolt). That means it should be possible to implement lock.open for MQTT Lock which would publish open to the command_topic.

The usual way to request integration enhancements is by doing what you have already done: create a Feature Request. The hope is that a developer will see your request, agree with it, and proceed to implement it. I don’t have the programming experience to do that but hopefully someone else who does will.

Please implement the mqtt lock.open.
The open feature is the most important, as we usually never really “lock” the door if we leave for a short time. As described here in this thread, the door can’t be opened because of the “schlossfalle” or deadbolt.

atm i have to use 4 different switches which is not really convenient

##############################
#
# keyble Smartlock
#############################    

  - platform: mqtt
    name: switch_Smartlock_status
    state_topic: "keyble/00:1a:22:13:6f:d2/status"
    command_topic: "keyble/00:1a:22:13:6f:d2/command"
    payload_on: "status"

  - platform: mqtt
    name: switch_Smartlock_open
    state_topic: "keyble/00:1a:22:13:6f:d2/status"
    command_topic: "keyble/00:1a:22:13:6f:d2/command"
    payload_on: "open"
    icon: fas:lock-open

  - platform: mqtt
    name: switch_Smartlock_lock
    state_topic: "keyble/00:1a:22:13:6f:d2/status"
    value_template: "{{ value_json['lock_status'] }}"
    command_topic: "keyble/00:1a:22:13:6f:d2/command"
    state_on: "LOCKED"
    state_off: "UNLOCKED"
    payload_on: "lock"    
    payload_off: "unlock"  
    icon: fas:lock

  - platform: mqtt
    name: switch_Smartlock_unlock    
    state_topic: "keyble/00:1a:22:13:6f:d2/status"
    value_template: "{{ value_json['lock_status'] }}"
    command_topic: "keyble/00:1a:22:13:6f:d2/command"
    state_on: "UNLOCKED"
    state_off: "LOCKED"
    payload_on: "unlock"
    payload_off: "lock"      
    icon: fas:unlock-alt

all this stuff could be reduced to 1-2 elements

im using this mqtt solution

for a very good and not overpriced smartlock

fixed it in the code an made a PR

1 Like

Unfortunately the PR was not implemented. Is there any way this can be implemented?

As I wrote in my last comment on Github, I was stuck and no idea how to do the requested changes.
I know the Devs become more PRs as they can prove, but I wish they would make the last requested changes themselves.

I also try my luck and made a PR. It seems that I got a little further in the process:

Since HomeAssistant does not seem to support the OPEN state for locks, it cannot be supported. But sending an mqtt command for OPEN the lock should already help.

Wohoo, really nice! Great to see, that you hade more luck!
I was not so far aqay with my try. :slight_smile:
Is this coming with the next update?

Since I’m completely new to Home Assistant, I don’t know the release procedure and therefore don’t know when it will come. I hope it will be included in the next release.

It is in 2021.12.0b0

1 Like