FutureTense / keymaster

Home Assistant integration for managing Z-Wave enabled locks
MIT License
218 stars 44 forks source link

ISSUE: adding codes does not work for kwikset 910 #300

Closed kevincw01 closed 1 year ago

kevincw01 commented 1 year ago

Describe the bug When I add a code to any code slot and enable it, the pin status says "adding" forever. I can lock and unlock the lock manually without issue.

Environment (please complete the following information):

Logs Core:

2022-09-16 18:26:07.392 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration keymaster which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-09-16 18:26:07.395 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

zwave_jz:

2022-09-17T01:57:09.922Z CNTRLR   [Node 057] compat mapping found, treating V1 Alarm frame as Notification Repor
                                  t
2022-09-17T01:57:09.934Z CNTRLR   [Node 057] [Notification]
                                    type:   Access Control
                                    event:  Keypad lock operation
                                    userId: 0
2022-09-17T01:57:12.029Z CNTRLR   [Node 057] compat mapping found, treating V1 Alarm frame as Notification Repor
                                  t
2022-09-17T01:57:12.039Z CNTRLR   [Node 057] [Notification]
                                    type:  Access Control
                                    event: Manual unlock operation

Screenshots

ss

Additional context This lock was previously paired with a smartthings hub and the codes that were set by that integration still work. I did properly exclude the device and include it on HA and I can lock and unlock it. The codes I have not tried to set with keymaster say "deleting".

kevincw01 commented 1 year ago

Doing some additional investigation, if in developer tools I look at the state of code slot 1-9, I see all the correct codes that were previously set by smart things. This tells me that the lock was able to send the current codes to keymaster successfully. Additionally, I can use the add code to lock keymaster service in developer tools to change one of the code slots to a new unique code and that works on the lock. This tells me that keymaster can new codes to the lock successfully. So it appears my issue is with the lovelace UI. The lovelace ui came from the yaml file that was created upon install and i did a simple copy/paste so I'm not sure where to troubleshoot.

TMarzullo commented 1 year ago

I am having a similar issue: forever adding and deleting....For some of my unused slots, the code does seem to eventually get added as I tested it from the lock itself but the UI doesn't seem to reflect that. Additionally, my existing codes never pulled over.

Even more odd, when I tried to add a subordinate lock (second keymaster instance) I get one of these for each slot: image

kevincw01 commented 1 year ago

I gave up on key master and switched to "zwave js UI" add on in place of standard zwave js. 2 key things it provides, 1) you at least have access to a clunky UI to dorectly see/maintain codes if all else fails. 2) you can turn on mqtt in the addon and get access to what codes are actually in the lock after setting them so you know if it worked. Then I built my own basic Lovelace card and some loght automations to manage the codes in a user friendly way. It's working great and is reliablr but ofcourse is not as advanced as keymaster.

On Fri, Oct 7, 2022, 5:10 PM Tony Marzullo @.***> wrote:

I am having a similar issue: forever adding and deleting....For some of my unused slots, the code does seem to eventually get added as I tested it from the lock itself but the UI doesn't seem to reflect that. Additionally, my existing codes never pulled over.

Even more odd, when I tried to add a subordinate lock (second keymaster instance) I get one of these for each slot: [image: image] https://user-images.githubusercontent.com/8526092/194677201-164eae9a-f4c9-4818-b5c6-fded446a1298.png

— Reply to this email directly, view it on GitHub https://github.com/FutureTense/keymaster/issues/300#issuecomment-1272171757, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPEIY5B4JJKYZQ2TLAGBLWCC3Y3ANCNFSM6AAAAAAQO2EYQE . You are receiving this because you authored the thread.Message ID: @.***>

lotr commented 1 year ago

@FutureTense maybe I've found the issue. I'm using danalock V3 Seems like there was a breaking change somewhere in the HA / ZWaveJS.

Your current implementation of add_code:

        servicedata[ATTR_ENTITY_ID] = entity_id
        await call_service(
            hass, ZWAVE_JS_DOMAIN, SERVICE_SET_LOCK_USERCODE, servicedata
        )

Seems like SERVICE_SET_LOCK_USERCODE just adds / registers the code.

You have to call something like zwave_js.set_value afterwards with attributes below to enable it

service: zwave_js.set_value
data:
  command_class: 99
  endpoint: 0
  property: userIdStatus
  property_key: <code slot number>
  value: 1 // this sets the status from available to enabled
target:
  device_id: <my device id>
lotr commented 1 year ago

This works:

async def add_code(
    hass: HomeAssistant, entity_id: str, code_slot: int, usercode: str
) -> None:
    """Set a user code."""
    _LOGGER.debug("Attempting to call set_usercode...")

    servicedata = {
        ATTR_CODE_SLOT: code_slot,
        ATTR_USER_CODE: usercode,
    }

    if async_using_zwave_js(
        entity_id=entity_id, ent_reg=async_get_entity_registry(hass)
    ):
        servicedata[ATTR_ENTITY_ID] = entity_id
        await call_service(
            hass, ZWAVE_JS_DOMAIN, SERVICE_SET_LOCK_USERCODE, servicedata
        )
        enable_code_service_data = {
            ATTR_ENTITY_ID: entity_id,
            "command_class": 99,
            "endpoint": 0,
            "property": "userIdStatus",
            "property_key": code_slot,
            "value": 1,
        }
        await call_service(
            hass, ZWAVE_JS_DOMAIN, "set_value", enable_code_service_data
        )
    else:
        raise ZWaveIntegrationNotConfiguredError
firstof9 commented 1 year ago

That would be a bug in the zwave_js integration then as setting and clearing codes should also enable/disable the slot.

kevincw01 commented 1 year ago

When I can call the zwave_js service it sets the enable for both of my 910 kwikset locks.

On Sat, Oct 22, 2022, 11:53 AM Chris @.***> wrote:

That would be a bug in the zwave_js integration then as setting and clearing codes should also enable/disable the slot.

— Reply to this email directly, view it on GitHub https://github.com/FutureTense/keymaster/issues/300#issuecomment-1287883059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADPEI4P2R7KNDIXJPGXKSDWEQZZFANCNFSM6AAAAAAQO2EYQE . You are receiving this because you authored the thread.Message ID: @.***>

lotr commented 1 year ago

@firstof9 will you create a ticket in the integration github pages? Or should I do it?

firstof9 commented 1 year ago

@firstof9 will you create a ticket in the integration github pages? Or should I do it?

You're going to need driver logs to prove this is what's occurring, my 910 clears and sets codes fine.

tykeal commented 1 year ago

Mine clears and sets them fine too. Though I've noticed that occasionally it will get stuck with adding / deleting. Normally, when this happens I have to call the keymaster.set_code or keymaster.clear_code functions manually. What's more, is that sometimes it doesn't seem to actually take until I go change the log level of the zwave-js integration to debug level in the UI!

It's sorta weird.

firstof9 commented 1 year ago

What's more, is that sometimes it doesn't seem to actually take until I go change the log level of the zwave-js integration to debug level in the UI!

When you do this you're restarting the driver, same thing as restarting the container/addon.

tykeal commented 1 year ago

I don't think it's actually restarting the driver because I don't see anything in the logs on it rebuilding the mesh network like I do when the addon is restarted. I think it's much more like calling the logger.set_level service call to dynamically change the logging level.

firstof9 commented 1 year ago

Changing the log level in zwavejs-ui reloads the driver. Tail your logs then change the logging level, you'll see the driver reload.