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

add another Yale SL lock model #7330

Merged
merged 1 commit into from Apr 4, 2024
Merged

add another Yale SL lock model #7330

merged 1 commit into from Apr 4, 2024

Conversation

Ryan6578
Copy link
Contributor

@Ryan6578 Ryan6578 commented Apr 4, 2024

Add an additional model for Yale's line of locks.

Before the changes, the device was listed as unsupported:
Zigbee2MQTT:info 2024-04-04 02:52:22: 0x000d6f0018ada8d8 (0x000d6f0018ada8d8): Not supported (EndDevice)

After this change, the device is now recognized:
Zigbee2MQTT:info 2024-04-04 02:54:01: 0x000d6f0018ada8d8 (0x000d6f0018ada8d8): YAYRD256HA2619 - Yale Assure lock SL (EndDevice)

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented Apr 4, 2024

In the middle of fully testing this, so please don't merge until I verify everything works!

@Koenkk Koenkk merged commit e437ee0 into Koenkk:master Apr 4, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Apr 4, 2024

Thanks!

@Ryan6578
Copy link
Contributor Author

Hi @Koenkk. It looks like commands to lock/unlock the lock are being correctly sent, but the status of the lock is not reported automatically. I have to manually click the refresh button in order for the state to update:
nostatus
statusupdated

@Koenkk
Copy link
Owner

Koenkk commented Apr 10, 2024

Can you configure the device through the frontend? Press the yellow reconfigure button, if it fails, make sure to wake-up the device right before doing this.

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented Apr 10, 2024

This is what I get when trying to reconfigure (even after waking up the device right before the reconfigure):

zigbee2mqtt    | [2024-04-10 13:33:16] info: 	z2m: Configuring '0x000d6f0018ada8d8'
zigbee2mqtt    | [2024-04-10 13:33:40] error: 	z2m: Failed to configure '0x000d6f0018ada8d8', attempt 1 (Error: ZCL command 0x000d6f0018ada8d8/1 closuresDoorLock.configReport([{"attribute":"lockState","minimumReportInterval":0,"maximumReportInterval":3600,"reportableChange":0}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 26565 - 1 - 7 - 257 - 7 after 10000ms)
zigbee2mqtt    |     at Object.start (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:63:23)
zigbee2mqtt    |     at ZStackAdapter.sendZclFrameToEndpointInternal (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:497:47)
zigbee2mqtt    |     at Queue.execute (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:35:20)
zigbee2mqtt    |     at Request.send (/app/node_modules/zigbee-herdsman/src/controller/helpers/request.ts:79:20)
zigbee2mqtt    |     at Endpoint.zclCommand (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:756:28)
zigbee2mqtt    |     at Endpoint.configureReporting (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:557:9)
zigbee2mqtt    |     at Object.lockState (/app/node_modules/zigbee-herdsman-converters/src/lib/reporting.ts:78:5)
zigbee2mqtt    |     at configure (/app/node_modules/zigbee-herdsman-converters/src/devices/yale.ts:26:13)
zigbee2mqtt    |     at Object.configure (/app/node_modules/zigbee-herdsman-converters/src/index.ts:164:21)
zigbee2mqtt    |     at Configure.configure (/app/lib/extension/configure.ts:121:13))
zigbee2mqtt    | [2024-04-10 13:33:40] info: 	z2m: Configuring '0x000d6f0018ada8d8'
zigbee2mqtt    | [2024-04-10 13:34:04] error: 	z2m: Failed to configure '0x000d6f0018ada8d8', attempt 2 (Error: ZCL command 0x000d6f0018ada8d8/1 closuresDoorLock.configReport([{"attribute":"lockState","minimumReportInterval":0,"maximumReportInterval":3600,"reportableChange":0}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 26565 - 1 - 9 - 257 - 7 after 10000ms)
zigbee2mqtt    |     at Object.start (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:63:23)
zigbee2mqtt    |     at ZStackAdapter.sendZclFrameToEndpointInternal (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:497:47)
zigbee2mqtt    |     at Queue.execute (/app/node_modules/zigbee-herdsman/src/utils/queue.ts:35:20)
zigbee2mqtt    |     at Request.send (/app/node_modules/zigbee-herdsman/src/controller/helpers/request.ts:79:20)
zigbee2mqtt    |     at Endpoint.zclCommand (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:756:28)
zigbee2mqtt    |     at Endpoint.configureReporting (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:557:9)
zigbee2mqtt    |     at Object.lockState (/app/node_modules/zigbee-herdsman-converters/src/lib/reporting.ts:78:5)
zigbee2mqtt    |     at configure (/app/node_modules/zigbee-herdsman-converters/src/devices/yale.ts:26:13)
zigbee2mqtt    |     at Object.configure (/app/node_modules/zigbee-herdsman-converters/src/index.ts:164:21)
zigbee2mqtt    |     at Configure.configure (/app/lib/extension/configure.ts:121:13))

@Koenkk
Copy link
Owner

Koenkk commented Apr 11, 2024

Does it work when moving the device close to the coordinator? It looks like the device doesn't respond.

@Ryan6578
Copy link
Contributor Author

I don't think it's an issue with distance. It's already rather close, and this used to work with the external converter with no issues. Is there anything else I can try?

@Koenkk
Copy link
Owner

Koenkk commented Apr 13, 2024

Can you provide the external converter here?

@Ryan6578
Copy link
Contributor Author

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/modernExtend');
const e = exposes.presets;
const ea = exposes.access;

const lockExtend = (meta, lockStateOptions=null, binds=['closuresDoorLock', 'genPowerCfg']) => {
    return {
        fromZigbee: [fz.lock, fz.battery, fz.lock_operation_event, fz.lock_programming_event, fz.lock_pin_code_response,
            fz.lock_user_status_response, fzLocal.c4_lock_operation_event],
        toZigbee: [tz.lock, tz.pincode_lock, tz.lock_userstatus, tz.lock_auto_relock_time, tz.lock_sound_volume],
        meta: {pinCodeCount: 250, ...meta},
        exposes: [e.lock(), e.battery(), e.pincode(), e.lock_action(), e.lock_action_source_name(), e.lock_action_user(),
            e.auto_relock_time().withValueMin(0).withValueMax(3600), e.sound_volume(), e.battery_low()],
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, binds);
            await reporting.lockState(endpoint, lockStateOptions);
            await reporting.batteryPercentageRemaining(endpoint);
            try {
                await reporting.batteryAlarmState(endpoint);
            } catch (e) {
                // Fails for some: https://github.com/Koenkk/zigbee-herdsman-converters/pull/5414
            }
        },
    };
};

