|
可以识别型号TS0726但是显示不支持,z2m版本是2.6,zigbee hederman是24.11,我下载的24.1的涂鸦,里面写的转换器一直无法加载,大佬能帮看看错误吗?
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 modernExtend = require('zigbee-herdsman-converters/lib/modernExtend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');
// 自定义转换器
const fzLocal = {
TS0726_action: {
cluster: "genOnOff",
type: ["commandTuyaAction"],
convert: (model, msg, publish, options, meta) => {
return {action: `scene_${msg.endpoint.ID}`};
}
}
};
const tzLocal = {
TS0726_switch_mode: {
key: ["switch_mode"],
convertSet: async (entity, key, value, meta) => {
await entity.write(0xe001, {
53280: {
value: value === "scene" ? 1 : 0,
type: 0x30
}
});
return {state: {switch_mode: value}};
}
}
};
// 设备定义
const definition = {
fingerprint: [
{
// The model ID from: Device with modelID 'TS0601' is not supported
// You may need to add \u0000 at the end of the name in some cases
modelID: 'TS0726',
// The manufacturer name from: Device with modelID 'TS0601' is not supported.
manufacturerName: '_TZ3002_ovsw7u2p',
},
],
model: "TS0726_2_switch",
vendor: "Tuya",
description: "2 gang switch with neutral wire",
fromZigbee: [fz.on_off, tuya.fz.power_on_behavior_2, fz.ignore_basic_report, fzLocal.TS0726_action],
toZigbee: [tz.on_off, tuya.tz.power_on_behavior_2, tzLocal.TS0726_switch_mode],
exposes: [
...[1, 2].map((ep) => e.switch().withEndpoint(`l${ep}`)),
...[1, 2].map((ep) => e.power_on_behavior().withEndpoint(`l${ep}`)),
...[1, 2].map((ep) => e.enum("switch_mode", access.STATE_SET, ["switch", "scene"]).withEndpoint(`l${ep}`)),
e.action(["scene_1", "scene_2"])
],
endpoint: (device) => {
return {l1: 1, l2: 2};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint) => {
await tuya.configureMagicPacket(device, coordinatorEndpoint);
for (const ep of [1, 2]) {
await reporting.bind(device.getEndpoint(ep), coordinatorEndpoint, ["genOnOff"]);
}
}
};
// 使用 CommonJS 导出方式
module.exports = definition;
|
|