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 e = exposes.presets;
const ea = exposes.access;
const fzLocal = {
Samsung_easycode_action: {
cluster: 'closuresDoorLock',
type: 'raw',
convert: (model, msg, publish, options, meta) => {
const lookup = {
10: 'lock',
14: 'inside_unlock',
2: 'unlock',
4: 'finger_unlock',
3: 'rfid_unlock',
0: 'keypad_unlock',
};
const result = {};
const value = lookup[msg.data[4]];
if (value == 'lock') {
return {action: value};
return {lock_state: locked};
return {state: LOCK};
} else if (value == 'inside_unlock') {
return {action: value};
return {lock_state: unlocked};
return {state: UNLOCK};
} else {
return {action: lookup[msg.data[3]]};
}
},
},
}
const definition = {
zigbeeModel: ['SHS-ADT300'], // The model ID from: Device with modelID 'lumi.sens' is not supported.
model: 'SHP-DP728', // Vendor model number, look on the device for a model number
vendor: 'SAMSUNG SDS', // Vendor of the device (only used for documentation and startup logging)
description: 'Smart Lock', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
fromZigbee: [fzLocal.Samsung_easycode_action, 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], // Should be empty, unless device can be controlled (e.g. lights, switches).
meta: {battery: {voltageToPercentage: '3V_2100'}},
exposes: [e.lock(), e.battery(), e.pincode()], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
};
configure: async (device, coordinatorEndpoint, logger) => {
// Device advertises itself as Router but is an EndDevice
device.type = 'EndDevice';
device.save();
},
module.exports = definition;
Logs:
debug 2021-11-06 07:05:12: Received Zigbee message from 'DOORLOCK', type 'raw', cluster 'closuresDoorLock', data '{"data":[9,127,32,2,14,255,255,0,195,50,134,97],"type":"Buffer"}' from endpoint 1 with groupID 0
info 2021-11-06 07:05:12: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"inside_unlock","battery":100,"linkquality":94,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 07:05:12: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"","battery":100,"linkquality":94,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 07:05:12: MQTT publish: topic 'zigbee2mqtt/DOORLOCK/action', payload 'inside_unlock'
debug 2021-11-06 07:05:18: Received Zigbee message from 'DOORLOCK', type 'raw', cluster 'closuresDoorLock', data '{"data":[9,0,32,2,10,255,255,0,202,50,134,97],"type":"Buffer"}' from endpoint 1 with groupID 0
info 2021-11-06 07:05:18: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"lock","battery":100,"linkquality":110,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 07:05:18: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"","battery":100,"linkquality":110,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 07:05:18: MQTT publish: topic 'zigbee2mqtt/DOORLOCK/action', payload 'lock'
debug 2021-11-06 07:06:12: Received Zigbee message from 'DOORLOCK', type 'attributeReport', cluster 'closuresDoorLock', data '{"lockState":1}' from endpoint 1 with groupID 0
info 2021-11-06 07:06:12: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"battery":100,"linkquality":110,"lock_state":"locked","state":"LOCK","voltage":8800}'
debug 2021-11-06 07:33:52: Received Zigbee message from 'DOORLOCK', type 'attributeReport', cluster 'closuresDoorLock', data '{"lockState":1}' from endpoint 1 with groupID 0
info 2021-11-06 07:33:52: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"battery":100,"linkquality":107,"lock_state":"locked","state":"LOCK","voltage":8800}'
debug 2021-11-06 16:37:45: Received Zigbee message from 'DOORLOCK', type 'raw', cluster 'closuresDoorLock', data '{"data":[9,23,32,3,2,1,0,0,246,184,134,97],"type":"Buffer"}' from endpoint 1 with groupID 0
info 2021-11-06 16:37:45: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"rfid_unlock","battery":100,"linkquality":118,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 16:37:45: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"","battery":100,"linkquality":118,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 16:37:45: MQTT publish: topic 'zigbee2mqtt/DOORLOCK/action', payload 'rfid_unlock'
debug 2021-11-06 16:37:52: Received Zigbee message from 'DOORLOCK', type 'raw', cluster 'closuresDoorLock', data '{"data":[9,24,32,2,10,255,255,0,254,184,134,97],"type":"Buffer"}' from endpoint 1 with groupID 0
info 2021-11-06 16:37:52: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"lock","battery":100,"linkquality":110,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 16:37:52: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"","battery":100,"linkquality":110,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 16:37:52: MQTT publish: topic 'zigbee2mqtt/DOORLOCK/action', payload 'lock'
debug 2021-11-06 16:47:23: Received Zigbee message from 'DOORLOCK', type 'attributeReport', cluster 'closuresDoorLock', data '{"lockState":1}' from endpoint 1 with groupID 0
info 2021-11-06 16:47:23: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"battery":100,"linkquality":102,"lock_state":"locked","state":"LOCK","voltage":8800}'
debug 2021-11-06 17:15:03: Received Zigbee message from 'DOORLOCK', type 'attributeReport', cluster 'closuresDoorLock', data '{"lockState":1}' from endpoint 1 with groupID 0
info 2021-11-06 17:15:03: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"battery":100,"linkquality":102,"lock_state":"locked","state":"LOCK","voltage":8800}'
debug 2021-11-06 19:00:51: Received Zigbee message from 'DOORLOCK', type 'raw', cluster 'closuresDoorLock', data '{"data":[9,31,32,2,14,255,255,0,129,218,134,97],"type":"Buffer"}' from endpoint 1 with groupID 0
info 2021-11-06 19:00:51: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"inside_unlock","battery":100,"linkquality":76,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 19:00:51: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"","battery":100,"linkquality":76,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 19:00:51: MQTT publish: topic 'zigbee2mqtt/DOORLOCK/action', payload 'inside_unlock'
debug 2021-11-06 19:00:58: Received Zigbee message from 'DOORLOCK', type 'raw', cluster 'closuresDoorLock', data '{"data":[9,32,32,2,10,255,255,0,136,218,134,97],"type":"Buffer"}' from endpoint 1 with groupID 0
info 2021-11-06 19:00:58: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"lock","battery":100,"linkquality":105,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 19:00:58: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"action":"","battery":100,"linkquality":105,"lock_state":"locked","state":"LOCK","voltage":8800}'
info 2021-11-06 19:00:58: MQTT publish: topic 'zigbee2mqtt/DOORLOCK/action', payload 'lock'
debug 2021-11-06 19:03:07: Saving state to file /config/zigbee2mqtt/state.json
debug 2021-11-06 19:05:47: Received Zigbee message from 'DOORLOCK', type 'attributeReport', cluster 'closuresDoorLock', data '{"lockState":1}' from endpoint 1 with groupID 0
info 2021-11-06 19:05:47: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"battery":100,"linkquality":107,"lock_state":"locked","state":"LOCK","voltage":8800}'
debug 2021-11-06 19:33:27: Received Zigbee message from 'DOORLOCK', type 'attributeReport', cluster 'closuresDoorLock', data '{"lockState":1}' from endpoint 1 with groupID 0
info 2021-11-06 19:33:27: MQTT publish: topic 'zigbee2mqtt/DOORLOCK', payload '{"battery":100,"linkquality":107,"lock_state":"locked","state":"LOCK","voltage":8800}'