Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switchbot Lock Pro: Lock/unlock/open issue #121165

Closed
Chris-126 opened this issue Jul 4, 2024 · 9 comments
Closed

Switchbot Lock Pro: Lock/unlock/open issue #121165

Chris-126 opened this issue Jul 4, 2024 · 9 comments

Comments

@Chris-126
Copy link

The problem

Finally with HA 2024.7 my Switchbot Lock Pro apeared as bluetooth device. As the already available matter integration does only support lock/unlock feature and does not provide any more information (like battery status etc.) I was looking forward to try the bluetooth based integration. As expected there are more entities provided which helps me to keep track of i.e. the battery level.

However, the switchbot app allows to lock the door and to unlock or open if the doors has a door latch.
I would like to have the option to simply unlock the door instead of opening it, to implement an automation for overnight locking/unlocking.

Currently the lock.unlock service and the provided buttons in the matter and bluetooth based integration both would open the door completly. I don't want my door being opened automatically ;)

So, I actually remember watching a video related to "Switchbot Lock" which had the option available (Home Assistant bluetooth integration). So, how can I have/activate this for the Switchbot Lock Pro, too?

Ah, one thing might be involved... I cannot use the door closed sensor, as the magnet cannot be applied within range. The door frame is too far away. I don't know, if this is affecting the unlock/open feature. It does not in the Switchbot App, I can use open/unlock as expected.

Also, there service lock.lock and lock.unlock is available for this device but lock.open is not.

Thanks in advance for your replies and evaluations!
Best regards
Christian

What version of Home Assistant Core has the issue?

core-2024.7.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SwitchBot

Link to integration documentation on our website

https://www.home-assistant.io/integrations/switchbot

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Nothing

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Jul 4, 2024

Hey there @Danielhiversen, @RenierM26, @murtas, @Eloston, @dsypniewski, mind taking a look at this issue as it has been labeled with an integration (switchbot) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of switchbot can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign switchbot Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


switchbot documentation
switchbot source
(message by IssueLinks)

@varyamereon
Copy link

@Chris-126 This should have been included as part of the addition, maybe take a look at this issue in the pySwitchbot repo?

@wunderbaum
Copy link

wunderbaum commented Jul 4, 2024

Hello,
since this morning, my lock pro appeared, too. Thanks to everybody that made that happen! Great work!
I have three states and can address them:

service: lock.unlock
service: lock.open
service: lock.lock

Here a complete yaml for a 4x-tuya-switch:

alias: Haustür öffnen
description: 
trigger:
  - platform: device
    domain: mqtt
    device_id: xyz
    type: action
    subtype: 1_single
condition: []
action:
  - service: lock.open
    metadata: {}
    data: {}
    target:
      device_id: xyz
mode: single

@bepeit01
Copy link

bepeit01 commented Jul 5, 2024

Hi everyone,
I also had the issue that the Integration opened the door instead of unlocking. By checking the logs i saw that the mdata had the latch marked as false.
Only after rebooting the Lock it reported a true and now unlocking and opening works AS expected.
So this could as Well be a Firmware issue...

@andys73
Copy link

andys73 commented Jul 16, 2024

what I see it is a status not being reported back to HA when you manually press the lock pro button. But is not all the time, is sporatic.

@andys73
Copy link

andys73 commented Jul 17, 2024

see how it behaves when you lock it unlock it via button... in both switchbot and HA

2024-07-17.at.16.49.29_d9e0de23.mp4

@andys73
Copy link

andys73 commented Jul 24, 2024

This is working perfectly since the latest release of HA!

Many thanks!

@kellertobias
Copy link

For me it’s still broken. Updated the firmware of the lock pro, updated home assistant. Removed and readied device.

Still only able to lock/unlock, but not able to unlatch/open the door.

@Pascal4Games
Copy link

For me it’s still broken. Updated the firmware of the lock pro, updated home assistant. Removed and readied device.

Still only able to lock/unlock, but not able to unlatch/open the door.

See
sblibs/pySwitchbot#233

A workarround for the moment would be to download the switchbot integration and add it as a custom integration. Downsite of the ajustment is that when you have multiple locks and not all need unlatch it doesn't work and if the dev fix the problem with unlatch it doesn't auto update.

You do have to change to files to get it to work:
manifest.json

add don't forgot the "," at the end of the last line.
"version": "1.0.8"

and in lock.py

By "def __init__" after change looks like this
        """Initialize the entity."""
        super().__init__(coordinator)
        self._async_update_attrs()
        #if self._device.is_night_latch_enabled():
        self._attr_supported_features = LockEntityFeature.OPEN

and by "async def async_unlock" after change looks like this:
        """Unlock the lock."""
        #if self._device.is_night_latch_enabled():
        self._last_run_success = await self._device.unlock_without_unlatch()
        #else:
        #    self._last_run_success = await self._device.unlock()
        self.async_write_ha_state()

Hopefully this is useful.

@joostlek joostlek closed this as completed Sep 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants