Last active
December 27, 2022 08:17
-
-
Save Koenkk/701ce7f60fe6b71879b3d445551179f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/extend'); | |
const ota = require('zigbee-herdsman-converters/lib/ota'); | |
const tuya = require('zigbee-herdsman-converters/lib/tuya'); | |
const utils = require('zigbee-herdsman-converters/lib/utils'); | |
const globalStore = require('zigbee-herdsman-converters/lib/store'); | |
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], | |
toZigbee: [tz.lock, tz.pincode_lock, tz.lock_userstatus], | |
meta: {pinCodeCount: 250, ...meta}, | |
exposes: [e.lock(), e.battery(), e.pincode(), e.lock_action(), e.lock_action_source_name(), e.lock_action_user()], | |
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); | |
}, | |
}; | |
}; | |
const definition = { | |
zigbeeModel: ['c700000202', '06ffff2029'], | |
model: 'YDF40', | |
vendor: 'Yale', | |
description: 'Real living lock / Intelligent biometric digital lock', | |
extend: lockExtend({battery: {dontDividePercentage: true}}, {max: 900}), | |
}; | |
module.exports = definition; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment