UNPKG

zigbee-herdsman-converters

Version:

Collection of device converters to be used with zigbee-herdsman

25 lines (23 loc) 984 B
const exposes = require('../lib/exposes'); const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/legacy').fromZigbee}; const tz = require('../converters/toZigbee'); const reporting = require('../lib/reporting'); const e = exposes.presets; module.exports = [ { zigbeeModel: ['Ninja Smart Plug'], model: 'Z809AF', vendor: 'Ninja Blocks', description: 'Zigbee smart plug with power meter', fromZigbee: [fz.on_off, fz.metering], toZigbee: [tz.on_off], configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering']); await reporting.onOff(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.instantaneousDemand(endpoint); }, exposes: [e.switch(), e.power(), e.energy()], }, ];