|
发表于 2021-8-11 23:21:25
|
显示全部楼层
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;
const getKey = (object, value) => {
for (const key in object) {
if (object[key] == value) return key;
}
};
const bind = async (endpoint, target, clusters) => {
for (const cluster of clusters) {
await endpoint.bind(cluster, target);
}
};
const device = {
zigbeeModel: ['1719SP-WS-01'],
model: 'SP-SK-01',
vendor: 'Spotmau',
description: 'Power plug',
supports: 'on/off',
fromZigbee: [fz.on_off],
toZigbee: [tz.on_off],
endpoint: (device) => {
return { 'top': 16 };
},
meta: { configureKey: 1, multiEndpoint: true },
configure: async (device, coordinatorEndpoint) => {
await bind(device.getEndpoint(16), coordinatorEndpoint, ['genOnOff']);
},
};
module.exports = device; |
|