mcnutter1 / homeasssitant-schlage

Schlage Encode implementation for Home Assistant
59 stars 25 forks source link

Lock lock/unlock feature #2

Open morilm opened 2 years ago

morilm commented 2 years ago

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

mcnutter1 commented 2 years ago

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.

rwoelk commented 1 year ago

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"
}
otk-morilm commented 1 year ago

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

otk-morilm commented 1 year ago

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