const fzLocal = {
    c4_lock_operation_event: {
        cluster: 'genAlarms',
        type: ['commandAlarm'],
        convert: async (model, msg, publish, options, meta) => {
            let result = {};
            if (msg.data.clusterid == 64512) {
                const alarmcode = msg.data.alarmcode;
                const lookup = {
                    9: {action: 'error_jammed', state: 'UNLOCK', lock_state: 'not_fully_locked'},
                    21: {action: 'manual_lock', state: 'LOCK', lock_state: 'locked'},
                    22: {action: 'manual_unlock', state: 'UNLOCK', lock_state: 'unlocked'},
                    24: {action: 'lock', state: 'LOCK', lock_state: 'locked'},
                    25: {action: 'unlock', state: 'UNLOCK', lock_state: 'unlocked'},
                    27: {action: 'auto_lock', state: 'LOCK', lock_state: 'locked'},
                };
                if (!lookup[alarmcode]) {
                    result.action = 'unknown';
                    meta.logger.warn(`zigbee-herdsman-converters:Yale Lock: Unrecognized Operation Event (${alarmcode})`);
                    // We need to read the lock state as the alarm code is unknown
                    try {
                        await msg.endpoint.read('closuresDoorLock', ['lockState']);
                    } catch (error) {
                        meta.logger.warn(`zigbee-herdsman-converters:Yale Lock: failed to read lock state`);
                    }
                } else {
                    result = lookup[alarmcode];
                }
            }
            return result;
        },
    },
};

