UNPKG

@softwaredevelopment/node-red-contrib-bodhi-device-occupancy-sensor

Version:

Occupancy Sensor device for bodhi node red

36 lines 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateRemoteDevice = exports.validateLocalDevice = void 0; /** * Find any unknown keys in local device input other than valid ones. We are not performing any validations on type of data, for now we are just validating that correct keys are passed or not. * @param input Input object passed to node * @returns List of any unknown keys in input */ const validateLocalDevice = (input) => { const inputKeys = Object.keys(input); const validKeys = [ 'activityTimeoutFb', 'alarmFb', 'alarmMessage', 'battLevelFb', 'energyUsageFb', 'linkQualityFb', 'lowBattFb', 'offlineFb', ]; validKeys.push('graceFb', 'occFb'); return inputKeys.filter(key => !validKeys.includes(key)); }; exports.validateLocalDevice = validateLocalDevice; /** * Find any unknown keys in remote device input other than valid ones. We are not performing any validations on type of data, for now we are just validating that correct keys are passed or not. * @param input Input object passed to node * @returns List of any unknown keys in input */ const validateRemoteDevice = (input) => { const inputKeys = Object.keys(input); const validKeys = []; return inputKeys.filter(key => !validKeys.includes(key)); }; exports.validateRemoteDevice = validateRemoteDevice; //# sourceMappingURL=helper.service.js.map