UNPKG

@willieee802/zigbee-herdsman-converters

Version:
304 lines 14.4 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const exposes = __importStar(require("../lib/exposes")); const fromZigbee_1 = __importDefault(require("../converters/fromZigbee")); const toZigbee_1 = __importDefault(require("../converters/toZigbee")); const reporting = __importStar(require("../lib/reporting")); const modernExtend_1 = require("../lib/modernExtend"); const e = exposes.presets; const ea = exposes.access; const fzLocal = { dawon_card_holder: { cluster: 'ssIasZone', type: 'commandStatusChangeNotification', convert: (model, msg, publish, options, meta) => { const zoneStatus = msg.data.zonestatus; return { card: (zoneStatus & 1) > 0, battery_low: (zoneStatus & 1 << 3) > 0, }; }, }, }; const tzLocal = { dawon_card_holder: { key: ['card'], convertGet: async (entity, key, meta) => { await entity.read('ssIasZone', ['zoneState']); }, }, }; const definitions = [ { zigbeeModel: ['PM-C140-ZB'], model: 'PM-C140-ZB', vendor: 'Dawon DNS', description: 'IOT remote control smart buried-type outlet', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off, toZigbee_1.default.metering_power, toZigbee_1.default.currentsummdelivered], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering']); await reporting.onOff(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.instantaneousDemand(endpoint); await reporting.currentSummDelivered(endpoint, { min: 10, max: 3600, change: 5 }); }, exposes: [e.switch(), e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET)], }, { zigbeeModel: ['PM-B530-ZB'], model: 'PM-B530-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 16A', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off, toZigbee_1.default.metering_power, toZigbee_1.default.currentsummdelivered], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering']); await reporting.onOff(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.instantaneousDemand(endpoint); await reporting.currentSummDelivered(endpoint, { min: 10, max: 3600, change: 5 }); }, exposes: [e.switch(), e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET)], }, { zigbeeModel: ['PM-B540-ZB'], model: 'PM-B540-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 16A', fromZigbee: [fromZigbee_1.default.device_temperature, fromZigbee_1.default.on_off, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off, toZigbee_1.default.metering_power, toZigbee_1.default.currentsummdelivered], configure: async (device, coordinatorEndpoint) => { 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.currentSummDelivered(endpoint, { min: 10, max: 3600, change: 5 }); await reporting.deviceTemperature(endpoint); // some firmware is not defined powersource if (device.powerSource === 'Unknown') { device.powerSource = 'Mains (single phase)'; device.save(); } }, exposes: [e.device_temperature(), e.switch(), e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET)], }, { zigbeeModel: ['PM-B430-ZB'], model: 'PM-B430-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 10A', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off], configure: async (device, coordinatorEndpoint) => { 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: [(0, modernExtend_1.onOff)({ powerOnBehavior: false })], }, { zigbeeModel: ['PM-S240-ZB'], model: 'PM-S240-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 2 gang without neutral wire', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'top': 1, 'bottom': 2 } }), (0, modernExtend_1.onOff)({ endpointNames: ['top', 'bottom'], powerOnBehavior: false }), ], }, { zigbeeModel: ['PM-S340-ZB'], model: 'PM-S340-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 3 gang without neutral wire', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'top': 1, 'center': 2, 'bottom': 3 } }), (0, modernExtend_1.onOff)({ endpointNames: ['top', 'center', 'bottom'], powerOnBehavior: false }), ], }, { zigbeeModel: ['PM-S140R-ZB'], model: 'PM-S140R-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 1 gang router without neutral wire', extend: [(0, modernExtend_1.onOff)({ powerOnBehavior: false })], }, { zigbeeModel: ['PM-S240R-ZB'], model: 'PM-S240R-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 2 gang without neutral wire', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'top': 1, 'bottom': 2 } }), (0, modernExtend_1.onOff)({ endpointNames: ['top', 'bottom'], powerOnBehavior: false }), ], }, { zigbeeModel: ['PM-S340R-ZB'], model: 'PM-S340R-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 3 gang without neutral wire', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'top': 1, 'center': 2, 'bottom': 3 } }), (0, modernExtend_1.onOff)({ endpointNames: ['top', 'center', 'bottom'], powerOnBehavior: false }), ], }, { zigbeeModel: ['PM-S150-ZB'], model: 'PM-S150-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 1 gang router without neutral wire', extend: [(0, modernExtend_1.onOff)({ powerOnBehavior: false }), (0, modernExtend_1.forcePowerSource)({ powerSource: 'Mains (single phase)' })], }, { zigbeeModel: ['PM-S250-ZB'], model: 'PM-S250-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 2 gang without neutral wire', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'top': 1, 'bottom': 2 } }), (0, modernExtend_1.onOff)({ endpointNames: ['top', 'bottom'], powerOnBehavior: false }), (0, modernExtend_1.forcePowerSource)({ powerSource: 'Mains (single phase)' }), ], }, { zigbeeModel: ['PM-S350-ZB'], model: 'PM-S350-ZB', vendor: 'Dawon DNS', description: 'IOT smart switch 3 gang without neutral wire', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'top': 1, 'center': 2, 'bottom': 3 } }), (0, modernExtend_1.onOff)({ endpointNames: ['top', 'center', 'bottom'], powerOnBehavior: false }), (0, modernExtend_1.forcePowerSource)({ powerSource: 'Mains (single phase)' }), ], }, { zigbeeModel: ['PM-C150-ZB'], model: 'PM-C150-ZB', vendor: 'Dawon DNS', description: 'IOT remote control smart buried-type 16A outlet', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off, toZigbee_1.default.metering_power, toZigbee_1.default.currentsummdelivered], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering']); await reporting.onOff(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.instantaneousDemand(endpoint); await reporting.currentSummDelivered(endpoint, { min: 10, max: 3600, change: 5 }); }, exposes: [e.switch(), e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET)], }, { zigbeeModel: ['SG-V100-ZB'], model: 'SG-V100-ZB', vendor: 'Dawon DNS', description: 'IOT remote control smart gas lock', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.battery], toZigbee: [toZigbee_1.default.dawondns_only_off], // Only support 'Off' command configure: async (device, coordinatorEndpoint) => { 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()], }, { zigbeeModel: ['KB-HD100-ZB'], model: 'KB-HD100-ZB', vendor: 'Dawon DNS', description: 'IOT Card holder', fromZigbee: [fzLocal.dawon_card_holder], toZigbee: [tzLocal.dawon_card_holder], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['ssIasZone']); const payload = [{ attribute: 'zoneState', minimumReportInterval: 0, maximumReportInterval: 3600, reportableChange: 0 }]; await endpoint.configureReporting('ssIasZone', payload); }, exposes: [e.binary('card', ea.STATE, true, false).withAccess(ea.STATE_GET) .withDescription('Indicates if the card is inserted (= true) or not (= false)'), e.battery_low()], }, { zigbeeModel: ['KB-B540R-ZB'], model: 'KB-B540R-ZB', vendor: 'Dawon DNS', description: 'IOT smart plug 16A', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off, toZigbee_1.default.metering_power, toZigbee_1.default.currentsummdelivered], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering']); await reporting.onOff(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.instantaneousDemand(endpoint); await reporting.currentSummDelivered(endpoint, { min: 10, max: 3600, change: 5 }); }, exposes: [e.switch(), e.power().withAccess(ea.STATE_GET), e.energy().withAccess(ea.STATE_GET)], }, { zigbeeModel: ['ZB30C2'], model: 'TH-110-ZB', vendor: 'Dawon DNS', description: 'IoT SMART temperature and humidity sensor', fromZigbee: [fromZigbee_1.default.humidity, fromZigbee_1.default.temperature, fromZigbee_1.default.battery], toZigbee: [], meta: { battery: { dontDividePercentage: true } }, configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['msTemperatureMeasurement', 'msRelativeHumidity', 'genPowerCfg']); await reporting.temperature(endpoint); await endpoint.read('msTemperatureMeasurement', ['measuredValue']); await reporting.humidity(endpoint); await endpoint.read('msRelativeHumidity', ['measuredValue']); await reporting.batteryVoltage(endpoint); await reporting.batteryPercentageRemaining(endpoint, { min: 30, max: 21600, change: 1 }); }, exposes: [e.battery(), e.temperature(), e.humidity()], }, ]; exports.default = definitions; module.exports = definitions; //# sourceMappingURL=dawon_dns.js.map