UNPKG

node-enocean-ts

Version:

Typescript full implementation of the enocean protocol (ESP3 + EEP2.6)

43 lines 1.38 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; const eepHelper_1 = __importDefault(require("./eepHelper")); function default_1(eep, data) { var ret = null; var eepa = eep.split("-"); var choice = eepa[0]; var func = eepa[1]; var type = eepa[2]; var typeNr = parseInt(type, 16); if (eep === "a5-06-01") { val1 = eepHelper_1.default.extractByteValue(1, 0, 255, 600, 60000, data); val2 = eepHelper_1.default.extractByteValue(2, 0, 255, 300, 30000, data); val3 = eepHelper_1.default.extractByteValue(3, 0, 255, 0, 5.1, data); var select = eepHelper_1.default.extractBitValue(0, 0, 1, data); if (select == 0) { obj = { type: "illumination", unit: "lux", value: val1 }; } else { obj = { type: "illumination", unit: "lux", value: val2 }; } ret = [obj, { type: "voltage", unit: "V", value: val3 }]; return ret; } return ret; } //# sourceMappingURL=eep-a5-06-01.js.map