From d6f644548fe85df85dacefacdef9be277cdfcb9c Mon Sep 17 00:00:00 2001 From: Aceslick911 Date: Wed, 23 Jun 2021 08:45:12 +1000 Subject: [PATCH] Feature/eslint support (#347) * Added Eslint support * Fixed legitimate issues found with linting * Lint optimisation for all warn issues Co-authored-by: Angelo Perera Co-authored-by: Cameron <32912464+kiwi-cam@users.noreply.github.com> --- .eslintrc.json | 51 + accessories/accessory.js | 8 +- accessories/air-purifier.js | 18 +- accessories/aircon.js | 186 +-- accessories/fan.js | 50 +- accessories/garageDoorOpener.js | 6 +- accessories/heater-cooler.js | 298 ++--- accessories/humidifier-dehumidifier.js | 146 +-- accessories/humiditySensor.js | 10 +- accessories/learnCode.js | 19 +- accessories/light.js | 10 +- accessories/switch.js | 6 +- accessories/switchMulti.js | 2 +- accessories/switchMultiRepeat.js | 20 +- accessories/switchRepeat.js | 4 +- accessories/temperatureSensor.js | 8 +- accessories/tv.js | 32 +- accessories/windowCovering.js | 26 +- base/accessory.js | 136 +- base/helpers/persistentState.js | 6 +- base/platform.js | 10 +- helpers/accessoryCreator.js | 40 +- helpers/arp.js | 12 +- helpers/catchDelayCancelError.js | 2 +- helpers/convertProntoCode.js | 2 +- helpers/delayForDuration.js | 2 +- helpers/getDevice.js | 18 +- helpers/learnData.js | 22 +- helpers/learnRFData.js | 48 +- helpers/sendData.js | 14 +- package-lock.json | 1649 ++++++++++++++++++++++-- package.json | 6 +- platform.js | 16 +- test/fan.test.js | 2 +- test/helpers/fakeDevice.js | 6 +- test/helpers/fakeServiceManager.js | 10 +- test/helpers/hexCheck.js | 18 +- test/outlet.test.js | 12 +- 38 files changed, 2235 insertions(+), 696 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..f62799d3 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,51 @@ +{ + "root": true, + "plugins": [ + "no-autofix" + ], + "env": { + "browser": true, + "es6": true, + "node": true, + "jest": true + }, + "extends": "eslint:recommended", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly", + + "HistoryService":true, + "Characteristic":true, + "Service":true + + }, + "ignorePatterns": [ + ], + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "rules": { + + "global-require": "off", + "no-unused-vars": "off", + "no-mixed-spaces-and-tabs": "off", + "no-fallthrough": "off", + "no-unreachable": "off", + "no-empty": "off", + "no-console": "off", + "quotes": "off", + "brace-style": "off", + "semi": "off", + "comma-dangle": "off", + "eqeqeq": "off", + + "no-extra-semi": "warn", + "dot-notation": "warn", + "no-autofix/prefer-const": "warn", + + "indent": ["error", 2, { "SwitchCase": 1 }], + "linebreak-style": ["error", "unix"], + "curly": 1 + } +} diff --git a/accessories/accessory.js b/accessories/accessory.js index d8796550..13e3b4bb 100644 --- a/accessories/accessory.js +++ b/accessories/accessory.js @@ -9,7 +9,7 @@ const catchDelayCancelError = require('../helpers/catchDelayCancelError'); class BroadlinkRMAccessory extends HomebridgeAccessory { constructor (log, config = {}, serviceManagerType) { - if (!config.name) config.name = "Unknown Accessory" + if (!config.name) {config.name = "Unknown Accessory"} config.resendDataAfterReload = config.resendHexAfterReload; if (config.host) { @@ -21,7 +21,7 @@ class BroadlinkRMAccessory extends HomebridgeAccessory { } super(log, config, serviceManagerType); - if (config.debug) this.debug = true + if (config.debug) {this.debug = true} this.manufacturer = 'Broadlink'; this.model = 'RM Mini or Pro'; @@ -52,7 +52,7 @@ class BroadlinkRMAccessory extends HomebridgeAccessory { break; default: //default to 'info': - if(this.config.logLevel !== undefined) log(`\x1b[31m[CONFIG ERROR] \x1b[33mlogLevel\x1b[0m should be one of: trace, debug, info, warning, error, critical, or none.`); + if(this.config.logLevel !== undefined) {log(`\x1b[31m[CONFIG ERROR] \x1b[33mlogLevel\x1b[0m should be one of: trace, debug, info, warning, error, critical, or none.`);} this.logLevel = 2; break; } @@ -109,7 +109,7 @@ class BroadlinkRMAccessory extends HomebridgeAccessory { let { data, interval, sendCount } = parentData; sendCount = sendCount || 1 - if (sendCount > 1) interval = interval || 0.1; + if (sendCount > 1) {interval = interval || 0.1;} // Itterate through each hex config in the array for (let index = 0; index < sendCount; index++) { diff --git a/accessories/air-purifier.js b/accessories/air-purifier.js index 2e7993e9..60ba8ad1 100644 --- a/accessories/air-purifier.js +++ b/accessories/air-purifier.js @@ -11,15 +11,15 @@ class AirPurifierAccessory extends FanAccessory { // User requested a the target state be set async setTargetState (hexData, previousValue) { - const { log, name, state, serviceManager } = this; + const { log, name, state, serviceManager } = this; - // Ignore if no change to the targetPosition - if (state.targetState === previousValue) return; + // Ignore if no change to the targetPosition + if (state.targetState === previousValue) {return;} - // Set the CurrentAirPurifierState to match the switch state - log(`${name} setTargetState: currently ${previousValue === 0 ? 'manual' : 'auto'}, changing to ${state.targetState === 0 ? 'manual' : 'auto'}`); + // Set the CurrentAirPurifierState to match the switch state + log(`${name} setTargetState: currently ${previousValue === 0 ? 'manual' : 'auto'}, changing to ${state.targetState === 0 ? 'manual' : 'auto'}`); - await this.performSend(hexData); + await this.performSend(hexData); } updateCurrentState() { @@ -49,9 +49,9 @@ class AirPurifierAccessory extends FanAccessory { } = data || {}; // Defaults - if (config.showLockPhysicalControls !== false) config.showLockPhysicalControls = true - if (config.showSwingMode !== false && config.hideSwingMode !== true) config.showSwingMode = true - if (config.showRotationDirection !== false && config.hideRotationDirection !== true) config.showRotationDirection = true + if (config.showLockPhysicalControls !== false) {config.showLockPhysicalControls = true} + if (config.showSwingMode !== false && config.hideSwingMode !== true) {config.showSwingMode = true} + if (config.showRotationDirection !== false && config.hideRotationDirection !== true) {config.showRotationDirection = true} this.serviceManager = new ServiceManagerTypes[serviceManagerType](name, Service.AirPurifier, this.log); diff --git a/accessories/aircon.js b/accessories/aircon.js index d6dd11b2..7500a532 100644 --- a/accessories/aircon.js +++ b/accessories/aircon.js @@ -51,15 +51,15 @@ class AirConAccessory extends BroadlinkRMAccessory { state.targetHeatingCoolingState = state.currentHeatingCoolingState; - if (state.userSpecifiedTargetTemperature) state.targetTemperature = state.userSpecifiedTargetTemperature + if (state.userSpecifiedTargetTemperature) {state.targetTemperature = state.userSpecifiedTargetTemperature} } setDefaults () { const { config, state } = this; // Set config default values - if (config.turnOnWhenOff === undefined) config.turnOnWhenOff = config.sendOnWhenOff || false; // Backwards compatible with `sendOnWhenOff` - if (config.minimumAutoOnOffDuration === undefined) config.minimumAutoOnOffDuration = config.autoMinimumDuration || 120; // Backwards compatible with `autoMinimumDuration` + if (config.turnOnWhenOff === undefined) {config.turnOnWhenOff = config.sendOnWhenOff || false;} // Backwards compatible with `sendOnWhenOff` + if (config.minimumAutoOnOffDuration === undefined) {config.minimumAutoOnOffDuration = config.autoMinimumDuration || 120;} // Backwards compatible with `autoMinimumDuration` config.minTemperature = config.minTemperature || -15; config.maxTemperature = config.maxTemperature || 50; if(config.mqttURL) { @@ -155,13 +155,13 @@ class AirConAccessory extends BroadlinkRMAccessory { const { config, name, log, logLevel } = this; const { autoSwitchName } = config; - if (!autoSwitchName) return; + if (!autoSwitchName) {return;} - if (logLevel <=2) log(`${name} Linking autoSwitch "${autoSwitchName}"`) + if (logLevel <=2) {log(`${name} Linking autoSwitch "${autoSwitchName}"`)} const autoSwitchAccessories = accessories.filter(accessory => accessory.name === autoSwitchName); - if (autoSwitchAccessories.length === 0) return log(`${name} No accessory could be found with the name "${autoSwitchName}". Please update the "autoSwitchName" value or add a matching switch accessory.`); + if (autoSwitchAccessories.length === 0) {return log(`${name} No accessory could be found with the name "${autoSwitchName}". Please update the "autoSwitchName" value or add a matching switch accessory.`);} this.autoSwitchAccessory = autoSwitchAccessories[0]; } @@ -174,12 +174,12 @@ class AirConAccessory extends BroadlinkRMAccessory { const { config, log, logLevel, name, serviceManager, state } = this; const { preventResendHex, minTemperature, maxTemperature } = config; - if (state.targetTemperature === previousValue && preventResendHex && !this.previouslyOff) return; + if (state.targetTemperature === previousValue && preventResendHex && !this.previouslyOff) {return;} this.previouslyOff = false; - if (state.targetTemperature < minTemperature) return log(`The target temperature (${this.targetTemperature}) must be more than the minTemperature (${minTemperature})`); - if (state.targetTemperature > maxTemperature) return log(`The target temperature (${this.targetTemperature}) must be less than the maxTemperature (${maxTemperature})`); + if (state.targetTemperature < minTemperature) {return log(`The target temperature (${this.targetTemperature}) must be more than the minTemperature (${minTemperature})`);} + if (state.targetTemperature > maxTemperature) {return log(`The target temperature (${this.targetTemperature}) must be less than the maxTemperature (${maxTemperature})`);} // Used within correctReloadedState() so that when re-launching the accessory it uses // this temperature rather than one automatically set. @@ -199,17 +199,17 @@ class AirConAccessory extends BroadlinkRMAccessory { const currentHeatingCoolingState = HeatingCoolingConfigKeys[state.currentHeatingCoolingState]; // Some calls are made to this without a value for some unknown reason - if (state.targetHeatingCoolingState === undefined) return; + if (state.targetHeatingCoolingState === undefined) {return;} // Check to see if it's changed - if (state.targetHeatingCoolingState === state.currentHeatingCoolingState && preventResendHex) return; + if (state.targetHeatingCoolingState === state.currentHeatingCoolingState && preventResendHex) {return;} if (targetHeatingCoolingState === 'off') { this.updateServiceCurrentHeatingCoolingState(HeatingCoolingStates.off); if (currentHeatingCoolingState === 'cool' && data.offDryMode !== undefined) { // Dry off mode when previously cooling - if (logLevel <=2) log(`${name} Previous state ${currentHeatingCoolingState}, setting off with dry mode`); + if (logLevel <=2) {log(`${name} Previous state ${currentHeatingCoolingState}, setting off with dry mode`);} await this.performSend(data.offDryMode); } else { await this.performSend(data.off); @@ -218,7 +218,7 @@ class AirConAccessory extends BroadlinkRMAccessory { return; } - if (previousValue === Characteristic.TargetHeatingCoolingState.OFF) this.previouslyOff = true; + if (previousValue === Characteristic.TargetHeatingCoolingState.OFF) {this.previouslyOff = true;} // If the air-conditioner is turned off then turn it on first and try this again if (this.checkTurnOnWhenOff()) { @@ -228,7 +228,7 @@ class AirConAccessory extends BroadlinkRMAccessory { // Perform the auto -> cool/heat conversion if `replaceAutoMode` is specified if (replaceAutoMode && targetHeatingCoolingState === 'auto') { - if (logLevel <=2) log(`${name} setTargetHeatingCoolingState (converting from auto to ${replaceAutoMode})`); + if (logLevel <=2) {log(`${name} setTargetHeatingCoolingState (converting from auto to ${replaceAutoMode})`);} this.updateServiceTargetHeatingCoolingState(HeatingCoolingStates[replaceAutoMode]); return; @@ -258,7 +258,7 @@ class AirConAccessory extends BroadlinkRMAccessory { await this.performSend(hexData); } - if (logLevel <=1) this.log(`${name} sentMode (${mode})`); + if (logLevel <=1) {this.log(`${name} sentMode (${mode})`);} //Force Temperature send delayForDuration(0.25).then(() => { @@ -276,11 +276,11 @@ class AirConAccessory extends BroadlinkRMAccessory { const { HeatingCoolingConfigKeys, HeatingCoolingStates, config, data, host, log, name, state, logLevel } = this; const { preventResendHex, defaultCoolTemperature, heatTemperature, ignoreTemperatureWhenOff, sendTemperatureOnlyWhenOff } = config; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Potential sendTemperature (${temperature})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Potential sendTemperature (${temperature})`);} // Ignore Temperature if off, staying off - and set to ignore. OR temperature not provided if ((!state.targetHeatingCoolingState && ignoreTemperatureWhenOff) || !temperature) { - if (logLevel <=2) log(`${name} Ignoring sendTemperature due to "ignoreTemperatureWhenOff": true or no temperature set.`); + if (logLevel <=2) {log(`${name} Ignoring sendTemperature due to "ignoreTemperatureWhenOff": true or no temperature set.`);} return; } @@ -291,14 +291,14 @@ class AirConAccessory extends BroadlinkRMAccessory { // Update the heating/cooling mode based on the pseudo-mode - if pressent. if (hexData['pseudo-mode']){ mode = hexData['pseudo-mode']; - if (mode) assert.oneOf(mode, [ 'heat', 'cool', 'auto' ], `\x1b[31m[CONFIG ERROR] \x1b[33mpseudo-mode\x1b[0m should be one of "heat", "cool" or "auto"`) + if (mode) {assert.oneOf(mode, [ 'heat', 'cool', 'auto' ], `\x1b[31m[CONFIG ERROR] \x1b[33mpseudo-mode\x1b[0m should be one of "heat", "cool" or "auto"`)} this.updateServiceCurrentHeatingCoolingState(HeatingCoolingStates[mode]); } if((previousTemperature !== finalTemperature) || (state.firstTemperatureUpdate && !preventResendHex)){ //Set the temperature await this.performSend(hexData.data); - if (logLevel <=2) this.log(`${name} sentTemperature (${state.targetTemperature})`); + if (logLevel <=2) {this.log(`${name} sentTemperature (${state.targetTemperature})`);} state.firstTemperatureUpdate = false; } } @@ -311,13 +311,13 @@ class AirConAccessory extends BroadlinkRMAccessory { let hexData = data[`${mode}${temperature}`]; if (!hexData) { - // Mode based code not found, try mode-less - if (logLevel <=3) this.log(`${name} No ${mode} HEX code found for ${temperature}`); - hexData = data[`temperature${temperature}`]; + // Mode based code not found, try mode-less + if (logLevel <=3) {this.log(`${name} No ${mode} HEX code found for ${temperature}`);} + hexData = data[`temperature${temperature}`]; } else { - if (hexData['pseudo-mode']) { - if (logLevel <=2) this.log(`\x1b[36m[INFO] \x1b[0m${name} Configuration found for ${mode}${temperature} with pseudo-mode. Pseudo-mode will replace the configured mode.`); - } + if (hexData['pseudo-mode']) { + if (logLevel <=2) {this.log(`\x1b[36m[INFO] \x1b[0m${name} Configuration found for ${mode}${temperature} with pseudo-mode. Pseudo-mode will replace the configured mode.`);} + } } // You may not want to set the hex data for every single mode... @@ -330,7 +330,7 @@ class AirConAccessory extends BroadlinkRMAccessory { or provide the default temperature: \x1b[33m { "temperature${defaultTemperature}": { "data": "HEXCODE", "pseudo-mode" : "heat/cool" } }\x1b[0m`); - if (logLevel <=2) this.log(`${name} Update to default temperature (${defaultTemperature})`); + if (logLevel <=2) {this.log(`${name} Update to default temperature (${defaultTemperature})`);} finalTemperature = defaultTemperature; } @@ -342,12 +342,12 @@ class AirConAccessory extends BroadlinkRMAccessory { const { on } = data; if (state.currentHeatingCoolingState === Characteristic.TargetHeatingCoolingState.OFF && config.turnOnWhenOff) { - if (logLevel <=2) log(`${name} sending "on" hex before sending temperature`); + if (logLevel <=2) {log(`${name} sending "on" hex before sending temperature`);} if (on) { await this.performSend(on); } else { - if (logLevel <=4) log(`\x1b[31m[CONFIG ERROR] \x1b[0m ${name} No On Hex configured, but turnOnWhenOff enabled`); + if (logLevel <=4) {log(`\x1b[31m[CONFIG ERROR] \x1b[0m ${name} No On Hex configured, but turnOnWhenOff enabled`);} } return true; @@ -362,10 +362,10 @@ class AirConAccessory extends BroadlinkRMAccessory { const { config, host, log, logLevel, name, state } = this; const { temperatureFilePath, pseudoDeviceTemperature, w1DeviceID } = config; - if (pseudoDeviceTemperature !== undefined) return; + if (pseudoDeviceTemperature !== undefined) {return;} //Force w1 and file devices to a minimum 1 minute refresh - if (w1DeviceID || temperatureFilePath) config.temperatureUpdateFrequency = Math.max(config.temperatureUpdateFrequency,60); + if (w1DeviceID || temperatureFilePath) {config.temperatureUpdateFrequency = Math.max(config.temperatureUpdateFrequency,60);} const device = getDevice({ host, log }); @@ -378,13 +378,13 @@ class AirConAccessory extends BroadlinkRMAccessory { return; } - if (logLevel <=1) log(`${name} monitorTemperature`); + if (logLevel <=1) {log(`${name} monitorTemperature`);} device.on('temperature', this.onTemperature.bind(this)); device.checkTemperature(); this.updateTemperatureUI(); - if (!config.isUnitTest) setInterval(this.updateTemperatureUI.bind(this), config.temperatureUpdateFrequency * 1000) + if (!config.isUnitTest) {setInterval(this.updateTemperatureUI.bind(this), config.temperatureUpdateFrequency * 1000)} } onTemperature (temperature,humidity) { @@ -393,11 +393,11 @@ class AirConAccessory extends BroadlinkRMAccessory { // onTemperature is getting called twice. No known cause currently. // This helps prevent the same temperature from being processed twice - if (Object.keys(this.temperatureCallbackQueue).length === 0) return; + if (Object.keys(this.temperatureCallbackQueue).length === 0) {return;} temperature += temperatureAdjustment; state.currentTemperature = temperature; - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onTemperature (${temperature})`); + if(logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onTemperature (${temperature})`);} if(humidity) { if(noHumidity){ @@ -405,7 +405,7 @@ class AirConAccessory extends BroadlinkRMAccessory { }else{ humidity += humidityAdjustment; state.currentHumidity = humidity; - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onHumidity (` + humidity + `)`); + if(logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onHumidity (` + humidity + `)`);} } } @@ -413,7 +413,7 @@ class AirConAccessory extends BroadlinkRMAccessory { //Ignore readings of exactly zero - the default no value value. if(config.noHistory !== true && this.state.currentTemperature != 0.00) { this.lastUpdatedAt = Date.now(); - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Logging data to history: temp: ${this.state.currentTemperature}, humidity: ${this.state.currentHumidity}`); + if(logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Logging data to history: temp: ${this.state.currentTemperature}, humidity: ${this.state.currentHumidity}`);} if(noHumidity){ this.historyService.addEntry({ time: Math.round(new Date().valueOf() / 1000), temp: this.state.currentTemperature }); }else{ @@ -431,7 +431,7 @@ class AirConAccessory extends BroadlinkRMAccessory { // Clear the previous callback if (Object.keys(this.temperatureCallbackQueue).length > 1) { if (state.currentTemperature) { - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (clearing previous callback, using existing temperature)`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (clearing previous callback, using existing temperature)`);} this.processQueuedTemperatureCallbacks(state.currentTemperature); } } @@ -469,7 +469,7 @@ class AirConAccessory extends BroadlinkRMAccessory { if (!device || device.state === 'inactive') { if (device && device.state === 'inactive') { - if (logLevel <=3) log(`${name} addTemperatureCallbackToQueue (device no longer active, using existing temperature)`); + if (logLevel <=3) {log(`${name} addTemperatureCallbackToQueue (device no longer active, using existing temperature)`);} } this.processQueuedTemperatureCallbacks(state.currentTemperature || 0); @@ -478,7 +478,7 @@ class AirConAccessory extends BroadlinkRMAccessory { } device.checkTemperature(); - if (logLevel <1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (requested temperature from device, waiting)`); + if (logLevel <1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (requested temperature from device, waiting)`);} } updateTemperatureFromFile () { @@ -487,16 +487,16 @@ class AirConAccessory extends BroadlinkRMAccessory { let humidity = null; let temperature = null; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile reading file: ${temperatureFilePath}`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile reading file: ${temperatureFilePath}`);} fs.readFile(temperatureFilePath, 'utf8', (err, data) => { if (err) { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} updateTemperatureFromFile\n\n${err.message}`); + if (logLevel <=4) {log(`\x1b[31m[ERROR] \x1b[0m${name} updateTemperatureFromFile\n\n${err.message}`);} } if (data === undefined || data.trim().length === 0) { - if (logLevel <=3) log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromFile error reading file: ${temperatureFilePath}, using previous Temperature`); - if (!noHumidity) humidity = (state.currentHumidity || 0); + if (logLevel <=3) {log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromFile error reading file: ${temperatureFilePath}, using previous Temperature`);} + if (!noHumidity) {humidity = (state.currentHumidity || 0);} temperature = (state.currentTemperature || 0); } @@ -507,14 +507,14 @@ class AirConAccessory extends BroadlinkRMAccessory { lines.forEach((line) => { if(-1 < line.indexOf(':')){ let value = line.split(':'); - if(value[0] == 'temperature') temperature = parseFloat(value[1]); - if(value[0] == 'humidity' && !noHumidity) humidity = parseFloat(value[1]); - if(value[0] == 'battery' && batteryAlerts) state.batteryLevel = parseFloat(value[1]); + if(value[0] == 'temperature') {temperature = parseFloat(value[1]);} + if(value[0] == 'humidity' && !noHumidity) {humidity = parseFloat(value[1]);} + if(value[0] == 'battery' && batteryAlerts) {state.batteryLevel = parseFloat(value[1]);} } }); } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile (parsed temperature: ${temperature} humidity: ${humidity})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile (parsed temperature: ${temperature} humidity: ${humidity})`);} this.onTemperature(temperature, humidity); }); @@ -528,7 +528,7 @@ class AirConAccessory extends BroadlinkRMAccessory { var fName = W1PATH + "/" + w1DeviceID + "/w1_slave"; var temperature; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 reading file: ${fName}`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 reading file: ${fName}`);} fs.readFile(fName, 'utf8', (err, data) => { if (err) { @@ -539,17 +539,17 @@ class AirConAccessory extends BroadlinkRMAccessory { var matches = data.match(/t=([0-9]+)/); temperature = parseInt(matches[1]) / 1000; }else{ - if (logLevel <=3) log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromW1 error reading file: ${fName}, using previous Temperature`); + if (logLevel <=3) {log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromW1 error reading file: ${fName}, using previous Temperature`);} temperature = (state.currentTemperature || 0); } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 (parsed temperature: ${temperature})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 (parsed temperature: ${temperature})`);} this.onTemperature(temperature); }); } processQueuedTemperatureCallbacks (temperature) { - if (Object.keys(this.temperatureCallbackQueue).length === 0) return; + if (Object.keys(this.temperatureCallbackQueue).length === 0) {return;} Object.keys(this.temperatureCallbackQueue).forEach((callbackIdentifier) => { const callback = this.temperatureCallbackQueue[callbackIdentifier]; @@ -568,7 +568,7 @@ class AirConAccessory extends BroadlinkRMAccessory { const { noHumidity } = config; serviceManager.refreshCharacteristicUI(Characteristic.CurrentTemperature); - if(!noHumidity){serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity);}; + if(!noHumidity){serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity);} } getCurrentTemperature (callback) { @@ -577,7 +577,7 @@ class AirConAccessory extends BroadlinkRMAccessory { // Some devices don't include a thermometer and so we can use `pseudoDeviceTemperature` instead if (pseudoDeviceTemperature !== undefined) { - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} getCurrentTemperature (using pseudoDeviceTemperature ${pseudoDeviceTemperature} from config)`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} getCurrentTemperature (using pseudoDeviceTemperature ${pseudoDeviceTemperature} from config)`);} return callback(null, pseudoDeviceTemperature); } @@ -596,36 +596,36 @@ class AirConAccessory extends BroadlinkRMAccessory { let { autoHeatTemperature, autoCoolTemperature, minimumAutoOnOffDuration } = config; if (this.shouldIgnoreAutoOnOff) { - if (logLevel <=2) log(`${name} checkTemperatureForAutoOn (ignore within ${minimumAutoOnOffDuration}s of previous auto-on/off due to "minimumAutoOnOffDuration")`); + if (logLevel <=2) {log(`${name} checkTemperatureForAutoOn (ignore within ${minimumAutoOnOffDuration}s of previous auto-on/off due to "minimumAutoOnOffDuration")`);} return; } - if (!autoHeatTemperature && !autoCoolTemperature) return; + if (!autoHeatTemperature && !autoCoolTemperature) {return;} if (!this.isAutoSwitchOn()) { - if (logLevel <=2) log(`${name} checkTemperatureForAutoOnOff (autoSwitch is off)`); + if (logLevel <=2) {log(`${name} checkTemperatureForAutoOnOff (autoSwitch is off)`);} return; } - if (logLevel <=1) log(`${name} checkTemperatureForAutoOnOff`); + if (logLevel <=1) {log(`${name} checkTemperatureForAutoOnOff`);} if (autoHeatTemperature && temperature < autoHeatTemperature) { this.state.isRunningAutomatically = true; - if (logLevel <=2) log(`${name} checkTemperatureForAutoOnOff (${temperature} < ${autoHeatTemperature}: auto heat)`); + if (logLevel <=2) {log(`${name} checkTemperatureForAutoOnOff (${temperature} < ${autoHeatTemperature}: auto heat)`);} serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.HEAT); } else if (autoCoolTemperature && temperature > autoCoolTemperature) { this.state.isRunningAutomatically = true; - if (logLevel <=2) log(`${name} checkTemperatureForAutoOnOff (${temperature} > ${autoCoolTemperature}: auto cool)`); + if (logLevel <=2) {log(`${name} checkTemperatureForAutoOnOff (${temperature} > ${autoCoolTemperature}: auto cool)`);} serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.COOL); } else { - if (logLevel <=1) log(`${name} checkTemperatureForAutoOnOff (temperature is ok)`); + if (logLevel <=1) {log(`${name} checkTemperatureForAutoOnOff (temperature is ok)`);} if (this.state.isRunningAutomatically) { this.isAutomatedOff = true; - if (logLevel <=2) log(`${name} checkTemperatureForAutoOnOff (auto off)`); + if (logLevel <=2) {log(`${name} checkTemperatureForAutoOnOff (auto off)`);} serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.OFF); } else { return; @@ -661,7 +661,7 @@ class AirConAccessory extends BroadlinkRMAccessory { let temperatureValue, humidityValue, batteryValue; let objectFound = false; let value = this.mqttValuesTemp[identifier]; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${value})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${value})`);} try { //Attempt to parse JSON - if result is JSON const temperatureJSON = JSON.parse(value); @@ -671,12 +671,12 @@ class AirConAccessory extends BroadlinkRMAccessory { let values = []; if (identifier !== 'temperature' && identifier !== 'battery'){ //Try to locate other Humidity fields - if (values.length === 0) values = findKey(temperatureJSON, 'Hum'); - if (values.length === 0) values = findKey(temperatureJSON, 'hum'); - if (values.length === 0) values = findKey(temperatureJSON, 'Humidity'); - if (values.length === 0) values = findKey(temperatureJSON, 'humidity'); - if (values.length === 0) values = findKey(temperatureJSON, 'RelativeHumidity'); - if (values.length === 0) values = findKey(temperatureJSON, 'relativehumidity'); + if (values.length === 0) {values = findKey(temperatureJSON, 'Hum');} + if (values.length === 0) {values = findKey(temperatureJSON, 'hum');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Humidity');} + if (values.length === 0) {values = findKey(temperatureJSON, 'humidity');} + if (values.length === 0) {values = findKey(temperatureJSON, 'RelativeHumidity');} + if (values.length === 0) {values = findKey(temperatureJSON, 'relativehumidity');} if(values.length > 0) { humidityValue = values; values = []; @@ -684,10 +684,10 @@ class AirConAccessory extends BroadlinkRMAccessory { } if (identifier !== 'temperature' && identifier !== 'humidity'){ //Try to locate other Battery fields - if (values.length === 0) values = findKey(temperatureJSON, 'Batt'); - if (values.length === 0) values = findKey(temperatureJSON, 'batt'); - if (values.length === 0) values = findKey(temperatureJSON, 'Battery'); - if (values.length === 0) values = findKey(temperatureJSON, 'battery'); + if (values.length === 0) {values = findKey(temperatureJSON, 'Batt');} + if (values.length === 0) {values = findKey(temperatureJSON, 'batt');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Battery');} + if (values.length === 0) {values = findKey(temperatureJSON, 'battery');} if(values.length > 0) { batteryValue = values; values = []; @@ -695,10 +695,10 @@ class AirConAccessory extends BroadlinkRMAccessory { } if(identifier !== 'battery' && identifier !== 'humidity'){ //Try to locate other Temperature fields - if (values.length === 0) values = findKey(temperatureJSON, 'temp'); - if (values.length === 0) values = findKey(temperatureJSON, 'Temp'); - if (values.length === 0) values = findKey(temperatureJSON, 'temperature'); - if (values.length === 0) values = findKey(temperatureJSON, 'Temperature'); + if (values.length === 0) {values = findKey(temperatureJSON, 'temp');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Temp');} + if (values.length === 0) {values = findKey(temperatureJSON, 'temperature');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Temperature');} if(values.length > 0) { temperatureValue = values; } @@ -714,14 +714,14 @@ class AirConAccessory extends BroadlinkRMAccessory { if(objectFound) { if(temperatureValue !== undefined && temperatureValue.length > 0) { - this.mqttValues['temperature'] = parseFloat(temperatureValue[0]); + this.mqttValues.temperature = parseFloat(temperatureValue[0]); } if(batteryValue !== undefined && batteryValue.length > 0) { state.batteryLevel = parseFloat(batteryValue[0]); - this.mqttValues['battery'] = parseFloat(batteryValue[0]); + this.mqttValues.battery = parseFloat(batteryValue[0]); } if(humidityValue !== undefined && humidityValue.length > 0) { - this.mqttValues['humidity'] = parseFloat(humidityValue[0]); + this.mqttValues.humidity = parseFloat(humidityValue[0]); } }else{ if (value === undefined || (typeof value === 'string' && value.trim().length === 0)) { @@ -729,7 +729,7 @@ class AirConAccessory extends BroadlinkRMAccessory { return; } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (parsed value: ${value})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (parsed value: ${value})`);} value = parseFloat(value); if (identifier == 'battery'){ @@ -786,21 +786,21 @@ class AirConAccessory extends BroadlinkRMAccessory { if (config.heatOnly) { this.serviceManager .getCharacteristic(Characteristic.TargetHeatingCoolingState) - .setProps({ - minValue: 0, - maxValue: 1, - validValues: [0,1] - }); - } + .setProps({ + minValue: 0, + maxValue: 1, + validValues: [0,1] + }); + } if (config.coolOnly) { this.serviceManager .getCharacteristic(Characteristic.TargetHeatingCoolingState) - .setProps({ - minValue: 0, - maxValue: 2, - validValues: [0,2] - }); - } + .setProps({ + minValue: 0, + maxValue: 2, + validValues: [0,2] + }); + } this.serviceManager.addGetCharacteristic({ name: 'currentTemperature', @@ -816,7 +816,7 @@ class AirConAccessory extends BroadlinkRMAccessory { method: this.getCurrentHumidity, bind: this }) - }; + } this.serviceManager.addGetCharacteristic({ name: 'temperatureDisplayUnits', diff --git a/accessories/fan.js b/accessories/fan.js index de10a721..6afc18e6 100644 --- a/accessories/fan.js +++ b/accessories/fan.js @@ -4,19 +4,19 @@ const catchDelayCancelError = require('../helpers/catchDelayCancelError'); const delayForDuration = require('../helpers/delayForDuration'); class FanAccessory extends SwitchAccessory { - setDefaults () { + setDefaults() { super.setDefaults(); let { config, state } = this; - + // Defaults config.showSwingMode = config.hideSwingMode === true || config.showSwingMode === false ? false : true; config.showRotationDirection = config.hideRotationDirection === true || config.showRotationDirection === false ? false : true; config.stepSize = isNaN(config.stepSize) || config.stepSize > 100 || config.stepSize < 1 ? 1 : config.stepSize; - + if (config.speedSteps) { config.stepSize = Math.floor(100 / config.speedSteps); } - + if (config.alwaysResetToDefaults) { state.fanSpeed = (config.defaultFanSpeed !== undefined) ? config.defaultFanSpeed : 100; @@ -30,7 +30,7 @@ class FanAccessory extends SwitchAccessory { super.reset(); this.stateChangeInProgress = true; - + // Clear Timeouts if (this.delayTimeoutPromise) { this.delayTimeoutPromise.cancel(); @@ -46,12 +46,12 @@ class FanAccessory extends SwitchAccessory { this.autoOnTimeoutPromise.cancel(); this.autoOnTimeoutPromise = null; } - - if (this.serviceManager.getCharacteristic(Characteristic.Active) === undefined) { + + if (this.serviceManager.getCharacteristic(Characteristic.Active) === undefined) { this.serviceManager.setCharacteristic(Characteristic.Active, false); } } - + checkAutoOnOff() { this.reset(); this.checkAutoOn(); @@ -60,11 +60,11 @@ class FanAccessory extends SwitchAccessory { async checkAutoOff() { await catchDelayCancelError(async () => { - const { config, log, name, state, serviceManager } = this; + const { config, log, logLevel, name, state, serviceManager } = this; let { disableAutomaticOff, enableAutoOff, onDuration } = config; if (state.switchState && enableAutoOff) { - if (logLevel <=2) log(`${name} setSwitchState: (automatically turn off in ${onDuration} seconds)`); + if (logLevel <= 2) {log(`${name} setSwitchState: (automatically turn off in ${onDuration} seconds)`);} this.autoOffTimeoutPromise = delayForDuration(onDuration); await this.autoOffTimeoutPromise; @@ -76,11 +76,11 @@ class FanAccessory extends SwitchAccessory { async checkAutoOn() { await catchDelayCancelError(async () => { - const { config, log, name, state, serviceManager } = this; + const { config, log, logLevel, name, state, serviceManager } = this; let { disableAutomaticOn, enableAutoOn, offDuration } = config; if (!state.switchState && enableAutoOn) { - if (logLevel <=2) log(`${name} setSwitchState: (automatically turn on in ${offDuration} seconds)`); + if (logLevel <= 2) {log(`${name} setSwitchState: (automatically turn on in ${offDuration} seconds)`);} this.autoOnTimeoutPromise = delayForDuration(offDuration); await this.autoOnTimeoutPromise; @@ -90,7 +90,7 @@ class FanAccessory extends SwitchAccessory { }); } - async setSwitchState (hexData, previousValue) { + async setSwitchState(hexData, previousValue) { const { config, state, serviceManager } = this; if (!this.state.switchState) { this.lastFanSpeed = undefined; @@ -99,7 +99,7 @@ class FanAccessory extends SwitchAccessory { if (config.defaultSpeedStep && config.stepSize) { this.lastFanSpeed = config.defaultSpeedStep * config.stepSize; } - + // Reset the fan speed back to the default speed when turned off if (this.state.switchState === false && config.alwaysResetToDefaults) { this.setDefaults(); @@ -109,8 +109,8 @@ class FanAccessory extends SwitchAccessory { super.setSwitchState(hexData, previousValue); } - async setFanSpeed (hexData) { - const { config, data, host, log, state, name, logLevel} = this; + async setFanSpeed(hexData) { + const { config, data, host, log, state, name, logLevel } = this; this.reset(); @@ -121,7 +121,7 @@ class FanAccessory extends SwitchAccessory { allHexKeys.forEach((key) => { const parts = key.split('fanSpeed'); - if (parts.length !== 2) return; + if (parts.length !== 2) {return;} foundSpeeds.push(parts[1]) }) @@ -139,7 +139,7 @@ class FanAccessory extends SwitchAccessory { // Find speed closest to the one requested const closest = foundSpeeds.reduce((prev, curr) => Math.abs(curr - state.fanSpeed) < Math.abs(prev - state.fanSpeed) ? curr : prev); - if (logLevel <=2) log(`${name} setFanSpeed: (closest: ${closest})`); + if (logLevel <= 2) {log(`${name} setFanSpeed: (closest: ${closest})`);} if (this.lastFanSpeed === closest) { return; @@ -149,7 +149,7 @@ class FanAccessory extends SwitchAccessory { hexData = data[`fanSpeed${closest}`]; if (config.speedCycle) { - let fanSpeedHexData = data['fanSpeed']; + let fanSpeedHexData = data.fanSpeed; let fanSpeed = this.lastFanSpeed; hexData = []; @@ -172,7 +172,7 @@ class FanAccessory extends SwitchAccessory { while (fanSpeed < closest) { hexData.push(fanSpeedHexData); fanSpeed += config.stepSize; - } + } } } @@ -183,14 +183,14 @@ class FanAccessory extends SwitchAccessory { this.checkAutoOnOff(); } - setupServiceManager () { + setupServiceManager() { const { config, data, name, serviceManagerType } = this; const { on, off, clockwise, counterClockwise, swingToggle } = data || {}; this.serviceManager = new ServiceManagerTypes[serviceManagerType](name, Service.Fanv2, this.log); this.setDefaults(); - + this.serviceManager.addToggleCharacteristic({ name: 'switchState', type: Characteristic.Active, @@ -227,9 +227,9 @@ class FanAccessory extends SwitchAccessory { bind: this, props: { setValuePromise: this.setFanSpeed.bind(this), - minStep: config.stepSize, - minValue: 0, - maxValue: 100 + minStep: config.stepSize, + minValue: 0, + maxValue: 100 } }); diff --git a/accessories/garageDoorOpener.js b/accessories/garageDoorOpener.js index 995218c8..a929e1d7 100644 --- a/accessories/garageDoorOpener.js +++ b/accessories/garageDoorOpener.js @@ -60,7 +60,7 @@ class GarageDoorOpenerAccessory extends BroadlinkRMAccessory { let { autoCloseDelay, openDuration, openCloseDuration } = config; // Defaults - if (!openDuration) openDuration = openCloseDuration || 8; + if (!openDuration) {openDuration = openCloseDuration || 8;} log(`${name} setDoorCurrentState: opening`); this.openingTimeoutPromise = delayForDuration(openDuration); @@ -69,7 +69,7 @@ class GarageDoorOpenerAccessory extends BroadlinkRMAccessory { log(`${name} setDoorCurrentState: opened`); serviceManager.setCharacteristic(Characteristic.CurrentDoorState, Characteristic.CurrentDoorState.OPEN); - if (!autoCloseDelay) return; + if (!autoCloseDelay) {return;} log(`${name} automatically closing in ${autoCloseDelay}s`); this.autoCloseTimeoutPromise = delayForDuration(autoCloseDelay); @@ -84,7 +84,7 @@ class GarageDoorOpenerAccessory extends BroadlinkRMAccessory { let { closeDuration, openCloseDuration } = config; // Defaults - if (!closeDuration) closeDuration = openCloseDuration || 8; + if (!closeDuration) {closeDuration = openCloseDuration || 8;} log(`${name} setDoorCurrentState: closing`); diff --git a/accessories/heater-cooler.js b/accessories/heater-cooler.js index c3c78a94..7b67a644 100644 --- a/accessories/heater-cooler.js +++ b/accessories/heater-cooler.js @@ -58,15 +58,15 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { */ constructor(log, config = {}, serviceManagerType) { super(log, config, serviceManagerType); - + // Fakegato setup - if(config.noHistory !== true) { + if (config.noHistory !== true) { this.displayName = config.name; this.lastUpdatedAt = undefined; - this.historyService = new HistoryService("room", this, { storage: 'fs', filename: 'RMPro_' + config.name.replace(' ','-') + '_persist.json'}); - this.historyService.log = this.log; + this.historyService = new HistoryService("room", this, { storage: 'fs', filename: 'RMPro_' + config.name.replace(' ', '-') + '_persist.json' }); + this.historyService.log = this.log; } - + this.temperatureCallbackQueue = {}; this.monitorTemperature(); } @@ -87,7 +87,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { config.preventResendHex = !config.allowResend; } config.allowResend = !config.preventResendHex; - + config.turnOnWhenOff = config.turnOnWhenOff === undefined ? true : config.turnOnWhenOff; state.active = state.active || Characteristic.Active.INACTIVE @@ -101,13 +101,13 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { if (state.currentTemperature === undefined) { state.currentTemperature = config.defaultNowTemperature } config.temperatureAdjustment = config.temperatureAdjustment || 0; config.humidityAdjustment = config.humidityAdjustment || 0; - if(config.mqttURL) { + if (config.mqttURL) { //MQTT updates when published so frequent refreshes aren't required ( 10 minute default as a fallback ) config.temperatureUpdateFrequency = config.temperatureUpdateFrequency || 600; } else { config.temperatureUpdateFrequency = config.temperatureUpdateFrequency || 10; } - + const { internalConfig } = config const { available } = internalConfig if (available.cool.rotationSpeed || available.heat.rotationSpeed) { @@ -155,7 +155,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { break default: } - if (logLevel <=2) log(`Updated currentHeaterCoolerState to ${state.currentHeaterCoolerState}`) + if (logLevel <= 2) {log(`Updated currentHeaterCoolerState to ${state.currentHeaterCoolerState}`)} } /** @@ -180,7 +180,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { const { available } = internalConfig let { targetHeaterCoolerState, heatingThresholdTemperature, coolingThresholdTemperature } = state - if (logLevel <=2) log(`Changing target state from ${previousValue} to ${targetHeaterCoolerState}`) + if (logLevel <= 2) {log(`Changing target state from ${previousValue} to ${targetHeaterCoolerState}`)} switch (targetHeaterCoolerState) { case Characteristic.TargetHeaterCoolerState.COOL: if (available.cool.temperatureCodes) { @@ -199,7 +199,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { hexData = this.decodeHexFromConfig(CharacteristicName.TARGET_HEATER_COOLER_STATE) break default: - if (logLevel <=4) log(`BUG: ${this.name} setTargetHeaterCoolerState invoked with unsupported target mode ${targetHeaterCoolerState}`) + if (logLevel <= 4) {log(`BUG: ${this.name} setTargetHeaterCoolerState invoked with unsupported target mode ${targetHeaterCoolerState}`)} } await this.performSend(hexData) @@ -226,7 +226,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { case Characteristic.TargetHeaterCoolerState.COOL: temperature = coolingThresholdTemperature if (!available.coolMode) { - if (logLevel <=4) log(`BUG: ${name} decodeHexFromConfig invoked with unsupported target mode: cool.`) + if (logLevel <= 4) {log(`BUG: ${name} decodeHexFromConfig invoked with unsupported target mode: cool.`)} return "0'" // sending dummy hex data to prevent homebridge from tripping } if (toUpdateCharacteristic === CharacteristicName.ACTIVE @@ -242,7 +242,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { case Characteristic.TargetHeaterCoolerState.HEAT: temperature = heatingThresholdTemperature if (!available.heatMode) { - if (logLevel <=4) log(`BUG: ${name} decodeHexFromConfig invoked with unsupported target mode: heat.`) + if (logLevel <= 4) {log(`BUG: ${name} decodeHexFromConfig invoked with unsupported target mode: heat.`)} return "0'" // sending dummy hex data to prevent homebridge from tripping } if (toUpdateCharacteristic === CharacteristicName.ACTIVE @@ -255,7 +255,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { return this.decodeTemperatureHex(temperature, heat, toUpdateCharacteristic) break default: - if (logLevel <=4) log(`BUG: decodeHexFromConfig has invalid value for targetHeaterCoolerState: ${targetHeaterCoolerState}.`) + if (logLevel <= 4) {log(`BUG: decodeHexFromConfig has invalid value for targetHeaterCoolerState: ${targetHeaterCoolerState}.`)} break } @@ -287,17 +287,17 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { keyFromState = 'rotationSpeed' + state.rotationSpeed if (toUpdateCharacteristic === CharacteristicName.ROTATION_SPEED) { if (keys.includes('fanSpeedToggle')) { - return this.decodeHierarchichalHex(hexDataObject['fanSpeedToggle'], checkCharacteristics, null) + return this.decodeHierarchichalHex(hexDataObject.fanSpeedToggle, checkCharacteristics, null) } if (keys.includes(keyFromState)) { return this.decodeHierarchichalHex(hexDataObject[keyFromState], checkCharacteristics, null) } - if (logLevel <=3) log(`Could not find rotationSpeed${state.rotationSpeed} hex codes`) + if (logLevel <= 3) {log(`Could not find rotationSpeed${state.rotationSpeed} hex codes`)} return "0" } // do not change state of fanspeed mode if (keys.includes('fanSpeedDnd')) { - return decodeHierarchichalHex(hexDataObject['fanSpeedDnd'], checkCharacteristics, toUpdateCharacteristic) + return this.decodeHierarchichalHex(hexDataObject.fanSpeedDnd, checkCharacteristics, toUpdateCharacteristic) } if (keys.includes(keyFromState)) { return this.decodeHierarchichalHex(hexDataObject[keyFromState], checkCharacteristics, toUpdateCharacteristic) @@ -306,18 +306,18 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { case CharacteristicName.SWING_MODE: if (toUpdateCharacteristic === CharacteristicName.SWING_MODE) { if (keys.includes('swingToggle')) { - return this.decodeHierarchichalHex(hexDataObject['swingToggle'], checkCharacteristics, null) + return this.decodeHierarchichalHex(hexDataObject.swingToggle, checkCharacteristics, null) } keyFromState = state.swingMode === Characteristic.SwingMode.SWING_ENABLED ? 'swingOn' : 'swingOff' if (keys.includes(keyFromState)) { return this.decodeHierarchichalHex(hexDataObject[keyFromState], checkCharacteristics, null) } - if (logLevel <=3) log(`Could not find swingMode hex codes for swingMode ${keyFromState}`) + if (logLevel <= 3) {log(`Could not find swingMode hex codes for swingMode ${keyFromState}`)} return "0" } // do not change state of swing mode if (keys.includes('swingDnd')) { - return this.decodeHierarchichalHex(hexDataObject['swingDnd'], checkCharacteristics, toUpdateCharacteristic) + return this.decodeHierarchichalHex(hexDataObject.swingDnd, checkCharacteristics, toUpdateCharacteristic) } keyFromState = state.swingMode === Characteristic.SwingMode.SWING_ENABLED ? 'swingOn' : 'swingOff' if (keys.includes(keyFromState)) { @@ -326,10 +326,10 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { break case undefined: // should not happen, this is a fail safe to prevent infinite recursion. - if (logLevel <=4) log(`BUG: ${name} decodeHierarchichalHex encountered a bug, please raise an issue`) + if (logLevel <= 4) {log(`BUG: ${name} decodeHierarchichalHex encountered a bug, please raise an issue`)} return hexDataObject } - if (logLevel <=4) log(`Hex codes not found for ${characteristic}`) + if (logLevel <= 4) {log(`Hex codes not found for ${characteristic}`)} // if we reach here, this characteristic is not defined for the accessory so continue searching for the next one return this.decodeHierarchichalHex(hexDataObject, checkCharacteristics, toUpdateCharacteristic) } @@ -352,7 +352,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { temperature = this.temperatureCtoF(temperature) } - if (logLevel <=2) log(`Looking up temperature hex codes for ${temperature}`) + if (logLevel <= 2) {log(`Looking up temperature hex codes for ${temperature}`)} let CONFIG_CHARACTERISTICS = [ //CharacteristicName.SLEEP, @@ -364,10 +364,10 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { let temperatureHexDataObject = temperatureCodes[`${temperature}`] if (temperatureHexDataObject) { hexCode = this.decodeHierarchichalHex(temperatureHexDataObject, CONFIG_CHARACTERISTICS, toUpdateCharacteristic) - if (logLevel <=2) log(`\tSending hex codes for temperature ${temperature}`) + if (logLevel <= 2) {log(`\tSending hex codes for temperature ${temperature}`)} } else { - if (logLevel <=4) log(`\tDid not find temperature code for ${temperature}. Please update data.${this.state.targetHeaterCoolerState === 1 ? - "heat" : "cool"}.temperatureCodes in config.json`) + if (logLevel <= 4) {log(`\tDid not find temperature code for ${temperature}. Please update data.${this.state.targetHeaterCoolerState === 1 ? + "heat" : "cool"}.temperatureCodes in config.json`)} } return hexCode @@ -384,7 +384,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { let targetTemperature = targetHeaterCoolerState === Characteristic.TargetHeaterCoolerState.COOL ? coolingThresholdTemperature : heatingThresholdTemperature; - if (logLevel <=2) log(`${name} setTemperature: Changing temperature from ${previousValue} to ${targetTemperature}`) + if (logLevel <= 2) {log(`${name} setTemperature: Changing temperature from ${previousValue} to ${targetTemperature}`)} hexData = this.decodeHexFromConfig(targetHeaterCoolerState === Characteristic.TargetHeaterCoolerState.COOL ? CharacteristicName.CoolingThresholdTemperature : CharacteristicName.HeatingThresholdTemperature) await this.performSend(hexData) @@ -405,28 +405,28 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { const requestedValue = state.active // state is already set by main handler before this subhandler is called hexData = this.decodeHexFromConfig(CharacteristicName.ACTIVE) - - if(turnOnWhenOff === true && state.active === Characteristic.Active.ACTIVE && previousValue === Characteristic.Active.INACTIVE){ + + if (turnOnWhenOff === true && state.active === Characteristic.Active.ACTIVE && previousValue === Characteristic.Active.INACTIVE) { //Add ON hex to be sent first - if (logLevel <=2) this.log(`\tAdding ON code first`); + if (logLevel <= 2) {this.log(`\tAdding ON code first`);} //Add pause to the ON Code let onCode = targetHeaterCoolerState === Characteristic.TargetHeaterCoolerState.COOL ? data.cool.on : data.heat.on; let newCode = []; if (typeof onCode === 'string') { - newCode = [{"data": onCode,"pause": 1}]; + newCode = [{ "data": onCode, "pause": 1 }]; } else { - onCode[onCode.length-1].pause = 1; + onCode[onCode.length - 1].pause = 1; newCode = onCode; } //Append the On code (with pause) to the state code. if (typeof hexData === 'string') { - newCode.push({"data": hexData}); + newCode.push({ "data": hexData }); hexData = newCode; } else { hexData = newCode.concat(hexData); } } - + await this.performSend(hexData) // Update homebridge and home app state to reflect the cached state of all the available @@ -452,7 +452,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { const { state, data, config, log, logLevel, name } = this const { swingMode } = state - if (logLevel <=2) log(`${name} setSwingMode: Changing swing from ${previousValue} to ${Characteristic.SwingMode.SWING_ENABLED}`) + if (logLevel <= 2) {log(`${name} setSwingMode: Changing swing from ${previousValue} to ${Characteristic.SwingMode.SWING_ENABLED}`)} if (data.swingOn && data.swingOff) { hexData = swingMode === Characteristic.SwingMode.SWING_ENABLED ? data.swingOn : data.swingOff } @@ -463,7 +463,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { hexData = this.decodeHexFromConfig(CharacteristicName.SWING_MODE) } if (hexData === "0") { - if (logLevel <=3) log(`Swing hex codes not found, resetting state to previous value`) + if (logLevel <= 3) {log(`Swing hex codes not found, resetting state to previous value`)} state.swingMode = previousValue this.serviceManager.service .getCharacteristic(Characteristic.SwingMode) @@ -482,7 +482,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { const { state, config, log, logLevel, name } = this const { rotationSpeed } = state - if (logLevel <=2) log(`${name} setRotationSpeed: Changing RotationSpeed from ${previousValue} to ${state.rotationSpeed}`) + if (logLevel <= 2) {log(`${name} setRotationSpeed: Changing RotationSpeed from ${previousValue} to ${state.rotationSpeed}`)} // TODO: Check other locations for fanSpeed if (rotationSpeed === 0) { @@ -495,7 +495,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { hexData = this.decodeHexFromConfig(CharacteristicName.ROTATION_SPEED) if (hexData === "0") { - if (logLevel <=3) log(`Fan speed hex codes not found, resetting back to previous value`) + if (logLevel <= 3) {log(`Fan speed hex codes not found, resetting back to previous value`)} state.rotationSpeed = previousValue this.serviceManager.service .getCharacteristic(Characteristic.RotationSpeed) @@ -515,14 +515,14 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { * instead send a default value. * @param {func} callback - callback function passed in by homebridge API to be called at the end of the method */ - async monitorTemperature () { + async monitorTemperature() { const { config, host, log, logLevel, name, state } = this; const { temperatureFilePath, defaultNowTemperature, w1DeviceID } = config; - if (defaultNowTemperature !== undefined) return; + if (defaultNowTemperature !== undefined) {return;} //Force w1 and file devices to a minimum 1 minute refresh - if (w1DeviceID || temperatureFilePath) config.temperatureUpdateFrequency = Math.max(config.temperatureUpdateFrequency,60); + if (w1DeviceID || temperatureFilePath) {config.temperatureUpdateFrequency = Math.max(config.temperatureUpdateFrequency, 60);} const device = getDevice({ host, log }); @@ -535,60 +535,60 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { return; } - if(logLevel <=3) log(`${name} monitorTemperature`); + if (logLevel <= 3) {log(`${name} monitorTemperature`);} device.on('temperature', this.onTemperature.bind(this)); device.checkTemperature(); this.updateTemperatureUI(); - if (!config.isUnitTest) setInterval(this.updateTemperatureUI.bind(this), config.temperatureUpdateFrequency * 1000) + if (!config.isUnitTest) {setInterval(this.updateTemperatureUI.bind(this), config.temperatureUpdateFrequency * 1000)} } - onTemperature (temperature,humidity) { + onTemperature(temperature, humidity) { const { config, host, log, logLevel, name, state } = this; const { minTemperature, maxTemperature, temperatureAdjustment, humidityAdjustment, noHumidity } = config; // onTemperature is getting called twice. No known cause currently. // This helps prevent the same temperature from being processed twice - if (Object.keys(this.temperatureCallbackQueue).length === 0) return; + if (Object.keys(this.temperatureCallbackQueue).length === 0) {return;} temperature += temperatureAdjustment; state.currentTemperature = temperature; - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onTemperature (${temperature})`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onTemperature (${temperature})`);} - if(humidity) { - if(noHumidity){ + if (humidity) { + if (noHumidity) { state.currentHumidity = null; - }else{ + } else { humidity += humidityAdjustment; state.currentHumidity = humidity; - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onHumidity (` + humidity + `)`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onHumidity (` + humidity + `)`);} } } - + //Process Fakegato history //Ignore readings of exactly zero - the default no value value. - if(config.noHistory !== true && this.state.currentTemperature != 0.00) { + if (config.noHistory !== true && this.state.currentTemperature != 0.00) { this.lastUpdatedAt = Date.now(); - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Logging data to history: temp: ${this.state.currentTemperature}, humidity: ${this.state.currentHumidity}`); - if(noHumidity){ + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Logging data to history: temp: ${this.state.currentTemperature}, humidity: ${this.state.currentHumidity}`);} + if (noHumidity) { this.historyService.addEntry({ time: Math.round(new Date().valueOf() / 1000), temp: this.state.currentTemperature }); - }else{ + } else { this.historyService.addEntry({ time: Math.round(new Date().valueOf() / 1000), temp: this.state.currentTemperature, humidity: this.state.currentHumidity }); } } - + this.processQueuedTemperatureCallbacks(temperature); } - addTemperatureCallbackToQueue (callback) { + addTemperatureCallbackToQueue(callback) { const { config, host, logLevel, log, name, state } = this; const { mqttURL, temperatureFilePath, w1DeviceID, noHumidity } = config; // Clear the previous callback if (Object.keys(this.temperatureCallbackQueue).length > 1) { if (state.currentTemperature) { - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (clearing previous callback, using existing temperature)`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (clearing previous callback, using existing temperature)`);} this.processQueuedTemperatureCallbacks(state.currentTemperature); } } @@ -615,7 +615,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { if (mqttURL) { const temperature = this.mqttValueForIdentifier('temperature'); const humidity = noHumidity ? null : this.mqttValueForIdentifier('humidity'); - this.onTemperature(temperature || 0,humidity); + this.onTemperature(temperature || 0, humidity); return; } @@ -626,7 +626,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { if (!device || device.state === 'inactive') { if (device && device.state === 'inactive') { - if (logLevel <=3) log(`${name} addTemperatureCallbackToQueue (device no longer active, using existing temperature)`); + if (logLevel <= 3) {log(`${name} addTemperatureCallbackToQueue (device no longer active, using existing temperature)`);} } this.processQueuedTemperatureCallbacks(state.currentTemperature || 0); @@ -635,49 +635,49 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { } device.checkTemperature(); - if (logLevel <1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (requested temperature from device, waiting)`); + if (logLevel < 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} addTemperatureCallbackToQueue (requested temperature from device, waiting)`);} } - updateTemperatureFromFile () { + updateTemperatureFromFile() { const { config, host, log, logLevel, name, state } = this; const { temperatureFilePath, noHumidity, batteryAlerts } = config; let humidity = null; let temperature = null; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile reading file: ${temperatureFilePath}`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile reading file: ${temperatureFilePath}`);} fs.readFile(temperatureFilePath, 'utf8', (err, data) => { if (err) { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} updateTemperatureFromFile\n\n${err.message}`); + if (logLevel <= 4) {log(`\x1b[31m[ERROR] \x1b[0m${name} updateTemperatureFromFile\n\n${err.message}`);} } if (data === undefined || data.trim().length === 0) { - if (logLevel <=3) log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromFile error reading file: ${temperatureFilePath}, using previous Temperature`); - if (!noHumidity) humidity = (state.currentHumidity || 0); + if (logLevel <= 3) {log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromFile error reading file: ${temperatureFilePath}, using previous Temperature`);} + if (!noHumidity) {humidity = (state.currentHumidity || 0);} temperature = (state.currentTemperature || 0); } const lines = data.split(/\r?\n/); - if (/^[0-9]+\.*[0-9]*$/.test(lines[0])){ + if (/^[0-9]+\.*[0-9]*$/.test(lines[0])) { temperature = parseFloat(data); } else { lines.forEach((line) => { - if(-1 < line.indexOf(':')){ + if (-1 < line.indexOf(':')) { let value = line.split(':'); - if(value[0] == 'temperature') temperature = parseFloat(value[1]); - if(value[0] == 'humidity' && !noHumidity) humidity = parseFloat(value[1]); - if(value[0] == 'battery' && batteryAlerts) state.batteryLevel = parseFloat(value[1]); + if (value[0] == 'temperature') {temperature = parseFloat(value[1]);} + if (value[0] == 'humidity' && !noHumidity) {humidity = parseFloat(value[1]);} + if (value[0] == 'battery' && batteryAlerts) {state.batteryLevel = parseFloat(value[1]);} } }); } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile (parsed temperature: ${temperature} humidity: ${humidity})`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromFile (parsed temperature: ${temperature} humidity: ${humidity})`);} this.onTemperature(temperature, humidity); }); } - updateTemperatureFromW1 () { + updateTemperatureFromW1() { const { config, logLevel, host, log, name, state } = this; const { w1DeviceID } = config; @@ -685,28 +685,28 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { var fName = W1PATH + "/" + w1DeviceID + "/w1_slave"; var temperature; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 reading file: ${fName}`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 reading file: ${fName}`);} fs.readFile(fName, 'utf8', (err, data) => { if (err) { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} updateTemperatureFromW1\n\n${err.message}`); + if (logLevel <= 4) {log(`\x1b[31m[ERROR] \x1b[0m${name} updateTemperatureFromW1\n\n${err.message}`);} } - if(data.includes("t=")){ + if (data.includes("t=")) { var matches = data.match(/t=([0-9]+)/); temperature = parseInt(matches[1]) / 1000; - }else{ - if (logLevel <=4) log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromW1 error reading file: ${fName}, using previous Temperature`); + } else { + if (logLevel <= 4) {log(`\x1b[33m[WARNING]\x1b[0m ${name} updateTemperatureFromW1 error reading file: ${fName}, using previous Temperature`);} temperature = (state.currentTemperature || 0); } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 (parsed temperature: ${temperature})`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateTemperatureFromW1 (parsed temperature: ${temperature})`);} this.onTemperature(temperature); }); } - processQueuedTemperatureCallbacks (temperature) { - if (Object.keys(this.temperatureCallbackQueue).length === 0) return; + processQueuedTemperatureCallbacks(temperature) { + if (Object.keys(this.temperatureCallbackQueue).length === 0) {return;} Object.keys(this.temperatureCallbackQueue).forEach((callbackIdentifier) => { const callback = this.temperatureCallbackQueue[callbackIdentifier]; @@ -720,69 +720,69 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { this.checkTemperatureForAutoOnOff(temperature); } - updateTemperatureUI () { + updateTemperatureUI() { const { config, serviceManager } = this; const { noHumidity } = config; serviceManager.refreshCharacteristicUI(Characteristic.CurrentTemperature); - if(!noHumidity){serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity);}; + if (!noHumidity) { serviceManager.refreshCharacteristicUI(Characteristic.CurrentRelativeHumidity); } } - getCurrentTemperature (callback) { + getCurrentTemperature(callback) { const { config, host, logLevel, log, name, state } = this; const { defaultNowTemperature } = config; // Some devices don't include a thermometer and so we can use `defaultNowTemperature` instead if (defaultNowTemperature !== undefined) { - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} getCurrentTemperature (using defaultNowTemperature ${defaultNowTemperature} from config)`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} getCurrentTemperature (using defaultNowTemperature ${defaultNowTemperature} from config)`);} return callback(null, defaultNowTemperature); } this.addTemperatureCallbackToQueue(callback); } - getCurrentHumidity (callback) { + getCurrentHumidity(callback) { const { config, host, logLevel, log, name, state } = this; const { defaultNowTemperature } = config; return callback(null, state.currentHumidity); } - async checkTemperatureForAutoOnOff (temperature) { - const { config, host, log, name, serviceManager, state } = this; + async checkTemperatureForAutoOnOff(temperature) { + const { config, host, log, logLevel, name, serviceManager, state } = this; let { autoHeatTemperature, autoCoolTemperature, minimumAutoOnOffDuration } = config; if (this.shouldIgnoreAutoOnOff) { - if (logLevel <=2) this.log(`${name} checkTemperatureForAutoOn (ignore within ${minimumAutoOnOffDuration}s of previous auto-on/off due to "minimumAutoOnOffDuration")`); + if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOn (ignore within ${minimumAutoOnOffDuration}s of previous auto-on/off due to "minimumAutoOnOffDuration")`);} return; } - if (!autoHeatTemperature && !autoCoolTemperature) return; + if (!autoHeatTemperature && !autoCoolTemperature) {return;} if (!this.isAutoSwitchOn()) { - if (logLevel <=2) this.log(`${name} checkTemperatureForAutoOnOff (autoSwitch is off)`); + if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (autoSwitch is off)`);} return; } - if (logLevel <=2) this.log(`${name} checkTemperatureForAutoOnOff`); + if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff`);} if (autoHeatTemperature && temperature < autoHeatTemperature) { this.state.isRunningAutomatically = true; - if (logLevel <=2) this.log(`${name} checkTemperatureForAutoOnOff (${temperature} < ${autoHeatTemperature}: auto heat)`); + if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (${temperature} < ${autoHeatTemperature}: auto heat)`);} serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.HEAT); } else if (autoCoolTemperature && temperature > autoCoolTemperature) { this.state.isRunningAutomatically = true; - if (logLevel <=2) this.log(`${name} checkTemperatureForAutoOnOff (${temperature} > ${autoCoolTemperature}: auto cool)`); + if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (${temperature} > ${autoCoolTemperature}: auto cool)`);} serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.COOL); } else { - if (logLevel <=1) this.log(`${name} checkTemperatureForAutoOnOff (temperature is ok)`); + if (logLevel <= 1) {this.log(`${name} checkTemperatureForAutoOnOff (temperature is ok)`);} if (this.state.isRunningAutomatically) { this.isAutomatedOff = true; - if (logLevel <=2) this.log(`${name} checkTemperatureForAutoOnOff (auto off)`); + if (logLevel <= 2) {this.log(`${name} checkTemperatureForAutoOnOff (auto off)`);} serviceManager.setCharacteristic(Characteristic.TargetHeatingCoolingState, Characteristic.TargetHeatingCoolingState.OFF); } else { return; @@ -796,7 +796,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { this.shouldIgnoreAutoOnOff = false; } - getTemperatureDisplayUnits (callback) { + getTemperatureDisplayUnits(callback) { const { config } = this; const temperatureDisplayUnits = (config.units.toLowerCase() === 'f') ? Characteristic.TemperatureDisplayUnits.FAHRENHEIT : Characteristic.TemperatureDisplayUnits.CELSIUS; @@ -804,11 +804,11 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { } // MQTT - onMQTTMessage (identifier, message) { + onMQTTMessage(identifier, message) { const { state, logLevel, log, name } = this; if (identifier !== 'unknown' && identifier !== 'temperature' && identifier !== 'humidity' && identifier !== 'battery' && identifier !== 'combined') { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt message received with unexpected identifier: ${identifier}, ${message.toString()})`); + if (logLevel <= 4) {log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt message received with unexpected identifier: ${identifier}, ${message.toString()})`);} return; } @@ -818,7 +818,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { let temperatureValue, humidityValue, batteryValue; let objectFound = false; let value = this.mqttValuesTemp[identifier]; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${value})`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${value})`);} try { //Attempt to parse JSON - if result is JSON const temperatureJSON = JSON.parse(value); @@ -826,73 +826,73 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { if (typeof temperatureJSON === 'object') { objectFound = true; let values = []; - if (identifier !== 'temperature' && identifier !== 'battery'){ + if (identifier !== 'temperature' && identifier !== 'battery') { //Try to locate other Humidity fields - if (values.length === 0) values = findKey(temperatureJSON, 'Hum'); - if (values.length === 0) values = findKey(temperatureJSON, 'hum'); - if (values.length === 0) values = findKey(temperatureJSON, 'Humidity'); - if (values.length === 0) values = findKey(temperatureJSON, 'humidity'); - if (values.length === 0) values = findKey(temperatureJSON, 'RelativeHumidity'); - if (values.length === 0) values = findKey(temperatureJSON, 'relativehumidity'); - if(values.length > 0) { + if (values.length === 0) {values = findKey(temperatureJSON, 'Hum');} + if (values.length === 0) {values = findKey(temperatureJSON, 'hum');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Humidity');} + if (values.length === 0) {values = findKey(temperatureJSON, 'humidity');} + if (values.length === 0) {values = findKey(temperatureJSON, 'RelativeHumidity');} + if (values.length === 0) {values = findKey(temperatureJSON, 'relativehumidity');} + if (values.length > 0) { humidityValue = values; values = []; } } - if (identifier !== 'temperature' && identifier !== 'humidity'){ + if (identifier !== 'temperature' && identifier !== 'humidity') { //Try to locate other Battery fields - if (values.length === 0) values = findKey(temperatureJSON, 'Batt'); - if (values.length === 0) values = findKey(temperatureJSON, 'batt'); - if (values.length === 0) values = findKey(temperatureJSON, 'Battery'); - if (values.length === 0) values = findKey(temperatureJSON, 'battery'); - if(values.length > 0) { + if (values.length === 0) {values = findKey(temperatureJSON, 'Batt');} + if (values.length === 0) {values = findKey(temperatureJSON, 'batt');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Battery');} + if (values.length === 0) {values = findKey(temperatureJSON, 'battery');} + if (values.length > 0) { batteryValue = values; values = []; } } - if(identifier !== 'battery' && identifier !== 'humidity'){ + if (identifier !== 'battery' && identifier !== 'humidity') { //Try to locate other Temperature fields - if (values.length === 0) values = findKey(temperatureJSON, 'temp'); - if (values.length === 0) values = findKey(temperatureJSON, 'Temp'); - if (values.length === 0) values = findKey(temperatureJSON, 'temperature'); - if (values.length === 0) values = findKey(temperatureJSON, 'Temperature'); - if(values.length > 0) { + if (values.length === 0) {values = findKey(temperatureJSON, 'temp');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Temp');} + if (values.length === 0) {values = findKey(temperatureJSON, 'temperature');} + if (values.length === 0) {values = findKey(temperatureJSON, 'Temperature');} + if (values.length > 0) { temperatureValue = values; } } - + if (values.length > 0) { value = values[0]; } else { value = undefined; } } - } catch (err) {} //Result couldn't be parsed as JSON + } catch (err) { } //Result couldn't be parsed as JSON - if(objectFound) { - if(temperatureValue !== undefined && temperatureValue.length > 0) { - this.mqttValues['temperature'] = parseFloat(temperatureValue[0]); + if (objectFound) { + if (temperatureValue !== undefined && temperatureValue.length > 0) { + this.mqttValues.temperature = parseFloat(temperatureValue[0]); } - if(batteryValue !== undefined && batteryValue.length > 0) { + if (batteryValue !== undefined && batteryValue.length > 0) { state.batteryLevel = parseFloat(batteryValue[0]); - this.mqttValues['battery'] = parseFloat(batteryValue[0]); + this.mqttValues.battery = parseFloat(batteryValue[0]); } - if(humidityValue !== undefined && humidityValue.length > 0) { - this.mqttValues['humidity'] = parseFloat(humidityValue[0]); + if (humidityValue !== undefined && humidityValue.length > 0) { + this.mqttValues.humidity = parseFloat(humidityValue[0]); } - }else{ + } else { if (value === undefined || (typeof value === 'string' && value.trim().length === 0)) { - if (logLevel <=3) log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt value not found)`); + if (logLevel <= 3) {log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt value not found)`);} return; } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (parsed value: ${value})`); + if (logLevel <= 1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (parsed value: ${value})`);} value = parseFloat(value); - if (identifier == 'battery'){ + if (identifier == 'battery') { state.batteryLevel = value; return; - } + } this.mqttValues[identifier] = value; } this.updateTemperatureUI(); @@ -948,7 +948,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { const isValidTemperature = (stringValue) => isFinite(Number(stringValue)) // Arrow function to check if supplied string is a int or float parseable number const dataObjectKeys = Object.keys(dataObject) - if (this.config.logLevel <=1) this.log(`Checking keys ${dataObjectKeys}`) + if (this.config.logLevel <= 1) {this.log(`Checking keys ${dataObjectKeys}`)} if (!configObject.temperatureCodes && dataObjectKeys.every(isValidTemperature)) { configObject.temperatureCodes = true } @@ -964,7 +964,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { for (const [key, value] of Object.entries(dataObject)) { - if (this.config.logLevel <=1) this.log(`Going into key -> ${key}`) + if (this.config.logLevel <= 1) {this.log(`Going into key -> ${key}`)} if (typeof value === 'object' && !Array.isArray(value)) { this.validateOptionalCharacteristics(value, configObject) } @@ -1002,11 +1002,11 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { this.validateOptionalCharacteristics(heat.temperatureCodes, available.heat) } - if (logLevel <=2) this.log(`INFO ${name} configured with optional characteristics: + if (logLevel <= 2) {this.log(`INFO ${name} configured with optional characteristics: Temperature control: ${available.cool.temperatureCodes} ${available.heat.temperatureCodes} Rotation speed: ${available.cool.rotationSpeed} ${available.heat.rotationSpeed} Swing mode: ${available.cool.swingMode} ${available.heat.swingMode} - Sleep: ${available.cool.sleep} ${available.heat.sleep}`) + Sleep: ${available.cool.sleep} ${available.heat.sleep}`)} } /** @@ -1087,7 +1087,7 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { } if (!available.coolMode && !available.heatMode) - throw new Error(`At least one of data.cool or data.heat object is required in config.json. Please update your config.json file`) + {throw new Error(`At least one of data.cool or data.heat object is required in config.json. Please update your config.json file`)} // Default power on mode for first run when both heat & cool modes are available. if (config.defaultMode === undefined) { config.defaultMode = available.coolMode ? "cool" : "heat" @@ -1103,11 +1103,11 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { // this is a safeguard and should never happen unless the base constructor invokes // setupServiceManager before validating config file if (config === undefined || typeof config !== 'object') - throw new Error('config.json is not setup properly, please check documentation') + {throw new Error('config.json is not setup properly, please check documentation')} const { data } = config if (data === undefined || typeof data !== 'object') - throw new Error(`data object is required in config.json for initializing accessory`) + {throw new Error(`data object is required in config.json for initializing accessory`)} config.defaultRotationSpeed = config.defaultRotationSpeed || 100 config.internalConfig = new Object() @@ -1118,13 +1118,13 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { this.configureTemperatures() this.configureOptionalCharacteristics() - if (logLevel <=2) log(`${name} initialized with modes Cool: ${available.coolMode ? '\u2705' : '\u274c'}, Heat: ${available.heatMode ? '\u2705' : '\u274c'},\ + if (logLevel <= 2) {log(`${name} initialized with modes Cool: ${available.coolMode ? '\u2705' : '\u274c'}, Heat: ${available.heatMode ? '\u2705' : '\u274c'},\ config temperatures as: ${this.config.temperatureUnits === "f" ? '\u00b0F' : '\u00b0C'}\ Using following default configuration: Power on mode: ${config.defaultMode} Now Temperature: ${config.defaultNowTemperature} \u00b0C Cooling Temperature: ${config.coolingThresholdTemperature} \u00b0C - Heating Temperature: ${config.heatingThresholdTemperature} \u00b0C`) + Heating Temperature: ${config.heatingThresholdTemperature} \u00b0C`)} } // Service Manager Setup @@ -1177,14 +1177,14 @@ class HeaterCoolerAccessory extends BroadlinkRMAccessory { bind: this }); - if (!config.noHumidity){ + if (!config.noHumidity) { this.serviceManager.addGetCharacteristic({ - name: 'currentHumidity', - type: Characteristic.CurrentRelativeHumidity, - method: this.getCurrentHumidity, - bind: this + name: 'currentHumidity', + type: Characteristic.CurrentRelativeHumidity, + method: this.getCurrentHumidity, + bind: this }) - }; + } // Setting up Required Characteristic Properties /** diff --git a/accessories/humidifier-dehumidifier.js b/accessories/humidifier-dehumidifier.js index 426298d3..6bee7e51 100644 --- a/accessories/humidifier-dehumidifier.js +++ b/accessories/humidifier-dehumidifier.js @@ -57,54 +57,54 @@ class HumidifierDehumidifierAccessory extends FanAccessory { } async setCurrentState (hexData, previousValue) { - const { data, config, log, logLevel, name, state, serviceManager } = this; + const { data, config, log, logLevel, name, state, serviceManager } = this; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} setCurrentState: requested update from ${previousValue} to ${state.currentState}`); - - // Ignore if no change to the targetPosition - if (state.currentState === previousValue || !state.switchState) return; - - switch(state.currentState){ - case Characteristic.CurrentHumidifierDehumidifierState.DEHUMIDIFYING: - hexData = data.targetStateDehumidifier; - break; - case Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING: - hexData = data.targetStateHumidifier; - break; - case Characteristic.CurrentHumidifierDehumidifierState.IDLE: - hexData = data.fanOnly; - break; - } + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} setCurrentState: requested update from ${previousValue} to ${state.currentState}`);} + + // Ignore if no change to the targetPosition + if (state.currentState === previousValue || !state.switchState) {return;} + + switch(state.currentState){ + case Characteristic.CurrentHumidifierDehumidifierState.DEHUMIDIFYING: + hexData = data.targetStateDehumidifier; + break; + case Characteristic.CurrentHumidifierDehumidifierState.HUMIDIFYING: + hexData = data.targetStateHumidifier; + break; + case Characteristic.CurrentHumidifierDehumidifierState.IDLE: + hexData = data.fanOnly; + break; + } - if (logLevel <=2) log(`${name} setCurrentState: currently ${previousValue}, changing to ${state.currentState}`); + if (logLevel <=2) {log(`${name} setCurrentState: currently ${previousValue}, changing to ${state.currentState}`);} - if(hexData) await this.performSend(hexData); - serviceManager.refreshCharacteristicUI(Characteristic.CurrentHumidifierDehumidifierState); - this.previouslyOff = false; + if(hexData) {await this.performSend(hexData);} + serviceManager.refreshCharacteristicUI(Characteristic.CurrentHumidifierDehumidifierState); + this.previouslyOff = false; } async setHumidifierThreshold (hexData, previousValue) { const { config, name, log, state, logLevel } = this; - if (state.HumidifierThreshold === previousValue && config.preventResendHex && !this.previouslyOff) return; + if (state.HumidifierThreshold === previousValue && config.preventResendHex && !this.previouslyOff) {return;} let desiredState = this.getDesiredState (); let previousState = state.currentState; - if (state.currentState === desiredState) return; + if (state.currentState === desiredState) {return;} - if (logLevel <=2) log(`${name} setHumidifierThreshold: currently ${previousValue} to ${state.DehumidifierThreshold}, changing to ${state.HumidifierThreshold} to ${state.DehumidifierThreshold}`); + if (logLevel <=2) {log(`${name} setHumidifierThreshold: currently ${previousValue} to ${state.DehumidifierThreshold}, changing to ${state.HumidifierThreshold} to ${state.DehumidifierThreshold}`);} state.currentState = desiredState; this.setCurrentState (hexData, previousState); } async setDehumidifierThreshold (hexData, previousValue) { const { config, name, log, state, logLevel } = this; - if (state.DehumidifierThreshold === previousValue && config.preventResendHex && !this.previouslyOff) return; + if (state.DehumidifierThreshold === previousValue && config.preventResendHex && !this.previouslyOff) {return;} let desiredState = this.getDesiredState (); let previousState = state.currentState; - if (state.currentState === desiredState) return; + if (state.currentState === desiredState) {return;} - if (logLevel <=2) log(`${name} setDeumidifierThreshold: currently ${state.HumidifierThreshold} to ${previousValue}, changing to ${state.HumidifierThreshold} to ${state.DehumidifierThreshold}`); + if (logLevel <=2) {log(`${name} setDeumidifierThreshold: currently ${state.HumidifierThreshold} to ${previousValue}, changing to ${state.HumidifierThreshold} to ${state.DehumidifierThreshold}`);} state.currentState = desiredState; this.setCurrentState (hexData, previousState); } @@ -141,7 +141,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { } return desiredState; - } + } async updateDeviceState () { const { serviceManager, logLevel, config, name, log, state } = this; @@ -173,10 +173,10 @@ class HumidifierDehumidifierAccessory extends FanAccessory { let desiredState = this.getDesiredState (); - if (state.currentState === desiredState && !this.previouslyOff) return; + if (state.currentState === desiredState && !this.previouslyOff) {return;} let previousState = state.currentState; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateDeviceState: currently ${state.currentState}, changing to ${desiredState}`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateDeviceState: currently ${state.currentState}, changing to ${desiredState}`);} state.currentState = desiredState; this.setCurrentState (null, previousState); @@ -195,14 +195,14 @@ class HumidifierDehumidifierAccessory extends FanAccessory { return; } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} monitorHumidity`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} monitorHumidity`);} //Broadlink module emits 'temperature for both sensors. device.on('temperature', this.onHumidity.bind(this)); device.checkHumidity(); this.updateHumidityUI(); - if (!config.isUnitTest && !config.noHumidity) setInterval(this.updateHumidityUI.bind(this), config.humidityUpdateFrequency * 1000) + if (!config.isUnitTest && !config.noHumidity) {setInterval(this.updateHumidityUI.bind(this), config.humidityUpdateFrequency * 1000)} } onHumidity (temperature,humidity) { @@ -211,17 +211,17 @@ class HumidifierDehumidifierAccessory extends FanAccessory { // onHumidity is getting called twice. No known cause currently. // This helps prevent the same humidity from being processed twice - if (Object.keys(this.humidityCallbackQueue).length === 0) return; + if (Object.keys(this.humidityCallbackQueue).length === 0) {return;} humidity += humidityAdjustment; state.currentHumidity = humidity; - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onHumidity (` + humidity + `)`); + if(logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onHumidity (` + humidity + `)`);} //Fakegato history update //Ignore readings of exactly zero - the default no value value. if(config.noHistory !== true && this.state.currentHumidity != 0) { this.lastUpdatedAt = Date.now(); - if(logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Logging data to history: humidity: ${this.state.currentHumidity}`); + if(logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Logging data to history: humidity: ${this.state.currentHumidity}`);} this.historyService.addEntry({ time: Math.round(new Date().valueOf() / 1000), humidity: this.state.currentHumidity }); } @@ -235,7 +235,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { // Clear the previous callback if (Object.keys(this.humidityCallbackQueue).length > 1) { if (state.currentHumidity) { - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} addHumidityCallbackToQueue (clearing previous callback, using existing humidity)`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} addHumidityCallbackToQueue (clearing previous callback, using existing humidity)`);} this.processQueuedHumidityCallbacks(state.currentHumidity); } } @@ -278,7 +278,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { if (!device || device.state === 'inactive') { if (device && device.state === 'inactive') { - if (logLevel <=3) log(`${name} addHumidityCallbackToQueue (device no longer active, using existing humidity)`); + if (logLevel <=3) {log(`${name} addHumidityCallbackToQueue (device no longer active, using existing humidity)`);} } this.processQueuedHumidityCallbacks(state.currentHumidity || 0); @@ -287,7 +287,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { } device.checkHumidity(); - if (logLevel <1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} addHumidityCallbackToQueue (requested humidity from device, waiting)`); + if (logLevel <1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} addHumidityCallbackToQueue (requested humidity from device, waiting)`);} } updateHumidityFromFile () { @@ -296,15 +296,15 @@ class HumidifierDehumidifierAccessory extends FanAccessory { let humidity = null; let temperature = null; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateHumidityFromFile reading file: ${humidity}`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateHumidityFromFile reading file: ${humidity}`);} fs.readFile(humidityFilePath, 'utf8', (err, data) => { if (err) { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} updateHumidityFromFile\n\n${err.message}`); + if (logLevel <=4) {log(`\x1b[31m[ERROR] \x1b[0m${name} updateHumidityFromFile\n\n${err.message}`);} } if (data === undefined || data.trim().length === 0) { - if (logLevel <=3) log(`\x1b[33m[WARNING]\x1b[0m ${name} updateHumidityFromFile error reading file: ${humidityFilePath}, using previous Temperature`); + if (logLevel <=3) {log(`\x1b[33m[WARNING]\x1b[0m ${name} updateHumidityFromFile error reading file: ${humidityFilePath}, using previous Temperature`);} humidity = (state.currentHumidity || 0); } @@ -315,14 +315,14 @@ class HumidifierDehumidifierAccessory extends FanAccessory { lines.forEach((line) => { if(-1 < line.indexOf(':')){ let value = line.split(':'); - if(value[0] == 'temperature') temperature = parseFloat(value[1]); - if(value[0] == 'humidity') humidity = parseFloat(value[1]); - if(value[0] == 'battery' && batteryAlerts) state.batteryLevel = parseFloat(value[1]); + if(value[0] == 'temperature') {temperature = parseFloat(value[1]);} + if(value[0] == 'humidity') {humidity = parseFloat(value[1]);} + if(value[0] == 'battery' && batteryAlerts) {state.batteryLevel = parseFloat(value[1]);} } }); } - if (logLevel >= 4) log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateHumidityFromFile (parsed humidity: ${humidity})`); + if (logLevel >= 4) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} updateHumidityFromFile (parsed humidity: ${humidity})`);} this.onHumidity(temperature, humidity); }); @@ -333,7 +333,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { const { state, logLevel, log, name } = this; if (identifier !== 'unknown' && identifier !== 'humidity' && identifier !== 'battery') { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt message received with unexpected identifier: ${identifier}, ${message.toString()})`); + if (logLevel <=4) {log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt message received with unexpected identifier: ${identifier}, ${message.toString()})`);} return; } @@ -342,7 +342,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { let humidityValue, batteryValue; let objectFound = false; let value = this.mqttValuesTemp[identifier]; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${value})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (raw value: ${value})`);} try { //Attempt to parse JSON - if result is JSON @@ -353,10 +353,10 @@ class HumidifierDehumidifierAccessory extends FanAccessory { let values = []; if ((identifier !== 'humidity')){ //Try to locate Battery fields - if (values.length === 0) values = findKey(humidityJSON, 'Batt'); - if (values.length === 0) values = findKey(humidityJSON, 'batt'); - if (values.length === 0) values = findKey(humidityJSON, 'Battery'); - if (values.length === 0) values = findKey(humidityJSON, 'battery'); + if (values.length === 0) {values = findKey(humidityJSON, 'Batt');} + if (values.length === 0) {values = findKey(humidityJSON, 'batt');} + if (values.length === 0) {values = findKey(humidityJSON, 'Battery');} + if (values.length === 0) {values = findKey(humidityJSON, 'battery');} if(values.length > 0) { batteryValue = values; values = []; @@ -364,12 +364,12 @@ class HumidifierDehumidifierAccessory extends FanAccessory { } if (identifier !== 'battery'){ //Try to locate Humidity fields - if (values.length === 0) values = findKey(humidityJSON, 'Hum'); - if (values.length === 0) values = findKey(humidityJSON, 'hum'); - if (values.length === 0) values = findKey(humidityJSON, 'Humidity'); - if (values.length === 0) values = findKey(humidityJSON, 'humidity'); - if (values.length === 0) values = findKey(humidityJSON, 'RelativeHumidity'); - if (values.length === 0) values = findKey(humidityJSON, 'relativehumidity'); + if (values.length === 0) {values = findKey(humidityJSON, 'Hum');} + if (values.length === 0) {values = findKey(humidityJSON, 'hum');} + if (values.length === 0) {values = findKey(humidityJSON, 'Humidity');} + if (values.length === 0) {values = findKey(humidityJSON, 'humidity');} + if (values.length === 0) {values = findKey(humidityJSON, 'RelativeHumidity');} + if (values.length === 0) {values = findKey(humidityJSON, 'relativehumidity');} if(values.length > 0) { humidityValue = values; values = []; @@ -386,19 +386,19 @@ class HumidifierDehumidifierAccessory extends FanAccessory { if(objectFound) { if(humidityValue !== undefined && humidityValue.length > 0) { - this.mqttValues['humidity'] = parseFloat(humidityValue[0]); + this.mqttValues.humidity = parseFloat(humidityValue[0]); } if(batteryValue !== undefined && batteryValue.length > 0) { state.batteryLevel = parseFloat(batteryValue[0]); - this.mqttValues['battery'] = parseFloat(batteryValue[0]); + this.mqttValues.battery = parseFloat(batteryValue[0]); } }else{ if (value === undefined || (typeof value === 'string' && value.trim().length === 0)) { - if (logLevel <=4) log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt value not found)`); + if (logLevel <=4) {log(`\x1b[31m[ERROR] \x1b[0m${name} onMQTTMessage (mqtt value not found)`);} return; } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (parsed value: ${value})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} onMQTTMessage (parsed value: ${value})`);} value = parseFloat(value); if (identifier == 'battery'){ @@ -411,7 +411,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { } processQueuedHumidityCallbacks (humidity) { - if (Object.keys(this.humidityCallbackQueue).length === 0) return; + if (Object.keys(this.humidityCallbackQueue).length === 0) {return;} Object.keys(this.humidityCallbackQueue).forEach((callbackIdentifier) => { const callback = this.humidityCallbackQueue[callbackIdentifier]; @@ -441,9 +441,9 @@ class HumidifierDehumidifierAccessory extends FanAccessory { const { on, off, targetStateHumidifier, targetStateDehumidifier, lockControls, unlockControls, swingToggle } = data || {}; // Defaults - if (config.showLockPhysicalControls !== false) config.showLockPhysicalControls = true - if (config.showSwingMode !== false && config.hideSwingMode !== true) config.showSwingMode = true - if (config.showRotationDirection !== false && config.hideRotationDirection !== true) config.showRotationDirection = true + if (config.showLockPhysicalControls !== false) {config.showLockPhysicalControls = true} + if (config.showSwingMode !== false && config.hideSwingMode !== true) {config.showSwingMode = true} + if (config.showRotationDirection !== false && config.hideRotationDirection !== true) {config.showRotationDirection = true} this.serviceManager = new ServiceManagerTypes[serviceManagerType](name, Service.HumidifierDehumidifier, this.log); @@ -515,7 +515,7 @@ class HumidifierDehumidifierAccessory extends FanAccessory { .getCharacteristic(Characteristic.TargetHumidifierDehumidifierState) .setProps({ validValues: [0, 1, 2] - }); + }); } if (config.humidifierOnly) { @@ -523,19 +523,19 @@ class HumidifierDehumidifierAccessory extends FanAccessory { .getCharacteristic(Characteristic.TargetHumidifierDehumidifierState) .setProps({ validValues: [1] - }); + }); this.serviceManager .getCharacteristic(Characteristic.CurrentHumidifierDehumidifierState) .setProps({ - validValues: [0, 2] - }); + validValues: [0, 2] + }); this.serviceManager .getCharacteristic(Characteristic.RelativeHumidityDehumidifierThreshold) .setProps({ validValues: [100] - }); + }); } if (config.deHumidifierOnly) { @@ -543,19 +543,19 @@ class HumidifierDehumidifierAccessory extends FanAccessory { .getCharacteristic(Characteristic.TargetHumidifierDehumidifierState) .setProps({ validValues: [2] - }); + }); this.serviceManager .getCharacteristic(Characteristic.CurrentHumidifierDehumidifierState) .setProps({ validValues: [0, 3] - }); + }); this.serviceManager .getCharacteristic(Characteristic.RelativeHumidityHumidifierThreshold) .setProps({ validValues: [0] - }); + }); } if (config.showLockPhysicalControls) { diff --git a/accessories/humiditySensor.js b/accessories/humiditySensor.js index 1d84e0a8..6f824011 100644 --- a/accessories/humiditySensor.js +++ b/accessories/humiditySensor.js @@ -42,14 +42,14 @@ class HumiditySensorAccessory extends HumidifierAccessory { return; } - if (logLevel <=1) log(`${name} monitorHumidity`); + if (logLevel <=1) {log(`${name} monitorHumidity`);} //Broadlink module emits 'temperature for both sensors. device.on('temperature', this.onHumidity.bind(this)); device.checkHumidity(); this.updateHumidityUI(); - if (!config.isUnitTest) setInterval(this.updateHumidityUI.bind(this), config.humidityUpdateFrequency * 1000) + if (!config.isUnitTest) {setInterval(this.updateHumidityUI.bind(this), config.humidityUpdateFrequency * 1000)} } //Method inhertied but not required @@ -59,14 +59,14 @@ class HumiditySensorAccessory extends HumidifierAccessory { const { config, name, state, log, logLevel } = this; const batteryAlert = state.batteryLevel <= 20? Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Level:`,state.batteryLevel,'Alert:',batteryAlert); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Level:`,state.batteryLevel,'Alert:',batteryAlert);} callback(null, batteryAlert); } getBatteryLevel (callback) { const { config, name, state, log, logLevel } = this; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Level:`,state.batteryLevel); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Level:`,state.batteryLevel);} callback(null, parseFloat(state.batteryLevel)); } @@ -97,7 +97,7 @@ class HumiditySensorAccessory extends HumidifierAccessory { method: this.getBatteryLevel, bind: this }) - }; + } } } diff --git a/accessories/learnCode.js b/accessories/learnCode.js index a3b5d9b9..98a95f85 100644 --- a/accessories/learnCode.js +++ b/accessories/learnCode.js @@ -7,19 +7,19 @@ const BroadlinkRMAccessory = require('./accessory'); class LearnIRAccessory extends BroadlinkRMAccessory { - constructor (log, config = {}, serviceManagerType) { + constructor(log, config = {}, serviceManagerType) { // Set a default name for the accessory - if (!config.name) config.name = 'Learn Code'; + if (!config.name) {config.name = 'Learn Code';} config.persistState = false; super(log, config, serviceManagerType); } - setDefaults () { + setDefaults() { this.state.switchState = false; } - - toggleLearning (props, on, callback) { + + toggleLearning(props, on, callback) { const { config, serviceManager } = this; const { disableAutomaticOff, scanRF, scanFrequency } = config; @@ -48,9 +48,9 @@ class LearnIRAccessory extends BroadlinkRMAccessory { } } - setupServiceManager () { + setupServiceManager() { const { data, name, config, serviceManagerType } = this; - const { on, off } = data || { }; + const { on, off } = data || {}; this.serviceManager = new ServiceManagerTypes[serviceManagerType](name, Service.Switch, this.log); @@ -61,9 +61,8 @@ class LearnIRAccessory extends BroadlinkRMAccessory { setMethod: this.toggleLearning.bind(this), bind: this, props: { - - }, - bind: this + + } }) } } diff --git a/accessories/light.js b/accessories/light.js index 64359b29..d3e3b48b 100644 --- a/accessories/light.js +++ b/accessories/light.js @@ -1,5 +1,5 @@ const { assert } = require('chai'); -const ServiceManagerTypes = require('../helpers/serviceManagerTypes');; +const ServiceManagerTypes = require('../helpers/serviceManagerTypes'); const delayForDuration = require('../helpers/delayForDuration'); const catchDelayCancelError = require('../helpers/catchDelayCancelError') @@ -40,14 +40,14 @@ class LightAccessory extends SwitchAccessory { state.switchState = false; serviceManager.setCharacteristic(Characteristic.Brightness, brightness); } else { - if (hexData) await this.performSend(hexData); + if (hexData) {await this.performSend(hexData);} this.checkAutoOnOff(); } } else { this.lastBrightness = undefined; - if (hexData) await this.performSend(hexData); + if (hexData) {await this.performSend(hexData);} this.checkAutoOnOff(); } @@ -149,7 +149,7 @@ class LightAccessory extends SwitchAccessory { const { data } = this; const allHexKeys = Object.keys(data || {}); - if (!filter) return allHexKeys; + if (!filter) {return allHexKeys;} // Create an array of value specified in the data config const foundValues = []; @@ -157,7 +157,7 @@ class LightAccessory extends SwitchAccessory { allHexKeys.forEach((key) => { const parts = key.split(filter); - if (parts.length !== 2) return; + if (parts.length !== 2) {return;} foundValues.push(parts[1]); }) diff --git a/accessories/switch.js b/accessories/switch.js index ca4af2a9..c311c4c6 100644 --- a/accessories/switch.js +++ b/accessories/switch.js @@ -10,7 +10,7 @@ class SwitchAccessory extends BroadlinkRMAccessory { constructor (log, config = {}, serviceManagerType) { super(log, config, serviceManagerType); - if (!config.isUnitTest) this.checkPing(ping) + if (!config.isUnitTest) {this.checkPing(ping)} } @@ -79,7 +79,7 @@ class SwitchAccessory extends BroadlinkRMAccessory { const { config } = this let { pingIPAddress, pingFrequency, pingUseArp } = config; - if (!pingIPAddress) return + if (!pingIPAddress) {return} // Setup Ping/Arp-based State if(!pingUseArp) { @@ -112,7 +112,7 @@ class SwitchAccessory extends BroadlinkRMAccessory { this.stateChangeInProgress = true; this.reset(); - if (hexData) await this.performSend(hexData); + if (hexData) {await this.performSend(hexData);} if (config.stateless === true) { state.switchState = false; diff --git a/accessories/switchMulti.js b/accessories/switchMulti.js index ca6307c0..d8efaa2b 100644 --- a/accessories/switchMulti.js +++ b/accessories/switchMulti.js @@ -11,7 +11,7 @@ class SwitchMultiAccessory extends SwitchAccessory { const { data } = this - if (!Array.isArray(data)) return log('The "switch-multi" type requires the config value for "data" to be an array of hex codes.') + if (!Array.isArray(data)) {return log('The "switch-multi" type requires the config value for "data" to be an array of hex codes.')} } checkStateWithPing () { } diff --git a/accessories/switchMultiRepeat.js b/accessories/switchMultiRepeat.js index 8baec973..0ffbbdcb 100644 --- a/accessories/switchMultiRepeat.js +++ b/accessories/switchMultiRepeat.js @@ -7,18 +7,18 @@ const SwitchAccessory = require('./switch'); class SwitchMultiAccessory extends SwitchAccessory { - constructor (log, config = {}, serviceManagerType) { + constructor(log, config = {}, serviceManagerType) { super(log, config, serviceManagerType); const { data } = this - if (!Array.isArray(data)) return log('The "switch-multi-repeat" type requires the config value for "data" an array of objects.') + if (!Array.isArray(data)) {return log('The "switch-multi-repeat" type requires the config value for "data" an array of objects.')} const nonObjects = data.filter(obj => typeof obj !== 'object') - if (nonObjects.length > 0) return log('The "switch-multi-repeat" type requires the config value for "data" an array of objects.') + if (nonObjects.length > 0) {return log('The "switch-multi-repeat" type requires the config value for "data" an array of objects.')} } - setDefaults () { + setDefaults() { super.setDefaults(); const { config } = this; @@ -26,7 +26,7 @@ class SwitchMultiAccessory extends SwitchAccessory { config.interval = config.interval || 1; } - reset () { + reset() { super.reset(); // Clear Timeouts @@ -41,9 +41,9 @@ class SwitchMultiAccessory extends SwitchAccessory { } } - checkStateWithPing () { } + checkStateWithPing() { } - async setSwitchState (hexData) { + async setSwitchState(hexData) { const { name, config, data, log, state } = this; let { interval, pause, sendCount } = config; @@ -65,7 +65,7 @@ class SwitchMultiAccessory extends SwitchAccessory { await this.pauseTimeoutPromise; } else if (index < data.length - 1) { this.intervalTimeoutPromise = delayForDuration(interval); - await intervalTimeoutPromise; + await this.intervalTimeoutPromise; } } @@ -73,7 +73,7 @@ class SwitchMultiAccessory extends SwitchAccessory { }); } - async performRepeatSend (hexConfig) { + async performRepeatSend(hexConfig) { const { host, log, name, logLevel } = this; let { data, interval, sendCount } = hexConfig; @@ -90,7 +90,7 @@ class SwitchMultiAccessory extends SwitchAccessory { } } - setupServiceManager () { + setupServiceManager() { const { data, log, name, config, serviceManagerType } = this; setTimeout(() => { diff --git a/accessories/switchRepeat.js b/accessories/switchRepeat.js index f748d859..12f2b97a 100644 --- a/accessories/switchRepeat.js +++ b/accessories/switchRepeat.js @@ -40,8 +40,8 @@ class SwitchRepeatAccessory extends SwitchAccessory { const { config, host, log, name, state, logLevel } = this; let { interval, onSendCount, offSendCount, sendCount } = config; - if (state.switchState && onSendCount) sendCount = onSendCount; - if (!state.switchState && offSendCount) sendCount = offSendCount; + if (state.switchState && onSendCount) {sendCount = onSendCount;} + if (!state.switchState && offSendCount) {sendCount = offSendCount;} // Itterate through each hex config in the array for (let index = 0; index < sendCount; index++) { diff --git a/accessories/temperatureSensor.js b/accessories/temperatureSensor.js index 20afa65d..3536b247 100644 --- a/accessories/temperatureSensor.js +++ b/accessories/temperatureSensor.js @@ -45,14 +45,14 @@ class TemperatureSensorAccessory extends AirconAccessory { const { config, name, state, log, logLevel } = this; const batteryAlert = state.batteryLevel <= 20? Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Alert:`,batteryAlert); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Alert:`,batteryAlert);} callback(null, batteryAlert); } getBatteryLevel (callback) { const { config, name, state, log, logLevel } = this; - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Level:`,state.batteryLevel); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m ${name} Battery Level:`,state.batteryLevel);} callback(null, parseFloat(state.batteryLevel)); } @@ -77,7 +77,7 @@ class TemperatureSensorAccessory extends AirconAccessory { method: this.getCurrentHumidity, bind: this }) - }; + } if (config.batteryAlerts){ this.serviceManager.addGetCharacteristic({ @@ -93,7 +93,7 @@ class TemperatureSensorAccessory extends AirconAccessory { method: this.getBatteryLevel, bind: this }) - }; + } this.serviceManager.addGetCharacteristic({ name: 'temperatureDisplayUnits', diff --git a/accessories/tv.js b/accessories/tv.js index cc04ca0a..b4fc68de 100644 --- a/accessories/tv.js +++ b/accessories/tv.js @@ -9,7 +9,7 @@ class TVAccessory extends BroadlinkRMAccessory { constructor(log, config = {}, serviceManagerType) { super(log, config, serviceManagerType); - if (!config.isUnitTest) this.checkPing(ping); + if (!config.isUnitTest) {this.checkPing(ping);} } setDefaults() { @@ -83,11 +83,11 @@ class TVAccessory extends BroadlinkRMAccessory { const { config } = this; let { pingIPAddress, pingFrequency, pingUseArp } = config; - if (!pingIPAddress) return; + if (!pingIPAddress) {return;} // Setup Ping/Arp-based State - if(!pingUseArp) ping(pingIPAddress, pingFrequency, this.pingCallback.bind(this)) - else arp(pingIPAddress, pingFrequency, this.pingCallback.bind(this)) + if(!pingUseArp) {ping(pingIPAddress, pingFrequency, this.pingCallback.bind(this))} + else {arp(pingIPAddress, pingFrequency, this.pingCallback.bind(this))} } pingCallback(active) { @@ -114,7 +114,7 @@ class TVAccessory extends BroadlinkRMAccessory { this.stateChangeInProgress = true; this.reset(); - if (hexData) await this.performSend(hexData); + if (hexData) {await this.performSend(hexData);} this.checkAutoOnOff(); } @@ -391,18 +391,18 @@ class TVAccessory extends BroadlinkRMAccessory { return; } - let hexData = data.volume.mute; - if (!hexData) { - log( - `${name} VolumeSelector: No IR code found for mute!` - ); - callback(null); - return; - } + let hexData = data.volume.mute; + if (!hexData) { + log( + `${name} VolumeSelector: No IR code found for mute!` + ); + callback(null); + return; + } - this.performSend(hexData); - callback(null); - }); + this.performSend(hexData); + callback(null); + }); this.serviceManagers.push(speakerService); diff --git a/accessories/windowCovering.js b/accessories/windowCovering.js index ef22dbc0..0d335d88 100644 --- a/accessories/windowCovering.js +++ b/accessories/windowCovering.js @@ -17,11 +17,11 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { assert.isNumber(totalDurationClose, '`totalDurationClose` is required and should be numeric.') // Set config default values - if (!initialDelay) config.initialDelay = 0.1; + if (!initialDelay) {config.initialDelay = 0.1;} // Set state default values - if (currentPosition === undefined) this.state.currentPosition = 0; - if (positionState === undefined) this.state.positionState = Characteristic.PositionState.STOPPED; + if (currentPosition === undefined) {this.state.currentPosition = 0;} + if (positionState === undefined) {this.state.positionState = Characteristic.PositionState.STOPPED;} } async reset () { @@ -54,7 +54,7 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { this.reset(); // Ignore if no change to the targetPosition - if (state.targetPosition === previousValue && !config.allowResend) return; + if (state.targetPosition === previousValue && !config.allowResend) {return;} // `initialDelay` allows multiple `window-covering` accessories to be updated at the same time // without RF interference by adding an offset to each `window-covering` accessory @@ -62,7 +62,7 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { await this.initialDelayPromise; const closeCompletely = await this.checkOpenOrCloseCompletely(); - if (closeCompletely) return; + if (closeCompletely) {return;} log(`${name} setTargetPosition: (currentPosition: ${state.currentPosition})`); @@ -70,7 +70,7 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { let difference = state.targetPosition - state.currentPosition; state.opening = (difference > 0); - if (!state.opening) difference = -1 * difference; + if (!state.opening) {difference = -1 * difference;} hexData = state.opening ? open : close @@ -93,7 +93,7 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { await this.performSend(hexData); let difference = state.targetPosition - state.currentPosition - if (!state.opening) difference = -1 * difference; + if (!state.opening) {difference = -1 * difference;} const fullOpenCloseTime = state.opening ? totalDurationOpen : totalDurationClose; const durationPerPercentage = fullOpenCloseTime / 100; @@ -122,9 +122,9 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { // Reset the state and timers this.reset(); - if (state.targetPosition === 100 && sendStopAt100) await this.performSend(stop); - if (state.targetPosition === 0 && sendStopAt0) await this.performSend(stop); - if (state.targetPosition !== 0 && state.targetPosition != 100) await this.performSend(stop); + if (state.targetPosition === 100 && sendStopAt100) {await this.performSend(stop);} + if (state.targetPosition === 0 && sendStopAt0) {await this.performSend(stop);} + if (state.targetPosition !== 0 && state.targetPosition != 100) {await this.performSend(stop);} serviceManager.setCharacteristic(Characteristic.PositionState, Characteristic.PositionState.STOPPED); } @@ -158,7 +158,7 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { return false; } - // Determine how long it should take to increase/decrease a single % + // Determine how long it should take to increase/decrease a single % determineOpenCloseDurationPerPercent ({ opening, totalDurationOpen, totalDurationClose }) { assert.isBoolean(opening); assert.isNumber(totalDurationOpen); @@ -186,8 +186,8 @@ class WindowCoveringAccessory extends BroadlinkRMAccessory { // Set the new currentPosition let currentValue = state.currentPosition || 0; - if (state.opening) currentValue++; - if (!state.opening) currentValue--; + if (state.opening) {currentValue++;} + if (!state.opening) {currentValue--;} serviceManager.setCharacteristic(Characteristic.CurrentPosition, currentValue); diff --git a/base/accessory.js b/base/accessory.js index 81b7db77..c9b8c522 100644 --- a/base/accessory.js +++ b/base/accessory.js @@ -3,7 +3,7 @@ const mqtt = require('mqtt'); const addSaveProxy = (name, target, saveFunc) => { const handler = { - set (target, key, value) { + set(target, key, value) { target[key] = value; saveFunc(target); @@ -17,13 +17,13 @@ const addSaveProxy = (name, target, saveFunc) => { class HomebridgeAccessory { - constructor (log, config = {}, serviceManagerType = 'ServiceManager') { + constructor(log, config = {}, serviceManagerType = 'ServiceManager') { this.serviceManagerType = serviceManagerType; let { disableLogs, host, name, data, persistState, resendDataAfterReload, resendDataAfterReloadDelay } = config; - this.log = (!disableLogs && log) ? log : () => {}; - if (this.logLevel === undefined) this.logLevel = 2; //Default to info + this.log = (!disableLogs && log) ? log : () => { }; + if (this.logLevel === undefined) {this.logLevel = 2;} //Default to info this.config = config; this.host = host; @@ -41,27 +41,27 @@ class HomebridgeAccessory { this.subscribeToMQTT(); } - setDefaults () { - if(config.allowResend === undefined){ - if(config.preventResendHex === undefined){ - config.allowResend = true; + setDefaults() { + if (this.config.allowResend === undefined) { + if (this.config.preventResendHex === undefined) { + this.config.allowResend = true; } else { - config.allowResend = !config.preventResendHex; + this.config.allowResend = !this.config.preventResendHex; } } } - restoreStateOrder () { } + restoreStateOrder() { } - correctReloadedState () { } + correctReloadedState() { } - checkConfig (config) { + checkConfig(config) { const { name, log, logLevel } = this; - if (typeof config !== 'object') return; + if (typeof config !== 'object') {return;} Object.keys(config).forEach((key) => { const value = config[key]; - + if (value === 'true' || value === 'false') { log(`\x1b[31m[CONFIG ERROR]\x1b[0m ${name}Boolean values should look like this: \x1b[32m"${key}": ${value}\x1b[0m not this \x1b[31m"${key}": "${value}"\x1b[0m`); @@ -74,8 +74,8 @@ class HomebridgeAccessory { this.checkConfig(value); } else if (value === '0' || (typeof value === 'string' && parseInt(value) !== 0 && !isNaN(parseInt(value)))) { - if (typeof value === 'string' && value.split('.').length - 1 > 1) return; - if (typeof value === 'string' && !value.match(/^\d\.{0,1}\d*$/)) return; + if (typeof value === 'string' && value.split('.').length - 1 > 1) {return;} + if (typeof value === 'string' && !value.match(/^\d\.{0,1}\d*$/)) {return;} log(`\x1b[31m[CONFIG ERROR]\x1b[0m ${name}Numeric values should look like this: \x1b[32m"${key}": ${value}\x1b[0m not this \x1b[31m"${key}": "${value}"\x1b[0m`); @@ -84,20 +84,20 @@ class HomebridgeAccessory { }) } - identify (callback) { + identify(callback) { const { name, log, logLevel } = this - if(logLevel <= 1) log(`Identify requested for ${name}`); + if (logLevel <= 1) {log(`Identify requested for ${name}`);} callback(); } - performSetValueAction ({ host, data, log, name }) { + performSetValueAction({ host, data, log, name }) { throw new Error('The "performSetValueAction" method must be overridden.'); } - async setCharacteristicValue (props, value, callback) { - const { config, host, log, name, logLevel } = this; + async setCharacteristicValue(props, value, callback) { + const { config, host, log, name, logLevel } = this; try { const { delay, resendDataAfterReload, allowResend } = config; @@ -106,17 +106,17 @@ class HomebridgeAccessory { const capitalizedPropertyName = propertyName.charAt(0).toUpperCase() + propertyName.slice(1); if (delay) { - if(this.logLevel <=3) log(`${name} set${capitalizedPropertyName}: ${value} (delaying by ${delay}s)`); + if (this.logLevel <= 3) {log(`${name} set${capitalizedPropertyName}: ${value} (delaying by ${delay}s)`);} await delayForDuration(delay); } - if(this.logLevel <=2) log(`${name} set${capitalizedPropertyName}: ${value}`); + if (this.logLevel <= 2) {log(`${name} set${capitalizedPropertyName}: ${value}`);} if (this.isReloadingState && !resendDataAfterReload) { this.state[propertyName] = value; - if(this.logLevel <=3) log(`${name} set${capitalizedPropertyName}: already ${value} (no data sent - A)`); + if (this.logLevel <= 3) {log(`${name} set${capitalizedPropertyName}: already ${value} (no data sent - A)`);} callback(null); return; @@ -124,7 +124,7 @@ class HomebridgeAccessory { if (!ignorePreviousValue && this.state[propertyName] == value && !this.isReloadingState) { if (!allowResend) { - if(this.logLevel <=3) log(`${name} set${capitalizedPropertyName}: already ${value} (no data sent - B)`); + if (this.logLevel <= 3) {log(`${name} set${capitalizedPropertyName}: already ${value} (no data sent - B)`);} callback(null); return; @@ -142,48 +142,48 @@ class HomebridgeAccessory { const data = value ? onData : offData; if (setValuePromise) { - setValuePromise(data, previousValue); + setValuePromise(data, previousValue); } else if (data) { this.performSetValueAction({ host, data, log, name }); } callback(null); } catch (err) { - if(this.logLevel <=4) log('setCharacteristicValue error:', err.message) + if (this.logLevel <= 4) {log('setCharacteristicValue error:', err.message)} callback(err) } } - async getCharacteristicValue (props, callback) { + async getCharacteristicValue(props, callback) { const { propertyName } = props; const { log, name, logLevel } = this; let value; const capitalizedPropertyName = propertyName.charAt(0).toUpperCase() + propertyName.slice(1); - if(this.state[propertyName] === undefined){ - let thisCharacteristic = this.serviceManager.getCharacteristicTypeForName(propertyName); - if(this.serviceManager.getCharacteristic(thisCharacteristic).props.format != 'bool' && this.serviceManager.getCharacteristic(thisCharacteristic).props.minValue){ + if (this.state[propertyName] === undefined) { + let thisCharacteristic = this.serviceManager.getCharacteristicTypeForName(propertyName); + if (this.serviceManager.getCharacteristic(thisCharacteristic).props.format != 'bool' && this.serviceManager.getCharacteristic(thisCharacteristic).props.minValue) { value = this.serviceManager.getCharacteristic(thisCharacteristic).props.minValue; } else { value = 0; } - }else{ + } else { value = this.state[propertyName]; } - if(this.logLevel <=1) log(`${name} get${capitalizedPropertyName}: ${value}`); + if (this.logLevel <= 1) {log(`${name} get${capitalizedPropertyName}: ${value}`);} callback(null, value); } - loadState () { + loadState() { const { config, log, logLevel, name, serviceManager } = this; let { host, resendDataAfterReload, resendDataAfterReloadDelay, persistState } = config; // Set defaults - if (persistState === undefined) persistState = true; - if (!resendDataAfterReloadDelay) resendDataAfterReloadDelay = 2 + if (persistState === undefined) {persistState = true;} + if (!resendDataAfterReloadDelay) {resendDataAfterReloadDelay = 2} - if (!persistState) return; + if (!persistState) {return;} // Load state from file const restoreStateOrder = this.restoreStateOrder(); @@ -199,14 +199,14 @@ class HomebridgeAccessory { // Refresh the UI and resend data based on existing state Object.keys(serviceManager.characteristics).forEach((name) => { - if (this.state[name] === undefined) return; + if (this.state[name] === undefined) {return;} const characteristcType = serviceManager.characteristics[name]; // Refresh the UI for any state that's been set once the init has completed // Use timeout as we want to make sure this doesn't happen until after all child contructor code has run setTimeout(() => { - if (persistState) serviceManager.refreshCharacteristicUI(characteristcType); + if (persistState) {serviceManager.refreshCharacteristicUI(characteristcType);} }, 200); // Re-set the value in order to resend @@ -226,30 +226,30 @@ class HomebridgeAccessory { setTimeout(() => { this.isReloadingState = false; - - if(this.logLevel <=2) log(`${name} Accessory Ready`); + + if (this.logLevel <= 2) {log(`${name} Accessory Ready`);} }, (resendDataAfterReloadDelay * 1000) + 300); } else { - if(this.logLevel <=2) log(`${name} Accessory Ready`); + if (this.logLevel <= 2) {log(`${name} Accessory Ready`);} } } - getInformationServices () { + getInformationServices() { const informationService = new Service.AccessoryInformation(); informationService .setCharacteristic(Characteristic.Manufacturer, this.manufacturer || 'Homebridge Easy Platform') .setCharacteristic(Characteristic.Model, this.model || 'Unknown') .setCharacteristic(Characteristic.SerialNumber, this.serialNumber || 'Unknown'); - return [ informationService ]; + return [informationService]; } - getServices () { + getServices() { const services = this.getInformationServices(); services.push(this.serviceManager.service); - - if(this.historyService && this.config.noHistory !== true) { + + if (this.historyService && this.config.noHistory !== true) { //Note that noHistory is not working as intended. Need to pull from platform config services.push(this.historyService); } @@ -258,36 +258,36 @@ class HomebridgeAccessory { } // MQTT Support - subscribeToMQTT () { + subscribeToMQTT() { const { config, log, logLevel, name } = this; let { mqttTopic, mqttURL, mqttUsername, mqttPassword } = config; - if (!mqttTopic || !mqttURL) return; + if (!mqttTopic || !mqttURL) {return;} this.mqttValues = {}; this.mqttValuesTemp = {}; - + // Perform some validation of the mqttTopic option in the config. if (typeof mqttTopic !== 'string' && !Array.isArray(mqttTopic)) { - if(this.logLevel <=4) log(`\x1b[31m[CONFIG ERROR]\x1b[0m ${name} \x1b[33mmqttTopic\x1b[0m value is incorrect. Please check out the documentation for more details.`) - + if (this.logLevel <= 4) {log(`\x1b[31m[CONFIG ERROR]\x1b[0m ${name} \x1b[33mmqttTopic\x1b[0m value is incorrect. Please check out the documentation for more details.`)} + return; } if (Array.isArray(mqttTopic)) { const erroneousTopics = mqttTopic.filter((mqttTopicObj) => { - if (typeof mqttTopic !== 'object') return true; + if (typeof mqttTopic !== 'object') {return true;} const { identifier, topic } = mqttTopicObj; - if (!identifier || !topic) return true; - if (typeof identifier !== 'string') return true; - if (typeof topic !== 'string') return true; + if (!identifier || !topic) {return true;} + if (typeof identifier !== 'string') {return true;} + if (typeof topic !== 'string') {return true;} }); if (erroneousTopics.length > 0) { - if(this.logLevel <=4) log(`\x1b[31m[CONFIG ERROR]\x1b[0m ${name} \x1b[33mmqttTopic\x1b[0m value is incorrect. Please check out the documentation for more details.`) - + if (this.logLevel <= 4) {log(`\x1b[31m[CONFIG ERROR]\x1b[0m ${name} \x1b[33mmqttTopic\x1b[0m value is incorrect. Please check out the documentation for more details.`)} + return; } } @@ -298,8 +298,8 @@ class HomebridgeAccessory { identifier: 'unknown', topic: mqttTopic } - - mqttTopic = [ mqttTopicObj ] + + mqttTopic = [mqttTopicObj] } // Create an easily referenced instance variable @@ -332,7 +332,7 @@ class HomebridgeAccessory { const mqttClient = mqtt.connect(mqttURL, options); this.mqttClient = mqttClient; - + // Subscribe to topics this.isMQTTConnecting = true; @@ -344,7 +344,7 @@ class HomebridgeAccessory { mqttClient.on('connect', () => { this.isMQTTConnecting = false; - if(this.logLevel <=2) log(`\x1b[35m[INFO]\x1b[0m ${name} MQTT client connected.`) + if (this.logLevel <= 2) {log(`\x1b[35m[INFO]\x1b[0m ${name} MQTT client connected.`)} mqttTopic.forEach(({ topic }) => { mqttClient.subscribe(topic) @@ -354,7 +354,7 @@ class HomebridgeAccessory { mqttClient.on('error', () => { this.isMQTTConnecting = false; }) - + mqttClient.on('message', (topic, message) => { const identifier = mqttTopicIdentifiersByTopic[topic]; @@ -362,26 +362,26 @@ class HomebridgeAccessory { }) } - onMQTTMessage (identifier, message) { + onMQTTMessage(identifier, message) { this.mqttValuesTemp[identifier] = message.toString(); } - mqttValueForIdentifier (identifier) { + mqttValueForIdentifier(identifier) { const { log, logLevel, name } = this; let value = this.mqttValues[identifier]; // No identifier may have been set in the user's config so let's try "unknown" too - if (value === undefined) value = this.mqttValues['unknown']; + if (value === undefined) {value = this.mqttValues.unknown;} if (!this.mqttClient.connected) { - if (!this.isMQTTConnecting && logLevel <=4 ) log(`\x1b[31m[ERROR]\x1b[0m ${name} MQTT client is not connected. Value could not be found for topic with identifier "${identifier}".`); + if (!this.isMQTTConnecting && logLevel <= 4) {log(`\x1b[31m[ERROR]\x1b[0m ${name} MQTT client is not connected. Value could not be found for topic with identifier "${identifier}".`);} return; } if (value === undefined) { - if(this.logLevel <=4) log(`\x1b[31m[ERROR]\x1b[0m ${name} No MQTT value could be found for topic with identifier "${identifier}".`); + if (this.logLevel <= 4) {log(`\x1b[31m[ERROR]\x1b[0m ${name} No MQTT value could be found for topic with identifier "${identifier}".`);} return; } diff --git a/base/helpers/persistentState.js b/base/helpers/persistentState.js index 7a768742..4f35d570 100644 --- a/base/helpers/persistentState.js +++ b/base/helpers/persistentState.js @@ -10,19 +10,19 @@ const init = ({ homebridgeDirectory, homebridge }) => { } const clear = ({ host, name }) => { - if (!host) host = 'default'; + if (!host) {host = 'default';} return nodePersist.removeItemSync(`${host}-${name}`); } const load = ({ host, name }) => { - if (!host) host = 'default'; + if (!host) {host = 'default';} return nodePersist.getItemSync(`${host}-${name}`); } const save = ({ host, name, state }) => { - if (!host) host = 'default'; + if (!host) {host = 'default';} return nodePersist.setItemSync(`${host}-${name}`, state); } diff --git a/base/platform.js b/base/platform.js index 6a073c54..b2d0d1e6 100644 --- a/base/platform.js +++ b/base/platform.js @@ -1,7 +1,7 @@ const persistentState = require('./helpers/persistentState') const semver = require('semver'); -if (semver.lt(process.version, '7.6.0')) throw new Error(`Homebridge plugins that use the "homebridge-platform-helper" library require your node version to be at least the v12.14.0 LTM. Current version: ${process.version}`) +if (semver.lt(process.version, '7.6.0')) {throw new Error(`Homebridge plugins that use the "homebridge-platform-helper" library require your node version to be at least the v12.14.0 LTM. Current version: ${process.version}`)} class HomebridgePlatform { @@ -39,7 +39,7 @@ class HomebridgePlatform { break; default: //default to 'info': - if(this.config.logLevel !== undefined) log(`\x1b[31m[CONFIG ERROR] \x1b[33mlogLevel\x1b[0m should be one of: trace, debug, info, warning, error, critical, or none.`); + if(this.config.logLevel !== undefined) {log(`\x1b[31m[CONFIG ERROR] \x1b[33mlogLevel\x1b[0m should be one of: trace, debug, info, warning, error, critical, or none.`);} this.logLevel = 2; break; } @@ -49,7 +49,7 @@ class HomebridgePlatform { async addAccessories (accessories) { throw new Error('The addAccessories method must be overridden.') - }; + } async accessories (callback) { const { config, log } = this; @@ -70,13 +70,13 @@ class HomebridgePlatform { // Check for no accessories if (!config.accessories || config.accessories.length === 0) { - if (!disableLogs) log(`No accessories have been added to the "${name}" platform config.`); + if (!disableLogs) {log(`No accessories have been added to the "${name}" platform config.`);} return callback(accessories); } // Let accessories know about one-another if they wish accessories.forEach((accessory) => { - if (accessory.updateAccessories) accessory.updateAccessories(accessories); + if (accessory.updateAccessories) {accessory.updateAccessories(accessories);} }) callback(accessories); diff --git a/helpers/accessoryCreator.js b/helpers/accessoryCreator.js index df7bd209..5e59cf06 100644 --- a/helpers/accessoryCreator.js +++ b/helpers/accessoryCreator.js @@ -17,9 +17,9 @@ function createAccessory( // listen for the identify event if the accessory instance has defined an identify() method if (accessoryInstance.identify) - accessory.on('identify', function(paired, callback) { - accessoryInstance.identify(callback); - }); + {accessory.on('identify', function(paired, callback) { + accessoryInstance.identify(callback); + });} services.forEach(function(service) { // if you returned an AccessoryInformation service, merge its values with ours @@ -44,26 +44,26 @@ function createAccessory( ).value; if (manufacturer) - existingService.setCharacteristic( - Characteristic.Manufacturer, - manufacturer - ); - if (model) existingService.setCharacteristic(Characteristic.Model, model); + {existingService.setCharacteristic( + Characteristic.Manufacturer, + manufacturer + );} + if (model) {existingService.setCharacteristic(Characteristic.Model, model);} if (serialNumber) - existingService.setCharacteristic( - Characteristic.SerialNumber, - serialNumber - ); + {existingService.setCharacteristic( + Characteristic.SerialNumber, + serialNumber + );} if (firmwareRevision) - existingService.setCharacteristic( - Characteristic.FirmwareRevision, - firmwareRevision - ); + {existingService.setCharacteristic( + Characteristic.FirmwareRevision, + firmwareRevision + );} if (hardwareRevision) - existingService.setCharacteristic( - Characteristic.HardwareRevision, - hardwareRevision - ); + {existingService.setCharacteristic( + Characteristic.HardwareRevision, + hardwareRevision + );} } else { accessory.addService(service); } diff --git a/helpers/arp.js b/helpers/arp.js index 3784159a..a9d58983 100644 --- a/helpers/arp.js +++ b/helpers/arp.js @@ -3,12 +3,12 @@ const arp = require('node-arp'); const arpIPAddress = (ipAddress, interval, callback) => { setInterval(() => { arp.getMAC(ipAddress, (err, mac) => { - // Validate received MAC address - if (!err && /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(mac)) { - callback(true) - } else { - callback(false) - } + // Validate received MAC address + if (!err && /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(mac)) { + callback(true) + } else { + callback(false) + } }); }, interval * 1000); } diff --git a/helpers/catchDelayCancelError.js b/helpers/catchDelayCancelError.js index 444a4963..d7f3ce7a 100644 --- a/helpers/catchDelayCancelError.js +++ b/helpers/catchDelayCancelError.js @@ -7,7 +7,7 @@ const catchDelayCancelError = async (originalMethod) => { try { result = await originalMethod() } catch (err) { - if (err.message !== TIMEOUT_CANCELLATION) throw err + if (err.message !== TIMEOUT_CANCELLATION) {throw err} } return result diff --git a/helpers/convertProntoCode.js b/helpers/convertProntoCode.js index f2e092c8..f5956e1f 100644 --- a/helpers/convertProntoCode.js +++ b/helpers/convertProntoCode.js @@ -67,7 +67,7 @@ const lircToBroadlink = (pulses, log) => { const convertProntoToBroadlink = (prontoCode, log) => { const lircPulses = prontoToLIRC(prontoCode, log); - if (!lircPulses) return + if (!lircPulses) {return} const broadlinkCode = lircToBroadlink(lircPulses, log); diff --git a/helpers/delayForDuration.js b/helpers/delayForDuration.js index ef01d5b4..a4811b24 100644 --- a/helpers/delayForDuration.js +++ b/helpers/delayForDuration.js @@ -15,7 +15,7 @@ function delayForDuration(duration) { class Timer extends Promise { cancel () { - if (this.isCancelled) return; + if (this.isCancelled) {return;} clearTimeout(timerID); this.isCancelled = true; diff --git a/helpers/getDevice.js b/helpers/getDevice.js index 02f721a1..2189ebf9 100644 --- a/helpers/getDevice.js +++ b/helpers/getDevice.js @@ -8,14 +8,14 @@ const keepAliveFrequency = 90000; const pingTimeout = 5; const startKeepAlive = (device, log) => { - if(!device.host.port) return; + if(!device.host.port) {return;} setInterval(() => { //log('\x1b[33m[DEBUG]\x1b[0m Sending keepalive to', device.host.address,':',device.host.port) const socket = dgram.createSocket({ type:'udp4', reuseAddr:true }); let packet = Buffer.alloc(0x30, 0); packet[0x26] = 0x1; socket.send(packet, 0, packet.length, device.host.port, device.host.address, (err, bytes) => { - if (err) log('\x1b[33m[DEBUG]\x1b[0m send keepalive packet error', err) + if (err) {log('\x1b[33m[DEBUG]\x1b[0m send keepalive packet error', err)} }); socket.close(); }, keepAliveFrequency); @@ -29,8 +29,8 @@ const startPing = (device, log) => { try { ping.sys.probe(device.host.address, (active, err) => { if(err){ - log(`Error pinging Broadlink RM device at ${device.host.address} (${device.host.macAddress || ''}): ${err}`); - throw err; + log(`Error pinging Broadlink RM device at ${device.host.address} (${device.host.macAddress || ''}): ${err}`); + throw err; } if (!active && device.state === 'active' && retryCount === 2) { @@ -39,11 +39,11 @@ const startPing = (device, log) => { device.state = 'inactive'; retryCount = 0; } else if (!active && device.state === 'active') { - if(broadlink.debug) log(`Broadlink RM device at ${device.host.address} (${device.host.macAddress || ''}) is no longer reachable. (attempt ${retryCount})`); + if(broadlink.debug) {log(`Broadlink RM device at ${device.host.address} (${device.host.macAddress || ''}) is no longer reachable. (attempt ${retryCount})`);} retryCount += 1; } else if (active && device.state !== 'active') { - if (device.state === 'inactive') log(`Broadlink RM device at ${device.host.address} (${device.host.macAddress || ''}) has been re-discovered.`); + if (device.state === 'inactive') {log(`Broadlink RM device at ${device.host.address} (${device.host.macAddress || ''}) has been re-discovered.`);} device.state = 'active'; retryCount = 0; @@ -98,7 +98,7 @@ const discoverDevices = (automatic = true, log, logLevel, deviceDiscoveryTimeout } const addDevice = (device) => { - if (!device.isUnitTestDevice && (discoveredDevices[device.host.address] || discoveredDevices[device.host.macAddress])) return; + if (!device.isUnitTestDevice && (discoveredDevices[device.host.address] || discoveredDevices[device.host.macAddress])) {return;} discoveredDevices[device.host.address] = device; discoveredDevices[device.host.macAddress] = device; @@ -138,11 +138,11 @@ const getDevice = ({ host, log, learnOnly }) => { } } - if (!device) log(`Learn Code (no device found at ${host})`); + if (!device) {log(`Learn Code (no device found at ${host})`);} } else { device = discoveredDevices[hosts[0]]; - if (!device) log(`Send data (no device found at ${host})`); + if (!device) {log(`Send data (no device found at ${host})`);} } } diff --git a/helpers/learnData.js b/helpers/learnData.js index a850bb9f..5ab54178 100644 --- a/helpers/learnData.js +++ b/helpers/learnData.js @@ -6,13 +6,13 @@ let getDataTimeout = null; const stop = (log, device, logLevel) => { // Reset existing learn requests - if (!closeClient) return; + if (!closeClient) {return;} closeClient(); closeClient = null; log(`\x1b[35m[INFO]\x1b[0m Learn Code (stopped)`); - if(this.initalDebug !== undefined && device) device.debug = this.initalDebug; + if(this.initalDebug !== undefined && device) {device.debug = this.initalDebug;} } const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) => { @@ -25,17 +25,17 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = } this.initalDebug = device.debug; - if (logLevel <=1) device.debug = true; + if (logLevel <=1) {device.debug = true;} - if (!device.enterLearning) return log(`\x1b[31m[ERROR]\x1b[0m Learn Code (IR learning not supported for device at ${host})`); + if (!device.enterLearning) {return log(`\x1b[31m[ERROR]\x1b[0m Learn Code (IR learning not supported for device at ${host})`);} let onRawData; closeClient = (err) => { - if (timeout) clearTimeout(timeout); + if (timeout) {clearTimeout(timeout);} timeout = null; - if (getDataTimeout) clearTimeout(getDataTimeout); + if (getDataTimeout) {clearTimeout(getDataTimeout);} getDataTimeout = null; device.removeListener('rawData', onRawData); @@ -43,7 +43,7 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = }; onRawData = (message) => { - if (!closeClient) return; + if (!closeClient) {return;} const hex = message.toString('hex'); log(`\x1b[35m[RESULT]\x1b[0m Learn Code (learned hex code: ${hex})`); @@ -59,13 +59,13 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = device.enterLearning() log(`Learn Code (ready)`); - if (callback) callback(); + if (callback) {callback();} getDataTimeout = setTimeout(() => { getData(device); }, 1000) - if (disableTimeout) return; + if (disableTimeout) {return;} // Timeout the client after 10 seconds timeout = setTimeout(() => { @@ -79,8 +79,8 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = } const getData = (device) => { - if (getDataTimeout) clearTimeout(getDataTimeout); - if (!closeClient) return; + if (getDataTimeout) {clearTimeout(getDataTimeout);} + if (!closeClient) {return;} device.checkData() diff --git a/helpers/learnRFData.js b/helpers/learnRFData.js index 97d18317..747d4238 100644 --- a/helpers/learnRFData.js +++ b/helpers/learnRFData.js @@ -11,21 +11,21 @@ let currentDevice const stop = (log, device, logLevel) => { // Reset existing learn requests - if (!closeClient || isClosingClient) return; + if (!closeClient || isClosingClient) {return;} isClosingClient = true; - if (currentDevice) currentDevice.cancelLearn(); + if (currentDevice) {currentDevice.cancelLearn();} setTimeout(() => { closeClient(); closeClient = null; isClosingClient = false; - if (log) log(`\x1b[35m[INFO]\x1b[0m Scan RF (stopped)`); + if (log) {log(`\x1b[35m[INFO]\x1b[0m Scan RF (stopped)`);} }, 500) - if(this.initalDebug !== undefined && currentDevice) currentDevice.debug = this.initalDebug; + if(this.initalDebug !== undefined && currentDevice) {currentDevice.debug = this.initalDebug;} } const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) => { @@ -38,10 +38,10 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = } this.initalDebug = device.debug; - if (logLevel <=1) device.debug = true; + if (logLevel <=1) {device.debug = true;} - if (!device.enterLearning) return log(`\x1b[31m[ERROR]\x1b[0m Learn Code (IR/RF learning not supported for device at ${host})`); - if (!device.enterRFSweep) return log(`\x1b[31m[ERROR]\x1b[0m Scan RF (RF learning not supported for device (${device.type}) at ${host})`); + if (!device.enterLearning) {return log(`\x1b[31m[ERROR]\x1b[0m Learn Code (IR/RF learning not supported for device at ${host})`);} + if (!device.enterRFSweep) {return log(`\x1b[31m[ERROR]\x1b[0m Scan RF (RF learning not supported for device (${device.type}) at ${host})`);} currentDevice = device @@ -50,16 +50,16 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = let onRawData3; closeClient = (err) => { - if (timeout) clearTimeout(timeout); + if (timeout) {clearTimeout(timeout);} timeout = null; - if (getDataTimeout) clearTimeout(getDataTimeout); + if (getDataTimeout) {clearTimeout(getDataTimeout);} getDataTimeout = null; - if (getDataTimeout2) clearTimeout(getDataTimeout2); + if (getDataTimeout2) {clearTimeout(getDataTimeout2);} getDataTimeout2 = null; - if (getDataTimeout3) clearTimeout(getDataTimeout3); + if (getDataTimeout3) {clearTimeout(getDataTimeout3);} getDataTimeout3 = null; @@ -69,9 +69,9 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = }; onRawData = (message) => { - if (!closeClient) return; + if (!closeClient) {return;} - if (getDataTimeout) clearTimeout(getDataTimeout); + if (getDataTimeout) {clearTimeout(getDataTimeout);} getDataTimeout = null; log(`\x1b[35m[INFO]\x1b[0m Scan RF (found frequency - 1 of 2)`); @@ -88,9 +88,9 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = }; onRawData2 = (message) => { - if (!closeClient) return; + if (!closeClient) {return;} - if (getDataTimeout2) clearTimeout(getDataTimeout2); + if (getDataTimeout2) {clearTimeout(getDataTimeout2);} getDataTimeout = null; log(`\x1b[35m[INFO]\x1b[0m Scan RF (found frequency - 2 of 2)`) @@ -102,7 +102,7 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = }; onRawData3 = (message) => { - if (!closeClient) return; + if (!closeClient) {return;} const hex = message.toString('hex'); log(`\x1b[35m[INFO]\x1b[0m Scan RF (complete)`); @@ -123,13 +123,13 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = log(`\x1b[35m[INFO]\x1b[0m Scan RF (scanning)`); log(`\x1b[35m[ACTION]\x1b[0m Hold down the button that sends the RF frequency.`); - if (callback) callback(); + if (callback) {callback();} getDataTimeout = setTimeout(() => { getData(device); }, 1000); - if (disableTimeout) return; + if (disableTimeout) {return;} // Timeout the client after 60 seconds timeout = setTimeout(() => { @@ -145,8 +145,8 @@ const start = (host, callback, turnOffCallback, log, disableTimeout, logLevel) = } const getData = (device) => { - if (getDataTimeout) clearTimeout(getDataTimeout); - if (!closeClient) return; + if (getDataTimeout) {clearTimeout(getDataTimeout);} + if (!closeClient) {return;} device.checkRFData(); @@ -156,8 +156,8 @@ const getData = (device) => { } const getData2 = (device) => { - if (getDataTimeout2) clearTimeout(getDataTimeout2); - if (!closeClient) return; + if (getDataTimeout2) {clearTimeout(getDataTimeout2);} + if (!closeClient) {return;} device.checkRFData2(); @@ -167,8 +167,8 @@ const getData2 = (device) => { } const getData3 = (device) => { - if (getDataTimeout3) clearTimeout(getDataTimeout3); - if (!closeClient) return; + if (getDataTimeout3) {clearTimeout(getDataTimeout3);} + if (!closeClient) {return;} device.checkData() diff --git a/helpers/sendData.js b/helpers/sendData.js index 0ab38f5f..e28481ad 100644 --- a/helpers/sendData.js +++ b/helpers/sendData.js @@ -8,11 +8,11 @@ module.exports = ({ host, hexData, log, name, logLevel }) => { // Check for pronto code if (hexData.substring(0, 4) === '0000') { - if (logLevel <= 1) log(`\x1b[33m[DEBUG]\x1b[0m ${name} sendHex (Converting Pronto code "${hexData}" to Broadlink code)`); + if (logLevel <= 1) {log(`\x1b[33m[DEBUG]\x1b[0m ${name} sendHex (Converting Pronto code "${hexData}" to Broadlink code)`);} hexData = convertProntoCode(hexData, log); - if (logLevel <=1) log(`\x1b[33m[DEBUG]\x1b[0m ${name} sendHex (Pronto code successfuly converted: "${hexData}")`); + if (logLevel <=1) {log(`\x1b[33m[DEBUG]\x1b[0m ${name} sendHex (Pronto code successfuly converted: "${hexData}")`);} - if (!hexData) return log(`\x1b[31m[ERROR] \x1b[0m${name} sendData (A Pronto code was detected however its conversion to a Broadlink code failed.)`); + if (!hexData) {return log(`\x1b[31m[ERROR] \x1b[0m${name} sendData (A Pronto code was detected however its conversion to a Broadlink code failed.)`);} } @@ -20,16 +20,16 @@ module.exports = ({ host, hexData, log, name, logLevel }) => { const device = getDevice({ host, log }); if (!device) { - if (!host) return log(`\x1b[31m[ERROR] \x1b[0m${name} sendData (no device found)`); + if (!host) {return log(`\x1b[31m[ERROR] \x1b[0m${name} sendData (no device found)`);} return log(`\x1b[31m[ERROR] \x1b[0m${name} sendData (no device found at ${host})`); } - if (!device.sendData) return log(`\x1b[31m[ERROR] \x1b[0mThe device at ${device.host.address} (${device.host.macAddress}) doesn't support the sending of IR or RF codes.`); - if (hexData.includes('5aa5aa555')) return log(`\x1b[31m[ERROR] \x1b[0mThis type of hex code (5aa5aa555...) is no longer valid. Use the included "Learn Code" accessory to find new (decrypted) codes.`); + if (!device.sendData) {return log(`\x1b[31m[ERROR] \x1b[0mThe device at ${device.host.address} (${device.host.macAddress}) doesn't support the sending of IR or RF codes.`);} + if (hexData.includes('5aa5aa555')) {return log(`\x1b[31m[ERROR] \x1b[0mThis type of hex code (5aa5aa555...) is no longer valid. Use the included "Learn Code" accessory to find new (decrypted) codes.`);} const hexDataBuffer = new Buffer(hexData, 'hex'); device.sendData(hexDataBuffer, logLevel, hexData); - if (logLevel <=2) log(`${name} sendHex (${device.host.address}; ${device.host.macAddress}) ${hexData}`); + if (logLevel <=2) {log(`${name} sendHex (${device.host.address}; ${device.host.macAddress}) ${hexData}`);} } diff --git a/package-lock.json b/package-lock.json index eaab9e55..53037a29 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "homebridge-broadlink-rm-pro", "version": "4.4.5", "license": "ISC", "dependencies": { @@ -22,6 +23,8 @@ "uuid": "^8.3.2" }, "devDependencies": { + "eslint": "^7.0.0", + "eslint-plugin-no-autofix": "^1.1.2", "hap-nodejs": "^0.8.3", "mocha": "^8.2.1", "release-it": "^14.2.2" @@ -140,6 +143,86 @@ "node": ">=4" } }, + "node_modules/@eslint/eslintrc": { + "version": "0.4.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", + "integrity": "sha1-9j0O8G9cDFfXbEq19j04NcUbAXk=", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@eslint/eslintrc/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/debug/-/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ms/-/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true, + "license": "MIT" + }, "node_modules/@homebridge/ciao": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.2.tgz", @@ -439,6 +522,29 @@ "node": ">=6.5" } }, + "node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha1-/IZh4Rt6wVOcR9v+oucrOvNNJns=", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/agent-base": { "version": "6.0.2", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", @@ -468,6 +574,23 @@ "version": "2.1.2", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, "node_modules/ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", @@ -617,6 +740,16 @@ "node": "*" } }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/async-retry": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.1.tgz", @@ -1201,6 +1334,13 @@ "node": ">=4.0.0" } }, + "node_modules/deep-is": { + "version": "0.1.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true, + "license": "MIT (https://github.com/thlorenz/deep-is/blob/master/LICENSE)" + }, "node_modules/defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -1268,6 +1408,19 @@ "node": ">=8" } }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -1316,6 +1469,19 @@ "once": "^1.4.0" } }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -1355,6 +1521,340 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eslint": { + "version": "7.29.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint/-/eslint-7.29.0.tgz", + "integrity": "sha1-7ip2SPLnKUheTQvWOD7B3qvIs8A=", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-plugin-no-autofix": { + "version": "1.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-plugin-no-autofix/-/eslint-plugin-no-autofix-1.1.2.tgz", + "integrity": "sha1-X34c4Eu3GYlGeckgkv3yufmhoHE=", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-rule-composer": "^0.3.0", + "find-up": "^5.0.0" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "eslint": ">= 5.12.1" + } + }, + "node_modules/eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha1-eTIMknsMXA09PSt2yLSkiPJbuvk=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.10.4" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/eslint/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/debug/-/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ=", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/is-glob": { + "version": "4.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ms/-/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true, + "license": "MIT" + }, + "node_modules/espree": { + "version": "7.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/espree/-/espree-7.3.1.tgz", + "integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/event-target-shim": { "version": "5.0.1", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", @@ -1484,6 +1984,19 @@ "node": ">=0.8.0" } }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc=", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1537,6 +2050,27 @@ "flat": "cli.js" } }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.1.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha1-xLSJ6ACW2d8d/JfHmHGup8YXxGk=", + "dev": true, + "license": "ISC" + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -1573,6 +2107,13 @@ "version": "1.1.1", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true, + "license": "MIT" + }, "node_modules/futoin-hkdf": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/futoin-hkdf/-/futoin-hkdf-1.3.3.tgz", @@ -1730,6 +2271,35 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globals": { + "version": "13.9.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/globals/-/globals-13.9.0.tgz", + "integrity": "sha1-S/K/Y1szShc/sdr3xeayGOzcBss=", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globals/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globby": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", @@ -2515,6 +3085,20 @@ "node": ">=0.10.0" } }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/levn/-/levn-0.4.1.tgz", + "integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/lines-and-columns": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.1.6.tgz", @@ -2542,6 +3126,27 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha1-VYqlO0O2YeGSWgr9+japoQhf5Xo=", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.truncate": { + "version": "4.4.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true, + "license": "MIT" + }, "node_modules/log-symbols": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", @@ -2890,6 +3495,13 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true, + "license": "MIT" + }, "node_modules/node-arp": { "version": "1.0.6", "integrity": "sha512-miX3CXZv1CvsWeAeoB66GVbn8X0WEbcZTmpZBnIzK4t02YF7+JDeFxYWFcqcDDaM2d/vzUFTx4zxr+G1NBRmGQ==", @@ -2982,6 +3594,24 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/ora": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", @@ -3399,6 +4029,16 @@ "node": ">=0.8" } }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -3412,6 +4052,16 @@ "version": "2.0.1", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/progress/-/progress-2.0.3.tgz", + "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/protocols": { "version": "1.4.8", "resolved": "https://registry.npmjs.org/protocols/-/protocols-1.4.8.tgz", @@ -3584,6 +4234,19 @@ "node": ">= 0.10" } }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha1-BCWido2PI7rXDKS5BGH6LxIT4bI=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, "node_modules/registry-auth-token": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", @@ -3695,6 +4358,16 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -3764,6 +4437,22 @@ "node": ">=0.10.0" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -3946,6 +4635,24 @@ "node": ">=8" } }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -3981,6 +4688,13 @@ "readable-stream": "^3.0.0" } }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true, + "license": "BSD-3-Clause" + }, "node_modules/stream-shift": { "version": "1.0.1", "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" @@ -4063,6 +4777,55 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/table": { + "version": "6.7.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/table/-/table-6.7.1.tgz", + "integrity": "sha1-7gVZK3FDgxqMlPPO5qrkwczvM+I=", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "8.6.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ajv/-/ajv-8.6.0.tgz", + "integrity": "sha1-YMxF2cRqR32A2SxIB22XLDQuVyA=", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=", + "dev": true, + "license": "MIT" + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true, + "license": "MIT" + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4114,6 +4877,19 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", "dev": true }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/type-detect": { "version": "4.0.8", "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", @@ -4221,6 +4997,16 @@ "is-ci": "bin.js" } }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, "node_modules/url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -4254,6 +5040,13 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha1-LeGWGMZtwkfc+2+ZM4A12CRaLO4=", + "dev": true, + "license": "MIT" + }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -4404,6 +5197,16 @@ "node": ">=8.12.0" } }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/workerpool": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", @@ -4640,6 +5443,65 @@ } } }, + "@eslint/eslintrc": { + "version": "0.4.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/@eslint/eslintrc/-/eslintrc-0.4.2.tgz", + "integrity": "sha1-9j0O8G9cDFfXbEq19j04NcUbAXk=", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "argparse": { + "version": "1.0.10", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/debug/-/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ms/-/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, "@homebridge/ciao": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@homebridge/ciao/-/ciao-1.1.2.tgz", @@ -4896,27 +5758,56 @@ }, "abort-controller": { "version": "3.0.0", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "requires": { "event-target-shim": "^5.0.0" } }, + "acorn": { + "version": "7.4.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha1-/q7SVZc9LndVW4PbwIhRpsY1IPo=", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/acorn-jsx/-/acorn-jsx-5.3.1.tgz", + "integrity": "sha1-/IZh4Rt6wVOcR9v+oucrOvNNJns=", + "dev": true, + "requires": {} + }, "agent-base": { "version": "6.0.2", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "requires": { "debug": "4" }, "dependencies": { "debug": { "version": "4.3.1", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { "ms": "2.1.2" } }, "ms": { - "version": "2.1.2" + "version": "2.1.2", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, + "ajv": { + "version": "6.12.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha1-uvWmLoArB9l3A0WG+MO69a3ybfQ=", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", @@ -5019,10 +5910,18 @@ "dev": true }, "arrify": { - "version": "2.0.1" + "version": "2.0.1", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==" }, "assertion-error": { - "version": "1.1.0" + "version": "1.1.0", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + }, + "astral-regex": { + "version": "2.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha1-SDFDxWeu7UeFdZwIZXhtx319LjE=", + "dev": true }, "async-retry": { "version": "1.3.1", @@ -5040,10 +5939,12 @@ "dev": true }, "balanced-match": { - "version": "1.0.2" + "version": "1.0.2", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base64-js": { - "version": "1.5.1" + "version": "1.5.1", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, "before-after-hook": { "version": "2.2.2", @@ -5052,7 +5953,8 @@ "dev": true }, "bignumber.js": { - "version": "9.0.1" + "version": "9.0.1", + "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==" }, "binary-extensions": { "version": "2.2.0", @@ -5062,6 +5964,7 @@ }, "bl": { "version": "4.1.0", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "requires": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -5094,6 +5997,7 @@ }, "brace-expansion": { "version": "1.1.11", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5116,16 +6020,19 @@ }, "buffer": { "version": "5.7.1", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", "requires": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" } }, "buffer-equal-constant-time": { - "version": "1.0.1" + "version": "1.0.1", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" }, "buffer-from": { - "version": "1.1.1" + "version": "1.1.1", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" }, "cacheable-lookup": { "version": "5.0.4", @@ -5161,6 +6068,7 @@ }, "call-bind": { "version": "1.0.2", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "requires": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -5180,6 +6088,7 @@ }, "chai": { "version": "4.3.4", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", "requires": { "assertion-error": "^1.1.0", "check-error": "^1.0.2", @@ -5217,7 +6126,8 @@ "dev": true }, "check-error": { - "version": "1.0.2" + "version": "1.0.2", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" }, "chokidar": { "version": "3.5.1", @@ -5320,19 +6230,23 @@ }, "commist": { "version": "1.1.0", + "integrity": "sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==", "requires": { "leven": "^2.1.0", "minimist": "^1.1.0" } }, "compare-versions": { - "version": "3.6.0" + "version": "3.6.0", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==" }, "concat-map": { - "version": "0.0.1" + "version": "0.0.1", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "concat-stream": { "version": "2.0.0", + "integrity": "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==", "requires": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", @@ -5386,6 +6300,7 @@ }, "debug": { "version": "2.6.9", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "requires": { "ms": "2.0.0" } @@ -5427,6 +6342,7 @@ }, "deep-eql": { "version": "3.0.1", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "requires": { "type-detect": "^4.0.0" } @@ -5437,6 +6353,12 @@ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, "defaults": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", @@ -5489,6 +6411,15 @@ "path-type": "^4.0.0" } }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha1-rd6+rXKmV023g2OdyHoSF3OXOWE=", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "dot-prop": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", @@ -5513,53 +6444,301 @@ "stream-shift": "^1.0.0" } }, - "ecdsa-sig-formatter": { - "version": "1.0.11", + "ecdsa-sig-formatter": { + "version": "1.0.11", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "requires": { + "once": "^1.4.0" + } + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha1-Kn/l3WNKHkElqXXsmU/1RW3Dc00=", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "7.29.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint/-/eslint-7.29.0.tgz", + "integrity": "sha1-7ip2SPLnKUheTQvWOD7B3qvIs8A=", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha1-9K1DWqJj25NbjxDyxVLSP7cWpj8=", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/debug/-/debug-4.3.1.tgz", + "integrity": "sha1-8NIpxQXgxtjEmsVT0bE9wYP2su4=", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha1-hpgyxYA0/mikCTwX3BXoNA2EAcQ=", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha1-dQ49tYYgh7RzfrrIIH/9HvJ7Jfw=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha1-dWfb6fL14kZ7x3q4PEopSCQHpdw=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "js-yaml": { + "version": "3.14.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha1-2ugS/bOCX6MGYJqHFzg8UMNqBTc=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ms/-/ms-2.1.2.tgz", + "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk=", + "dev": true + } + } + }, + "eslint-plugin-no-autofix": { + "version": "1.1.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-plugin-no-autofix/-/eslint-plugin-no-autofix-1.1.2.tgz", + "integrity": "sha1-X34c4Eu3GYlGeckgkv3yufmhoHE=", + "dev": true, + "requires": { + "eslint-rule-composer": "^0.3.0", + "find-up": "^5.0.0" + } + }, + "eslint-rule-composer": { + "version": "0.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz", + "integrity": "sha1-eTIMknsMXA09PSt2yLSkiPJbuvk=", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha1-54blmmbLkrP2wfsNUIqrF0hI9Iw=", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha1-0t5eA0JOcH3BDHQGjd7a5wh0Gyc=", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha1-9lMoJZMFknOSyTjtROsKXJsr0wM=", + "dev": true + }, + "espree": { + "version": "7.3.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/espree/-/espree-7.3.1.tgz", + "integrity": "sha1-8t8zC3Usb1UBn4vYm3ZgA5wbu7Y=", + "dev": true, "requires": { - "safe-buffer": "^5.0.1" + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha1-MOvR73wv3/AcOk8VEESvJfqwUj4=", + "dev": true + } } }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "esprima": { + "version": "4.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha1-E7BM2z5sXRnfkatph6hpVhmwqnE=", "dev": true }, - "end-of-stream": { - "version": "1.4.4", + "esquery": { + "version": "1.4.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha1-IUj/w4uC6McFff7UhCWz5h8PJKU=", + "dev": true, "requires": { - "once": "^1.4.0" + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", + "dev": true + } } }, - "error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "esrecurse": { + "version": "4.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha1-eteWTWeauyi+5yzsY3WLHF0smSE=", "dev": true, "requires": { - "is-arrayish": "^0.2.1" + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha1-MH30JUfmzHMk088DwVXVzbjFOIA=", + "dev": true + } } }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "estraverse": { + "version": "4.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha1-OYrT88WiSUi+dyXoPRGn3ijNvR0=", "dev": true }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "esutils": { + "version": "2.0.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha1-dNLrTeC42hKTcRkQ1Qd1ubcQ72Q=", "dev": true }, "event-target-shim": { - "version": "5.0.1" + "version": "5.0.1", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, "execa": { "version": "5.1.1", @@ -5579,7 +6758,8 @@ } }, "extend": { - "version": "3.0.2" + "version": "3.0.2", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "external-editor": { "version": "3.1.0", @@ -5594,6 +6774,7 @@ }, "fakegato-history": { "version": "0.6.1", + "integrity": "sha512-RcgxQj8LEnO/Bt1fxT3pbeLPmDlZ7hZKiW6CPvTGgOHfKYUktXAVKhzj7/Nq14MRWx6DYO+BoI4zZCQDgkob/A==", "requires": { "debug": "^2.2.0", "googleapis": ">39.1.0" @@ -5619,6 +6800,18 @@ "picomatch": "^2.2.1" } }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha1-h0v2nG9ATCtdmcSBNBOZ/VWJJjM=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, "fast-srp-hap": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fast-srp-hap/-/fast-srp-hap-2.0.2.tgz", @@ -5626,7 +6819,8 @@ "dev": true }, "fast-text-encoding": { - "version": "1.0.3" + "version": "1.0.3", + "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==" }, "fastq": { "version": "1.11.0", @@ -5654,6 +6848,15 @@ } } }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha1-IRst2WWcsDlLBz5zI6w8kz1SICc=", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -5670,7 +6873,8 @@ "dev": true }, "find-key": { - "version": "2.1.3" + "version": "2.1.3", + "integrity": "sha512-pKOJBDgB3NJKdSDcYfDxgiXR/ojk5OB3gRepCoWfas3nU6e8LcFIlJQbQ+y7VIoc55KaDKDakpTzR6iISKwFfg==" }, "find-up": { "version": "5.0.0", @@ -5688,6 +6892,22 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha1-YbAzgwKy/p+Vfcwy/CqH8cMEixE=", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.1.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/flatted/-/flatted-3.1.1.tgz", + "integrity": "sha1-xLSJ6ACW2d8d/JfHmHGup8YXxGk=", + "dev": true + }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -5700,7 +6920,8 @@ } }, "fs.realpath": { - "version": "1.0.0" + "version": "1.0.0", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "2.3.2", @@ -5710,7 +6931,14 @@ "optional": true }, "function-bind": { - "version": "1.1.1" + "version": "1.1.1", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true }, "futoin-hkdf": { "version": "1.3.3", @@ -5720,6 +6948,7 @@ }, "gaxios": { "version": "4.3.0", + "integrity": "sha512-pHplNbslpwCLMyII/lHPWFQbJWOX0B3R1hwBEOvzYi1GmdKZruuEHK4N9V6f7tf1EaPYyF80mui1+344p6SmLg==", "requires": { "abort-controller": "^3.0.0", "extend": "^3.0.2", @@ -5730,6 +6959,7 @@ }, "gcp-metadata": { "version": "4.3.0", + "integrity": "sha512-L9XQUpvKJCM76YRSmcxrR4mFPzPGsgZUH+GgHMxAET8qc6+BhRJq63RLhWakgEO2KKVgeSDVfyiNjkGSADwNTA==", "requires": { "gaxios": "^4.0.0", "json-bigint": "^1.0.0" @@ -5742,10 +6972,12 @@ "dev": true }, "get-func-name": { - "version": "2.0.0" + "version": "2.0.0", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" }, "get-intrinsic": { "version": "1.1.1", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", "requires": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -5778,22 +7010,26 @@ } }, "github-graphql-client": { - "version": "1.0.0" + "version": "1.0.0", + "integrity": "sha1-1ayswxu59rd+XFAoEukMhE9ye8o=" }, "github-version-checker": { "version": "2.2.0", + "integrity": "sha512-Ttj/Uzg++TGfycfn5ga8BfMJ8QYB1+DhG24rtasrN8tHYWgqqrEMAQ52y2qGnPNWzSF8AUdjm6dBcoPdUhKhDQ==", "requires": { "github-graphql-client": "^1.0.0", "semver": "^5.5.1" }, "dependencies": { "semver": { - "version": "5.7.1" + "version": "5.7.1", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" } } }, "glob": { "version": "7.1.7", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5821,6 +7057,23 @@ "ini": "2.0.0" } }, + "globals": { + "version": "13.9.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/globals/-/globals-13.9.0.tgz", + "integrity": "sha1-S/K/Y1szShc/sdr3xeayGOzcBss=", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + }, + "dependencies": { + "type-fest": { + "version": "0.20.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha1-G/IH9LKPkVg2ZstfvTJ4hzAc1fQ=", + "dev": true + } + } + }, "globby": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", @@ -5837,6 +7090,7 @@ }, "google-auth-library": { "version": "7.1.2", + "integrity": "sha512-FMipHgfe2u1LzWsf2n9zEB9KsJ8M3n8OYTHbHtlkzPCyo7IknXQR5X99nfvwUHGuX+iEpihUZxDuPm7+qBYeXg==", "requires": { "arrify": "^2.0.0", "base64-js": "^1.3.0", @@ -5851,6 +7105,7 @@ }, "google-p12-pem": { "version": "3.1.0", + "integrity": "sha512-JUtEHXL4DY/N+xhlm7TC3qL797RPAtk0ZGXNs3/gWyiDHYoA/8Rjes0pztkda+sZv4ej1EoO2KhWgW5V9KTrSQ==", "requires": { "node-forge": "^0.10.0" } @@ -5864,6 +7119,7 @@ }, "googleapis-common": { "version": "5.0.2", + "integrity": "sha512-TL7qronKNZwE/XBvqshwzCPmZGq2gz/beXzANF7EVoO7FsQjOd7dk40DYrXkoCpvbnJHCQKWESq6NansiIPFqA==", "requires": { "extend": "^3.0.2", "gaxios": "^4.0.0", @@ -5906,6 +7162,7 @@ }, "gtoken": { "version": "5.3.0", + "integrity": "sha512-mCcISYiaRZrJpfqOs0QWa6lfEM/C1V9ASkzFmuz43XBb5s1Vynh+CZy1ECeeJXVGx2PRByjYzb4Y4/zr1byr0w==", "requires": { "gaxios": "^4.0.0", "google-p12-pem": "^3.0.3", @@ -5957,6 +7214,7 @@ }, "has": { "version": "1.0.3", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "requires": { "function-bind": "^1.1.1" } @@ -5968,7 +7226,8 @@ "dev": true }, "has-symbols": { - "version": "1.0.2" + "version": "1.0.2", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==" }, "has-yarn": { "version": "2.1.0", @@ -6007,6 +7266,7 @@ }, "https-proxy-agent": { "version": "5.0.0", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", "requires": { "agent-base": "6", "debug": "4" @@ -6014,12 +7274,14 @@ "dependencies": { "debug": { "version": "4.3.1", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { "ms": "2.1.2" } }, "ms": { - "version": "2.1.2" + "version": "2.1.2", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, @@ -6039,7 +7301,8 @@ } }, "ieee754": { - "version": "1.2.1" + "version": "1.2.1", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, "ignore": { "version": "5.1.8", @@ -6097,13 +7360,15 @@ }, "inflight": { "version": "1.0.6", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { "once": "^1.3.0", "wrappy": "1" } }, "inherits": { - "version": "2.0.4" + "version": "2.0.4", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "ini": { "version": "2.0.0", @@ -6147,6 +7412,7 @@ }, "is-absolute": { "version": "0.2.6", + "integrity": "sha1-IN5p89uULvLYe5wto28XIjWxtes=", "requires": { "is-relative": "^0.2.1", "is-windows": "^0.2.0" @@ -6260,6 +7526,7 @@ }, "is-relative": { "version": "0.2.1", + "integrity": "sha1-0n9MfVFtF1+2ENuEu+7yPDvJeqU=", "requires": { "is-unc-path": "^0.1.1" } @@ -6274,7 +7541,8 @@ } }, "is-stream": { - "version": "2.0.0" + "version": "2.0.0", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==" }, "is-typedarray": { "version": "1.0.0", @@ -6284,6 +7552,7 @@ }, "is-unc-path": { "version": "0.1.2", + "integrity": "sha1-arBTpyVzwQJQ/0FqOBTDUXivObk=", "requires": { "unc-path-regex": "^0.1.0" } @@ -6295,7 +7564,8 @@ "dev": true }, "is-windows": { - "version": "0.2.0" + "version": "0.2.0", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=" }, "is-yarn-global": { "version": "0.3.0", @@ -6326,6 +7596,7 @@ }, "json-bigint": { "version": "1.0.0", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", "requires": { "bignumber.js": "^9.0.0" } @@ -6344,6 +7615,7 @@ }, "jwa": { "version": "2.0.0", + "integrity": "sha512-jrZ2Qx916EA+fq9cEAeCROWPTfCwi1IVHqT2tapuqLEVVDKFDENFw1oL+MwrTvH6msKxsd1YTDVw6uKEcsrLEA==", "requires": { "buffer-equal-constant-time": "1.0.1", "ecdsa-sig-formatter": "1.0.11", @@ -6352,6 +7624,7 @@ }, "jws": { "version": "4.0.0", + "integrity": "sha512-KDncfTmOZoOMTFG4mBlG0qUIOlc03fmzH+ru6RgYVZhPkyiy/92Owlt/8UEN+a4TXR1FQetfIpJE8ApdvdVxTg==", "requires": { "jwa": "^2.0.0", "safe-buffer": "^5.0.1" @@ -6367,7 +7640,8 @@ } }, "kiwicam-broadlinkjs-rm": { - "version": "0.9.14" + "version": "0.9.14", + "integrity": "sha512-i8nxf1TOxZ90WGjyAThLIxBznUzdEpNIAEw7gOz9/3ugAqCtDB764lhBNezgEwz48E9OIfWW30WInw51ItOqVA==" }, "latest-version": { "version": "5.1.0", @@ -6379,7 +7653,18 @@ } }, "leven": { - "version": "2.1.0" + "version": "2.1.0", + "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=" + }, + "levn": { + "version": "0.4.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/levn/-/levn-0.4.1.tgz", + "integrity": "sha1-rkViwAdHO5MqYgDUAyaN0v/8at4=", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } }, "lines-and-columns": { "version": "1.1.6", @@ -6402,6 +7687,24 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha1-VYqlO0O2YeGSWgr9+japoQhf5Xo=", + "dev": true + }, + "lodash.truncate": { + "version": "4.4.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, "log-symbols": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", @@ -6419,6 +7722,7 @@ }, "lru-cache": { "version": "6.0.0", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "requires": { "yallist": "^4.0.0" } @@ -6497,15 +7801,18 @@ }, "minimatch": { "version": "3.0.4", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { - "version": "1.2.5" + "version": "1.2.5", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, "mkdirp": { "version": "0.5.5", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", "requires": { "minimist": "^1.2.5" } @@ -6603,17 +7910,20 @@ "dependencies": { "debug": { "version": "4.3.1", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { "ms": "2.1.2" } }, "ms": { - "version": "2.1.2" + "version": "2.1.2", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, "mqtt-packet": { "version": "6.10.0", + "integrity": "sha512-ja8+mFKIHdB1Tpl6vac+sktqy3gA8t9Mduom1BA75cI+R9AHnZOiaBQwpGiWnaVJLDGRdNhQmFaAqd7tkKSMGA==", "requires": { "bl": "^4.0.2", "debug": "^4.1.1", @@ -6622,17 +7932,20 @@ "dependencies": { "debug": { "version": "4.3.1", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", "requires": { "ms": "2.1.2" } }, "ms": { - "version": "2.1.2" + "version": "2.1.2", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } }, "ms": { - "version": "2.0.0" + "version": "2.0.0", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "mute-stream": { "version": "0.0.8", @@ -6646,17 +7959,27 @@ "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", "dev": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "node-arp": { - "version": "1.0.6" + "version": "1.0.6", + "integrity": "sha512-miX3CXZv1CvsWeAeoB66GVbn8X0WEbcZTmpZBnIzK4t02YF7+JDeFxYWFcqcDDaM2d/vzUFTx4zxr+G1NBRmGQ==" }, "node-fetch": { - "version": "2.6.1" + "version": "2.6.1", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" }, "node-forge": { - "version": "0.10.0" + "version": "0.10.0", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" }, "node-persist": { "version": "2.1.0", + "integrity": "sha1-5lK784haBNrWo1PXQXYXfIORRwc=", "requires": { "is-absolute": "^0.2.6", "mkdirp": "~0.5.1", @@ -6685,10 +8008,12 @@ } }, "object-inspect": { - "version": "1.10.3" + "version": "1.10.3", + "integrity": "sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw==" }, "once": { "version": "1.4.0", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { "wrappy": "1" } @@ -6702,6 +8027,20 @@ "mimic-fn": "^2.1.0" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha1-TyNqY3Pa4FZqbUPhMmZ09QwpFJk=", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, "ora": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", @@ -6979,7 +8318,8 @@ "dev": true }, "path-is-absolute": { - "version": "1.0.1" + "version": "1.0.1", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, "path-key": { "version": "3.1.1", @@ -7000,7 +8340,8 @@ "dev": true }, "pathval": { - "version": "1.1.1" + "version": "1.1.1", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==" }, "picomatch": { "version": "2.3.0", @@ -7010,11 +8351,18 @@ }, "ping": { "version": "0.3.0", + "integrity": "sha512-lstnoVCoJa4u89vZveHCbl9Vpk/E65wYyLWRSJOp/Az/fDuaj7W+Oc5LPvKpoibfduD31F0MJwKniCBSZyncfA==", "requires": { "q": "1.x", "underscore": "^1.8.3" } }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha1-3rxkidem5rDnYRiIzsiAM30xY5Y=", + "dev": true + }, "prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", @@ -7022,7 +8370,14 @@ "dev": true }, "process-nextick-args": { - "version": "2.0.1" + "version": "2.0.1", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "progress": { + "version": "2.0.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/progress/-/progress-2.0.3.tgz", + "integrity": "sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=", + "dev": true }, "protocols": { "version": "1.4.8", @@ -7032,6 +8387,7 @@ }, "pump": { "version": "3.0.0", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "requires": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -7047,10 +8403,12 @@ } }, "q": { - "version": "1.1.2" + "version": "1.1.2", + "integrity": "sha1-Y1fikSBnAdmfGXq4TlforRlvKok=" }, "qs": { "version": "6.10.1", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", "requires": { "side-channel": "^1.0.4" } @@ -7116,6 +8474,7 @@ }, "readable-stream": { "version": "3.6.0", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -7140,6 +8499,12 @@ "resolve": "^1.1.6" } }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha1-BCWido2PI7rXDKS5BGH6LxIT4bI=", + "dev": true + }, "registry-auth-token": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", @@ -7159,7 +8524,8 @@ } }, "reinterval": { - "version": "1.1.0" + "version": "1.1.0", + "integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=" }, "release-it": { "version": "14.10.0", @@ -7226,6 +8592,12 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha1-iaf92TgmEmcxjq/hT5wy5ZjDaQk=", + "dev": true + }, "resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -7279,6 +8651,15 @@ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha1-8aVAK6YiCtUswSgrrBrjqkn9Bho=", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -7312,7 +8693,8 @@ } }, "safe-buffer": { - "version": "5.2.1" + "version": "5.2.1", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "safer-buffer": { "version": "2.1.2", @@ -7322,6 +8704,7 @@ }, "semver": { "version": "7.3.5", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "requires": { "lru-cache": "^6.0.0" } @@ -7380,6 +8763,7 @@ }, "side-channel": { "version": "1.0.4", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "requires": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -7398,6 +8782,17 @@ "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, + "slice-ansi": { + "version": "4.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha1-UA6N0P1VsFgVCGJVsxla3ypF/ms=", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -7422,12 +8817,20 @@ }, "split2": { "version": "3.2.2", + "integrity": "sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==", "requires": { "readable-stream": "^3.0.0" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "stream-shift": { - "version": "1.0.1" + "version": "1.0.1", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" }, "strict-uri-encode": { "version": "2.0.0", @@ -7437,6 +8840,7 @@ }, "string_decoder": { "version": "1.3.0", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "requires": { "safe-buffer": "~5.2.0" } @@ -7482,6 +8886,46 @@ "has-flag": "^4.0.0" } }, + "table": { + "version": "6.7.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/table/-/table-6.7.1.tgz", + "integrity": "sha1-7gVZK3FDgxqMlPPO5qrkwczvM+I=", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.6.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/ajv/-/ajv-8.6.0.tgz", + "integrity": "sha1-YMxF2cRqR32A2SxIB22XLDQuVyA=", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha1-rnvLNlard6c7pcSb9lTzjmtoYOI=", + "dev": true + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -7524,8 +8968,18 @@ "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", "dev": true }, + "type-check": { + "version": "0.4.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha1-B7ggO/pwVsBlcFDjzNLDdzC6uPE=", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, "type-detect": { - "version": "4.0.8" + "version": "4.0.8", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" }, "type-fest": { "version": "0.21.3", @@ -7534,7 +8988,8 @@ "dev": true }, "typedarray": { - "version": "0.0.6" + "version": "0.0.6", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, "typedarray-to-buffer": { "version": "3.1.5", @@ -7546,10 +9001,12 @@ } }, "unc-path-regex": { - "version": "0.1.2" + "version": "0.1.2", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" }, "underscore": { - "version": "1.13.1" + "version": "1.13.1", + "integrity": "sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g==" }, "unique-string": { "version": "2.0.0", @@ -7605,6 +9062,15 @@ } } }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha1-mxpSWVIlhZ5V9mnZKPiMbFfyp34=", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "url-join": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", @@ -7621,13 +9087,22 @@ } }, "url-template": { - "version": "2.0.8" + "version": "2.0.8", + "integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=" }, "util-deprecate": { - "version": "1.0.2" + "version": "1.0.2", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, "uuid": { - "version": "8.3.2" + "version": "8.3.2", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha1-LeGWGMZtwkfc+2+ZM4A12CRaLO4=", + "dev": true }, "wcwidth": { "version": "1.0.1", @@ -7741,6 +9216,12 @@ } } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://nintex.pkgs.visualstudio.com/_packaging/Nintex/npm/registry/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha1-YQY29rH3A4kb00dxzLF/uTtHB5w=", + "dev": true + }, "workerpool": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", @@ -7759,7 +9240,8 @@ } }, "wrappy": { - "version": "1.0.2" + "version": "1.0.2", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "write-file-atomic": { "version": "3.0.3", @@ -7775,6 +9257,7 @@ }, "ws": { "version": "7.5.0", + "integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw==", "requires": {} }, "xdg-basedir": { @@ -7784,7 +9267,8 @@ "dev": true }, "xtend": { - "version": "4.0.2" + "version": "4.0.2", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" }, "y18n": { "version": "5.0.8", @@ -7793,7 +9277,8 @@ "dev": true }, "yallist": { - "version": "4.0.0" + "version": "4.0.0", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "yaml": { "version": "1.10.2", diff --git a/package.json b/package.json index fcb30f49..786b6072 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "Broadlink RM plugin (including the mini and pro) for homebridge with AC Pro and TV features", "license": "ISC", "scripts": { - "release": "release-it" + "release": "release-it", + "lint": "eslint -c .eslintrc.json --ignore-pattern=\"node_modules\" --ext js .", + "lint-fix": "eslint -c .eslintrc.json --ignore-pattern=\"node_modules\" --ext js --fix ." }, "keywords": [ "homebridge-plugin", @@ -40,6 +42,8 @@ "fakegato-history": "^0.6.1" }, "devDependencies": { + "eslint": "^7.0.0", + "eslint-plugin-no-autofix": "^1.1.2", "hap-nodejs": "^0.8.3", "mocha": "^8.2.1", "release-it": "^14.2.2" diff --git a/platform.js b/platform.js index 9714f005..5b5f38f9 100644 --- a/platform.js +++ b/platform.js @@ -47,7 +47,7 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform { this.showMessage(); setTimeout(checkForUpdates, 1800); - if (!config.accessories) config.accessories = [] + if (!config.accessories) {config.accessories = []} // Add a Learn Code accessory if none exist in the config const learnIRAccessories = (config && config.accessories && Array.isArray(config.accessories)) ? config.accessories.filter((accessory) => (accessory.type === 'learn-ir' || accessory.type === 'learn-code')) : []; @@ -68,9 +68,9 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform { // Iterate through the config accessories let tvs = []; config.accessories.forEach((accessory) => { - if (!accessory.type) throw new Error(`Each accessory must be configured with a "type". e.g. "switch"`); - if (accessory.disabled) return; - if (!classTypes[accessory.type]) throw new Error(`homebridge-broadlink-rm doesn't support accessories of type "${accessory.type}".`); + if (!accessory.type) {throw new Error(`Each accessory must be configured with a "type". e.g. "switch"`);} + if (accessory.disabled) {return;} + if (!classTypes[accessory.type]) {throw new Error(`homebridge-broadlink-rm doesn't support accessories of type "${accessory.type}".`);} const homeKitAccessory = new classTypes[accessory.type](log, accessory); @@ -79,12 +79,12 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform { if(accessory.subType.toLowerCase() === 'receiver'){homeKitAccessory.subType = homebridgeRef.hap.Accessory.Categories.AUDIO_RECEIVER;} if(accessory.subType.toLowerCase() === 'stick'){homeKitAccessory.subType = homebridgeRef.hap.Accessory.Categories.TV_STREAMING_STICK;} - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m Adding Accessory ${accessory.type} (${accessory.subType})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m Adding Accessory ${accessory.type} (${accessory.subType})`);} tvs.push(homeKitAccessory); return; } - if (logLevel <=1) log(`\x1b[34m[DEBUG]\x1b[0m Adding Accessory ${accessory.type} (${accessory.subType})`); + if (logLevel <=1) {log(`\x1b[34m[DEBUG]\x1b[0m Adding Accessory ${accessory.type} (${accessory.subType})`);} accessories.push(homeKitAccessory); }); @@ -109,7 +109,7 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform { const { hosts } = config; if (!hosts) { - if (logLevel <=2) log(`\x1b[35m[INFO]\x1b[0m Automatically discovering Broadlink RM devices.`) + if (logLevel <=2) {log(`\x1b[35m[INFO]\x1b[0m Automatically discovering Broadlink RM devices.`)} discoverDevices(true, log, logLevel, config.deviceDiscoveryTimeout); return; @@ -117,7 +117,7 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform { discoverDevices(false, log, logLevel); - if (logLevel <=2) log(`\x1b[35m[INFO]\x1b[0m Automatic Broadlink RM device discovery has been disabled as the "hosts" option has been set.`) + if (logLevel <=2) {log(`\x1b[35m[INFO]\x1b[0m Automatic Broadlink RM device discovery has been disabled as the "hosts" option has been set.`)} assert.isArray(hosts, `\x1b[31m[CONFIG ERROR] \x1b[33mhosts\x1b[0m should be an array of objects.`) diff --git a/test/fan.test.js b/test/fan.test.js index 0a4ae55e..58ea2010 100644 --- a/test/fan.test.js +++ b/test/fan.test.js @@ -241,7 +241,7 @@ describe('fanAccessory', () => { // Fan Turn Swing Mode On it('rotation direction clockwise', async () => { - const { device } = setup();; + const { device } = setup(); const config = { host: device.host.address, diff --git a/test/helpers/fakeDevice.js b/test/helpers/fakeDevice.js index 7a98067b..607bf7cd 100644 --- a/test/helpers/fakeDevice.js +++ b/test/helpers/fakeDevice.js @@ -33,14 +33,14 @@ class FakeDevice { let hasSentCodes = true hexCodes.forEach((hexCode) => { - if (this.sentHexCodes.indexOf(hexCode) === -1) hasSentCodes = false + if (this.sentHexCodes.indexOf(hexCode) === -1) {hasSentCodes = false} }) return hasSentCodes } sendData (hexBufferData, debug, originalHexString) { - if (!hexBufferData) throw new Error('Missing HEX Data') + if (!hexBufferData) {throw new Error('Missing HEX Data')} this.sentHexCodes.push(originalHexString) } @@ -52,7 +52,7 @@ class FakeDevice { sendFakeOnCallback (type, value) { const callback = this.callbacks[type]; - if(callback) callback(value); + if(callback) {callback(value);} } checkTemperature () { diff --git a/test/helpers/fakeServiceManager.js b/test/helpers/fakeServiceManager.js index 75cf4e04..fcd36001 100644 --- a/test/helpers/fakeServiceManager.js +++ b/test/helpers/fakeServiceManager.js @@ -32,7 +32,7 @@ class FakeService { setCharacteristic (type, value) { let characteristic = this.characteristics[type] - if (characteristic) characteristic.set(value); + if (characteristic) {characteristic.set(value);} } getCharacteristic (type) { @@ -65,21 +65,21 @@ class FakeCharacteristic { this.log('Set Fake Value Received') return this.setMethod(value, (err, value) => { - if (err) return this.log(err.message) + if (err) {return this.log(err.message)} this.log('Fake Set Callback Received: ', value) }) } on (getSet, method) { - if (getSet === 'get') this.getMethod = method - if (getSet === 'set') this.setMethod = method + if (getSet === 'get') {this.getMethod = method} + if (getSet === 'set') {this.setMethod = method} } getValue () { return new Promise((resolve, reject) => { this.getMethod((error, value) => { - if (error) return reject(error) + if (error) {return reject(error)} resolve(value) }) diff --git a/test/helpers/hexCheck.js b/test/helpers/hexCheck.js index 9b74de66..256f5bf4 100644 --- a/test/helpers/hexCheck.js +++ b/test/helpers/hexCheck.js @@ -1,17 +1,17 @@ const { expect } = require('chai'); const hexCheck = ({ device, codes, count }) => { - codes = codes || []; + codes = codes || []; - // Check hex codes were sent - const hasSentCodes = device.hasSentCodes(codes); - expect(hasSentCodes).to.equal(true); + // Check hex codes were sent + const hasSentCodes = device.hasSentCodes(codes); + expect(hasSentCodes).to.equal(true); - if (count !== undefined) { - // Check the number of sent codes - const sentHexCodeCount = device.getSentHexCodeCount(); - expect(sentHexCodeCount).to.equal(count); - } + if (count !== undefined) { + // Check the number of sent codes + const sentHexCodeCount = device.getSentHexCodeCount(); + expect(sentHexCodeCount).to.equal(count); + } } module.exports = hexCheck; diff --git a/test/outlet.test.js b/test/outlet.test.js index b57efa1b..a28c9241 100644 --- a/test/outlet.test.js +++ b/test/outlet.test.js @@ -19,12 +19,12 @@ describe('outletAccessory', () => { const { device } = setup(); const config = { - data: { - on: 'ON', - off: 'OFF' - }, - host: device.host.address, - persistState: false + data: { + on: 'ON', + off: 'OFF' + }, + host: device.host.address, + persistState: false }