New Zigbee Locks On Ali Express appearing

Thank you, no doubt people will be able to follow the relevant conversations on the z2m GitHub now.

I’m going to get another coord and setup z2m to test it

so i spent 2 hours on this so far

i can get it to connect. as unsupproted and supported by updating external converters etc

but no luck. i cannot get it to talk.

here’s what i have so far ( lots of additiona logging) ty0a01.js:

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 utils = require(‘zigbee-herdsman-converters/lib/utils’);
const e = exposes.presets;

console.log(“Loading external converter for TY0A01”);

const definition = {
zigbeeModel: [‘TY0A01’],
model: ‘TY0A01’,
vendor: ‘_TYST12_bfejtdig’,
description: ‘Automatically generated definition’,
fromZigbee: [fz.lock, fz.battery, fz.lock_operation_event, fz.lock_operation_log],
toZigbee: [
{
key: [‘state’],
convertSet: async (entity, key, value, meta) => {
console.log(Setting lock state to: ${value} for device ${meta.device.ieeeAddr});
const lockState = value.toLowerCase() === ‘lock’ ? 0 : 1;
const command = lockState === 0 ? ‘lockDoor’ : ‘unlockDoor’;
const options = utils.getOptions(meta.mapped, entity);
console.log(Sending command ${command} with options:, options);
try {
await entity.command(‘closuresDoorLock’, command, {}, options);
console.log(Command ${command} sent successfully to device ${meta.device.ieeeAddr});
} catch (error) {
console.error(Error sending ${command} to device ${meta.device.ieeeAddr}:, error);
}
return {state: {state: value.toUpperCase()}};
},
},
],
exposes: [
e.lock(),
e.battery(),
exposes.enum(‘operation_event_source’, ea.STATE, [‘manual’, ‘rfid’, ‘remote’, ‘keypad’, ‘fingerprint’]).withDescription(‘Source of lock operation event’),
exposes.text(‘operation_event_code’, ea.STATE).withDescription(‘Code of lock operation event’),
exposes.text(‘operation_event_user’, ea.STATE).withDescription(‘User that performed the lock operation’)
],
configure: async (device, coordinatorEndpoint, logger) => {
console.log(Configuring device: ${device.ieeeAddr});
const endpoint = device.getEndpoint(1);
try {
await reporting.bind(endpoint, coordinatorEndpoint, [‘closuresDoorLock’, ‘genPowerCfg’]);
await reporting.lockState(endpoint);
await reporting.batteryPercentageRemaining(endpoint);
console.log(Device configured: ${device.ieeeAddr});
} catch (error) {
console.error(Error configuring device ${device.ieeeAddr}:, error);
}
},
meta: {
battery: {
voltageToPercentage: ‘3V_2500’,
},
},
};

console.log(“External converter for TY0A01 loaded”);

module.exports = definition;

and my config yaml:

homeassistant: true
advanced:
log_level: debug
network_key:
xxxxx
homeassistant_legacy_entity_attributes: false
legacy_api: false
legacy_availability_payload: false
external_converters:

  • external-converters/TY0A01.js
    mqtt:
    server: mqtt://core-mosquitto:1883
    user: xxxxxx
    password: xxxxx
    frontend:
    port: 8099
    serial:
    port: tcp://xxxxxx
    adapter: zstack
    baudrate: 115200
    device_options:
    legacy: false
    devices:
    ‘0x142d41fffe509595’:
    friendly_name: ‘0x142d41fffe509595’

It frustrates me when companies falsely advertise their locks as Zigbee-compatible when they aren’t, or they use a substandard version of Zigbee.

Meh, Tuya, it is known.

its a shame tho as the lock is quite good. if zigbee worked - they would sell a tonne of these. (with no tuya setup)

1 Like

Yeah, tuya lock does its own thing which is why I went with the tuya homekit bridge approach

how does this approach work? what hub do you use? is it still locally controlled through HA. i assume the lock/unlock funciton doesn’t work, but that’s ok with me, i just want to be able to see the status in HA.

Pair the zigbee lock to the tuya homekit hub and control it from ha using the homekit integration.
You do get the unlock/lock function but setting up fingerprint/keypads/etc you still need to use the tuya ap

This gave me hope lol. And the tuya homekit hub can function locally and not be connected to the internet?