mcnutter1/homeasssitant-schlage

Lock lock/unlock feature

Opened this issue · 4 comments

Hi..

Just installed this on HA 2022.10.4 and it's working great getting the lock status, however the lock/unlock from HA doesn't work.

I can't find where the locker pin should be configured to enable it (if required)

Current HW setup

Schalage Wi-Fi Adapter
Schalage Sense locker (be479cen619)

Locker connected to the Wi-Fi adapter (not to homekit).

HA integration ( "version": "1.0") added to the custon_components/homeasssitant-schlage folder

This was only tested with Schlage Encode locks, there is no pin required to send the lock / unlock commands. If there is a way to pass it in the API I can add it into the code.

I've finally got mitm-proxy installed to test this out on my Sense/BR400 bridge. The unlock/lock commands seem to be a POST instead of a PUT to https://api.allegion.yonomi.cloud/v1/devices/{deviceID}/commands
and the JSON data is a lot more involved.

{
    "data": {
        "CAT": "{CAT variable from GET command}",
        "deviceId": "{deviceID}",
        "state": 1,
        "userId": "{userid}"
    },
    "name": "changelockstate"
}

So, this will need to be updated on the new_api.py under the async def _change_lockstate(self, deviceId, lockState):

I think URI = "https://{}/{}".format(self.LOCK_STATE_URL,deviceId) will need to include the commands and the name: changelockstate...

I have limited experience with this, but I will have a look and will try to run some test

Found a fork dknowles2 that fix the problem and allow the lock status to be changed from HA.

@dknowles2 Kudos and thanks for the fix