|
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 e = exposes.presets;
module.exports = {
fingerprint: [
{modelID: 'TS0726', manufacturerName: '_TZ3000_xxxxxxxx'} // 改成你设备的 manufacturerName
],
model: 'TS0726_machichi_dual', // 你自己改名字
vendor: 'Macchi / Tuya',
description: 'Macchi TS0726 dual gang switch',
fromZigbee: [fz.on_off],
toZigbee: [tz.on_off],
exposes: [
e.switch().withEndpoint('left').withDescription('Left button'),
e.switch().withEndpoint('right').withDescription('Right button'),
],
endpoint: (device) => {
return {
left: 1,
right: 2,
};
},
meta: {multiEndpoint: true},
configure: async (device, coordinatorEndpoint, logger) => {
// 解绑默认绑定,防止两个按键联动
for (const ep of [1, 2]) {
try {
const endpoint = device.getEndpoint(ep);
await endpoint.unbind('genOnOff', coordinatorEndpoint);
logger.info(`Unbound endpoint ${ep} from coordinator`);
} catch (err) {
logger.warn(`Failed to unbind endpoint ${ep}: ${err}`);
}
}
},
};
|
|