node-enocean-ts
Version:
Typescript full implementation of the enocean protocol (ESP3 + EEP2.6)
42 lines • 1.24 kB
JavaScript
;
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);
rawVal = ((parseInt(data, 16) & 0xff00) >>> 8);
var pir = (rawVal < 128) ? "off" : "on";
var i = (parseInt(data, 16) & 1);
val1 = eepHelper_1.default.extractByteValue(3, 0, 250, 0, 5, data);
vol = {
type: "voltage",
unit: "V",
value: val1
};
var contact = ["not supported", "supported"];
if (eep === "a5-07-01") {
ret = [{
type: "pir_status",
value: pir
},
{
type: "supply_voltage",
unit: "",
value: contact[i]
}
];
if (i == 1)
ret.push(vol);
return ret;
}
return ret;
}
//# sourceMappingURL=eep-a5-07-01.js.map