UNPKG

zigbee-herdsman-converters

Version:

Collection of device converters to be used with zigbee-herdsman

159 lines • 7.7 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 tuya = __importStar(require("../lib/tuya")); const modernExtend_1 = require("../lib/modernExtend"); const e = exposes.presets; const definitions = [ { zigbeeModel: ['00500c35'], model: 'U86K31ND6', vendor: 'Honyar', description: '3 gang switch ', extend: [ (0, modernExtend_1.deviceEndpoints)({ endpoints: { 'left': 1, 'center': 2, 'right': 3 } }), (0, modernExtend_1.onOff)({ endpointNames: ['left', 'center', 'right'] }), ], }, { zigbeeModel: ['HY0043'], model: 'U86Z13A16-ZJH(HA)', vendor: 'Honyar', description: 'Smart Power Socket 16A (with power monitoring)', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.electrical_measurement, fromZigbee_1.default.metering], toZigbee: [toZigbee_1.default.on_off], exposes: [e.switch(), e.power(), e.current(), e.voltage(), e.energy()], configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']); await reporting.onOff(endpoint); await reporting.readEletricalMeasurementMultiplierDivisors(endpoint); await reporting.activePower(endpoint); await reporting.rmsCurrent(endpoint); await reporting.rmsVoltage(endpoint); await reporting.readMeteringMultiplierDivisor(endpoint); await reporting.currentSummDelivered(endpoint); }, }, { zigbeeModel: ['HY0157'], model: 'U86Z223A10-ZJU01(GD)', vendor: 'Honyar', description: 'Smart power socket 10A with USB (with power monitoring)', fromZigbee: [fromZigbee_1.default.on_off, fromZigbee_1.default.electrical_measurement, fromZigbee_1.default.metering, fromZigbee_1.default.ignore_basic_report], toZigbee: [toZigbee_1.default.on_off], exposes: [e.switch().withEndpoint('l1'), e.switch().withEndpoint('l2'), e.power(), e.current(), e.voltage(), e.energy()], meta: { multiEndpoint: true, multiEndpointSkip: ['energy', 'current', 'voltage', 'power'] }, endpoint: (device) => { return { l1: 1, l2: 2 }; }, configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await tuya.configureMagicPacket(device, coordinatorEndpoint); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']); await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']); await reporting.activePower(endpoint, { min: 10, change: 10 }); await reporting.rmsCurrent(endpoint, { min: 10, change: 50 }); await reporting.rmsVoltage(endpoint, { min: 10, change: 10 }); await reporting.currentSummDelivered(endpoint, { min: 10 }); await reporting.readMeteringMultiplierDivisor(endpoint); endpoint.saveClusterAttributeKeyValue('seMetering', { divisor: 1000, multiplier: 1 }); endpoint.saveClusterAttributeKeyValue('haElectricalMeasurement', { acVoltageMultiplier: 1, acVoltageDivisor: 10, acCurrentMultiplier: 1, acCurrentDivisor: 1000, acPowerMultiplier: 1, acPowerDivisor: 10 }); device.save(); }, }, { zigbeeModel: ['HY0095'], model: 'U2-86K11ND10-ZD', vendor: 'Honyar', description: '1 gang switch', fromZigbee: [fromZigbee_1.default.on_off], toZigbee: [toZigbee_1.default.on_off], exposes: [e.switch()], meta: { disableDefaultResponse: true }, configure: async (device, coordinatorEndpoint) => { const endpoint = device.getEndpoint(1); await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint); }, }, { zigbeeModel: ['HY0096'], model: 'U2-86K21ND10-ZD', vendor: 'Honyar', description: '2 gang switch', fromZigbee: [fromZigbee_1.default.on_off], toZigbee: [toZigbee_1.default.on_off], exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right')], endpoint: (device) => { return { 'left': 1, 'right': 2 }; }, meta: { multiEndpoint: true, disableDefaultResponse: true }, configure: async (device, coordinatorEndpoint) => { const endpoint1 = device.getEndpoint(1); const endpoint2 = device.getEndpoint(2); await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint1); await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint2); }, }, { zigbeeModel: ['HY0097'], model: 'U2-86K31ND10-ZD', vendor: 'Honyar', description: '3 gang switch', fromZigbee: [fromZigbee_1.default.on_off], toZigbee: [toZigbee_1.default.on_off], exposes: [e.switch().withEndpoint('left'), e.switch().withEndpoint('right'), e.switch().withEndpoint('center')], endpoint: (device) => { return { 'left': 1, 'center': 2, 'right': 3 }; }, meta: { multiEndpoint: true, disableDefaultResponse: true }, configure: async (device, coordinatorEndpoint) => { const endpoint1 = device.getEndpoint(1); const endpoint2 = device.getEndpoint(2); const endpoint3 = device.getEndpoint(3); await reporting.bind(endpoint1, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint1); await reporting.bind(endpoint2, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint2); await reporting.bind(endpoint3, coordinatorEndpoint, ['genOnOff']); await reporting.onOff(endpoint3); }, }, ]; exports.default = definitions; module.exports = definitions; //# sourceMappingURL=honyar.js.map