// 设备定义
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"]);
}
}
};
import * as m from 'zigbee-herdsman-converters/lib/modernExtend';
import * as fz from "zigbee-herdsman-converters/converters/fromZigbee";
import * as tz from "zigbee-herdsman-converters/converters/toZigbee";
import * as exposes from "zigbee-herdsman-converters/lib/exposes";
import * as reporting from "zigbee-herdsman-converters/lib/reporting";
import * as tuya from "zigbee-herdsman-converters/lib/tuya";