1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
const {} = require('zigbee-herdsman-converters/lib/modernExtend');
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 ota = require('zigbee-herdsman-converters/lib/ota'); const utils = require('zigbee-herdsman-converters/lib/utils'); const globalStore = require('zigbee-herdsman-converters/lib/store'); const e = exposes.presets; const ea = exposes.access;
const fzLocal = { WSZ01_on_off_action: { cluster: '65029', type: ['attributeReport'], convert: (model, msg, publish, options, meta) => { const clickMapping = {0: 'release', 1: 'single', 2: 'double', 3: 'hold'}; return {action: `${clickMapping[msg.data[1]]}`}; }, }, };
module.exports = [ { zigbeeModel: ['wall pir'], model: 'PRZ01', vendor: 'J.XUAN', description: 'Human body movement sensor', fromZigbee: [fz.ias_occupancy_alarm_1_with_timeout, fz.battery], toZigbee: [], exposes: [e.occupancy(), e.battery_low(), e.battery()], }, { zigbeeModel: ['JD-SWITCH\u000002'], model: 'WSZ01', vendor: 'J.XUAN', description: 'Wireless switch', supports: "action, battery, linkquality", fromZigbee: [fzLocal.WSZ01_on_off_action,fz.battery], toZigbee: [], exposes: [e.action(['release', 'single', 'double', 'hold']), e.battery()], }, { zigbeeModel: ['00090bdc'], model: 'SPZ01', vendor: 'J.XUAN', description: 'plug', fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering], exposes: [e.switch(), e.power(), e.power_outage_memory().withAccess(ea.STATE_SET), e.energy()], toZigbee: [tz.on_off, tz.SPZ01_power_outage_memory], configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement']); }, }, ]
|
评论
发表评论