狄耐克DNAKE设备接入zigbee2mqtt外部转换器JS,自己摸索写出来的,有些功能报错,应该是窗帘位置信息获取问题,不影响使用。
接入只有开关设备,情景开关,窗帘三种设备,zigbee网关识别到设备名称后修改对应的js文件名和js里面的设备名,使用zigbee2mqtt版本是1.42.0,更新的版本js文件位置和支持的函数不一样,应该不能用,没有去研究。需要zigbee-herdsman-converters,文件较大附上下载链接
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 definition = {
zigbeeModel: ['HA-CTN-C30A'],
model: 'HA-CTN-C30A',
vendor: 'DNAKE',
description: '智能窗帘开关',
fromZigbee: [fz.cover_position_tilt],
toZigbee: [tz.cover_state, tz.cover_position_tilt],
exposes: [e.cover_position().withEndpoint('l1'), e.cover_position().withEndpoint('l2')],
//extend: preset.switch(),
meta: {configureKey: 1, coverInverted: true},
configure: async (device, coordinatorEndpoint, logger) => {
for (const ID of [1, 2]) {
await reporting.bind(endpoint, coordinatorEndpoint, ['closuresWindowCovering']);
//await reporting.currentPositionLiftPercentage(endpoint);
}
},
endpoint: (device) => {
return {'l1': 1, 'l2': 2};
},
};
module.exports = definition;
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 definition = {
zigbeeModel: ['HA-LGT-C30A'],
model: 'HA-LGT-C30A',
vendor: 'DNAKE',
description: '智能触摸开关',
fromZigbee: [fz.on_off, fz.command_on, fz.command_off],
toZigbee: [tz.on_off],
exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.switch().withEndpoint('l3'), e.switch().withEndpoint('l4')],
//extend: preset.switch(),
meta: {configureKey: 1, multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
for (const ID of [1, 2, 3, 4]) {
await reporting.bind(device.getEndpoint(ID), coordinatorEndpoint, ['genOnOff', 'genIdentify']);
}
},
endpoint: (device) => {
return {'l1': 1, 'l2': 2, 'l3': 3, 'l4': 4};
},
};
module.exports = definition;
zigbee-herdsman-converters下载[url]https://pan.baidu.com/s/1TSil-RLo_P_ABuXMRrPDVg?pwd=gyse 提取码: gyse[/url]
|