module.exports = [
    {
	zigbeeModel: ['YRD256-TSDB'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
    	model: 'YAYRD256HA2619', // Vendor model number, look on the device for a model number
    	vendor: 'Yale', // Vendor of the device (only used for documentation and startup logging)
    	description: 'Assure Lock SL', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    	extend: lockExtend(),
    },
    {
        fingerprint: [{
            type: 'EndDevice',
            manufacturerName: 'Yale',
            manufacturerID: 43690,
            powerSource: 'Battery',
            endpoints: [
                {ID: 1, profileID: 260, deviceID: 10, inputClusters: [0, 9, 10, 257, 64512, 1], outputClusters: []},
                {ID: 196, profileID: 260, deviceID: 10, inputClusters: [1], outputClusters: []},
            ]},
        ],
        model: 'ZYA-C4-MOD-S',
        vendor: 'Yale',
        description: 'Control4 module for Yale KeyFree/Keyless/Doorman/Assure/nexTouch locks',
        fromZigbee: [fz.lock, fzLocal.c4_lock_operation_event],
        toZigbee: [tz.lock],
        exposes: [e.lock(), e.lock_action()],
    },
];

@Koenkk
Copy link
Owner

Koenkk commented Apr 15, 2024

Could you provide the herdsman debug log when configuring it with this converter?

See this on how to enable the herdsman debug logging. Note that this is only logged to STDOUT and not to log files.

@Ryan6578
Copy link
Contributor Author

Apologies for the delay, @Koenkk. I've been away for a bit and just got back to be able to do this. Attached is the log file with debug enabled.
log.txt

@Koenkk
Copy link
Owner

Koenkk commented Apr 27, 2024

With the external converter the configure also seems to fail:

z2m: Failed to configure '0x000d6f0018ada8d8', attempt 1 (Error: ZCL command 0x000d6f0018ada8d8/1 closuresDoorLock.configReport([{"attribute":"lockState","minimumReportInterval":0,"maximumReportInterval":3600,"reportableChange":0}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Timeout - 26565 - 1 - 3 - 257 - 7 after 10000ms)

But does the lock state reporting work?

@Ryan6578
Copy link
Contributor Author

Lock state reporting works only after manually refreshing. But it doesn't automatically refresh when you lock/unlock.

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented Apr 28, 2024

I've also tried power cycling, factory resetting, leaving/joining the Zigbee network multiple times, and none of those seems to fix the issue either.

That lock used to work with the external converter until the breaking update that for some external converters.

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented May 3, 2024

@Koenkk - Just wanted to ping here to see if you had any more suggestions. Thanks for all the help thus far!

@Koenkk
Copy link
Owner

Koenkk commented May 4, 2024

That lock used to work with the external converter until the breaking update that for some external converters.

Could you go back to a previous z2m release and provide the logging where the configure reporting starts to work? I don't understand why this broke with a z2m update.

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented May 4, 2024

Here's the log file. Looks like the configure fails (both in the logs and in the web UI), but the lock functions 100%. Lock state is automatically reported and locking/unlocking works as well. The IEEE address of the lock is 0x000d6f0018ada8d8 and the version of zigbee2mqtt I used to get these logs is koenkk/zigbee2mqtt:1.35.3.

log2.txt

@Koenkk
Copy link
Owner

Koenkk commented May 5, 2024

Interesting because it does exactly the same thing and fails with the exact same error. After updating to 1.37.0 now, does the lock still reports it's state changes?

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented May 5, 2024

I tried with 1.37.0, 1.36.1, and 1.36.0. It seems it last works with 1.36.0. Version 1.36.1 breaks the automatic state reporting. I can still lock/unlock the lock, but the state doesn't automatically update. I have to go into the front end and manually refresh the state for it to update.

@Koenkk
Copy link
Owner

Koenkk commented May 5, 2024

Could you provide the debug logging when unlocking/locking with:

  • 1.36.0 -> state is published
  • 1.37.0 -> state is not published

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented May 6, 2024

Here's the logs for both. I locked/unlocked a few times for each. Thanks again!

1.37.0.log
1.36.0.log

@Koenkk
Copy link
Owner

Koenkk commented May 7, 2024

Pushed a fix, let me know if it works. Configure should also succeed now

Changes will be available in the dev branch in a few hours from now.

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented May 7, 2024

You're awesome. Will check shortly! Thank you! :)

@Ryan6578
Copy link
Contributor Author

Ryan6578 commented May 7, 2024

@Koenkk - Just tested. State updates automatically now both on lock/unlock and manually locking/unlocking.

Thank you very much for all your help and hard work! Definitely greatly appreciated! :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants