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

Locks don't expose action, action_source, or action_source_name #3938

Closed
wixoff opened this issue Feb 28, 2022 · 4 comments
Closed

Locks don't expose action, action_source, or action_source_name #3938

wixoff opened this issue Feb 28, 2022 · 4 comments

Comments

@wixoff
Copy link
Contributor

wixoff commented Feb 28, 2022

The converters in /z-h-c/devices/ capture this data and send it via MQTT, but it's not exposed for discovery in Home Assistant.

I have three Kwikset locks: one has a keypad (and is recognized as a Weiser 9GED18000-009), the other two are conversion deadbolts (both Kwikset 66492-001). They work very reliably with zigbee2mqtt, but there is significant functionality that -- in Home Assistant -- needs to be captured in manually-configured MQTT sensors, followed by additional processing (see below for details). This situation appears to be true for the converters for other lock manufacturers as well, including Schlage and Yale.

The currently exposed values capture lock state, battery, and apparently PIN code info (the last category I don't use).

However, there are no exposed values corresponding to action, action_source, or action_source_user.

First, action is one of the following values (from /z-h-c/converters/fromZigbee.js):

                0: 'unknown',
                1: 'lock',
                2: 'unlock',
                3: 'lock_failure_invalid_pin_or_id',
                4: 'lock_failure_invalid_schedule',
                5: 'unlock_failure_invalid_pin_or_id',
                6: 'unlock_failure_invalid_schedule',
                7: 'one_touch_lock',
                8: 'key_lock',
                9: 'key_unlock',
                10: 'auto_lock',
                11: 'schedule_lock',
                12: 'schedule_unlock',
                13: 'manual_lock',
                14: 'manual_unlock',
                15: 'non_access_user_operational_event',

Now action_source is one of the following (from /z-h-c/lib/constants.js):

    0: 'keypad',
    1: 'rf',
    2: 'manual',
    3: 'rfid',

And finally, there is action_source_user, which is just a numeric user ID valid only for certain action and action_source values.

One additional complication is that each of these values -- action, action_source, and action_source_user -- come through via MQTT and are subsequently immediately overwritten by blank values. That means, for each lock, and each of these values in Home Assistant, I need to (a) capture each of the updates using an MQTT sensor, and (b) provide automations that selectively transfer those sensor values into input_text fields that don't get overwritten by the blanks.

I'd be happy to help implement/test any changes needed here, but sadly the "exposes" code and how it works is beyond my understanding.

Thanks!

@Koenkk
Copy link
Owner

Koenkk commented Mar 1, 2022

Added action, action_source_name and action_source_user for the 9GED18000-009. Skipped the action_source (since this is the numerical value of action_source_name). Can you check if it works? Then I will add it for the other locks.

@wixoff
Copy link
Contributor Author

wixoff commented Mar 2, 2022

Thanks.

It looks like it's working, mostly, except that the values are all still transient - they exist only for a short fraction of a second (a tenth or less), then are replaced by:

action: Empty string("")
action_source_name: Null
action_source_user: Null

(as viewed in the Z2M frontend)

I think it would make sense for the empty strings and nulls to be ignored so the exposed values reflect the last actual lock operation. This is the way they worked in Z-wave.

@Koenkk
Copy link
Owner

Koenkk commented Mar 2, 2022

@wixoff that is expected, see https://www.zigbee2mqtt.io/guide/faq/#why-is-the-action-property-always-empty

I've added it for all locks now.

Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)

@wixoff
Copy link
Contributor Author

wixoff commented Mar 2, 2022

Terrific, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants