UNPKG

zigbee-herdsman-converters

Version:

Collection of device converters to be used with zigbee-herdsman

256 lines (254 loc) • 11.3 kB
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 extend = require('../lib/extend'); const e = exposes.presets; module.exports = [ { zigbeeModel: ['PM-C140-ZB'], model: 'PM-C140-ZB', vendor: 'Dawon DNS', description: 'IOT remote control smart buried-type outlet', 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()], }, { zigbeeModel: ['PM-B530-ZB'], model: 'PM-B530-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 16A', 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()], }, { zigbeeModel: ['PM-B540-ZB'], model: 'PM-B540-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 16A', fromZigbee: [fz.device_temperature, 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', 'genDeviceTempCfg']); await reporting.onOff(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.instantaneousDemand(endpoint); await reporting.deviceTemperature(endpoint); }, exposes: [e.device_temperature(), e.switch(), e.power(), e.energy()], }, { zigbeeModel: ['PM-B430-ZB'], model: 'PM-B430-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 10A', 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()], }, { zigbeeModel: ['PM-S140-ZB'], model: 'PM-S140-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 1 gang without neutral wire', extend: extend.switch(), configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint); }, }, { zigbeeModel: ['PM-S240-ZB'], model: 'PM-S240-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 2 gang without neutral wire', extend: extend.switch(), exposes: [e.switch().withEndpoint('top'), e.switch().withEndpoint('bottom')], endpoint: (device) => { return {top: 1, bottom: 2}; }, meta: {multiEndpoint: true}, configure: async (device, coordinatorEndpoint, logger) => { await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.onOff(device.getEndpoint(1)); await reporting.onOff(device.getEndpoint(2)); }, }, { zigbeeModel: ['PM-S340-ZB'], model: 'PM-S340-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 3 gang without neutral wire', extend: extend.switch(), exposes: [e.switch().withEndpoint('top'), e.switch().withEndpoint('center'), e.switch().withEndpoint('bottom')], endpoint: (device) => { return {top: 1, center: 2, bottom: 3}; }, meta: {multiEndpoint: true}, configure: async (device, coordinatorEndpoint, logger) => { await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']); await reporting.onOff(device.getEndpoint(1)); await reporting.onOff(device.getEndpoint(2)); await reporting.onOff(device.getEndpoint(3)); }, }, { zigbeeModel: ['PM-S140R-ZB'], model: 'PM-S140R-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 1 gang router without neutral wire', extend: extend.switch(), configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint); }, }, { zigbeeModel: ['PM-S240R-ZB'], model: 'PM-S240R-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 2 gang without neutral wire', extend: extend.switch(), exposes: [e.switch().withEndpoint('top'), e.switch().withEndpoint('bottom')], endpoint: (device) => { return {top: 1, bottom: 2}; }, meta: {multiEndpoint: true}, configure: async (device, coordinatorEndpoint, logger) => { await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.onOff(device.getEndpoint(1)); await reporting.onOff(device.getEndpoint(2)); }, }, { zigbeeModel: ['PM-S340R-ZB'], model: 'PM-S340R-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 3 gang without neutral wire', extend: extend.switch(), exposes: [e.switch().withEndpoint('top'), e.switch().withEndpoint('center'), e.switch().withEndpoint('bottom')], endpoint: (device) => { return {top: 1, center: 2, bottom: 3}; }, meta: {multiEndpoint: true}, configure: async (device, coordinatorEndpoint, logger) => { await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']); await reporting.onOff(device.getEndpoint(1)); await reporting.onOff(device.getEndpoint(2)); await reporting.onOff(device.getEndpoint(3)); }, }, { zigbeeModel: ['PM-S150-ZB'], model: 'PM-S150-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 1 gang router without neutral wire', extend: extend.switch(), configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint); }, }, { zigbeeModel: ['PM-S250-ZB'], model: 'PM-S250-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 2 gang without neutral wire', extend: extend.switch(), exposes: [e.switch().withEndpoint('top'), e.switch().withEndpoint('bottom')], endpoint: (device) => { return {top: 1, bottom: 2}; }, meta: {multiEndpoint: true}, configure: async (device, coordinatorEndpoint, logger) => { await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.onOff(device.getEndpoint(1)); await reporting.onOff(device.getEndpoint(2)); }, }, { zigbeeModel: ['PM-S350-ZB'], model: 'PM-S350-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 3 gang without neutral wire', extend: extend.switch(), exposes: [e.switch().withEndpoint('top'), e.switch().withEndpoint('center'), e.switch().withEndpoint('bottom')], endpoint: (device) => { return {top: 1, center: 2, bottom: 3}; }, meta: {multiEndpoint: true}, configure: async (device, coordinatorEndpoint, logger) => { await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']); await reporting.onOff(device.getEndpoint(1)); await reporting.onOff(device.getEndpoint(2)); await reporting.onOff(device.getEndpoint(3)); }, }, { zigbeeModel: ['PM-C150-ZB'], model: 'PM-C150-ZB', vendor: 'Dawon DNS', description: 'IOT remote control smart buried-type 16A outlet', 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()], }, { zigbeeModel: ['SG-V100-ZB'], model: 'SG-V100-ZB', vendor: 'Dawon DNS', description: 'IOT remote control smart gas lock', fromZigbee: [fz.on_off, fz.battery], toZigbee: [tz.dawondns_only_off], // Only support 'Off' command configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'genPowerCfg']); await reporting.onOff(endpoint); await reporting.batteryPercentageRemaining(endpoint); }, exposes: [e.battery(), e.switch(), e.voltage()], }, ];