From 20b720bcedee151f8903f769348f04d221f024cd Mon Sep 17 00:00:00 2001 From: Stephen Date: Mon, 5 Feb 2024 22:41:58 +1100 Subject: [PATCH] Release 3.1.0 (#439) Release 3.1.0 * Unify logs (#415) * Fixes for Local Key Updates by Tuya. (#413) * Adding back the original set multistate command as the new "setMultiState" function from PR #267 Breaks the Fan Code by splitting the command into two. For devices like the DETA Smart Fan Controller Switch that by default set the speed as 3 the new code in the setMultiState function causes issues. This commit is is adding it back as "setMultiStateLegacy" so as to not revert the issue fixed in PR (#267). * Remove SimpleBlinds2 from config.schema.json and index.js (#390) --------- Co-authored-by: 05TEVE <> Co-authored-by: Valentin Dusollier Co-authored-by: Long Zheng --- config.schema.json | 42 ++- index.js | 7 +- lib/BaseAccessory.js | 12 +- lib/GarageDoorAccessory.js | 16 +- lib/MultiOutletAccessory.js | 2 +- lib/RGBTWLightAccessory.js | 2 +- lib/SimpleBlindsAccessory.js | 26 +- lib/SimpleFanAccessory.js | 10 +- lib/SimpleFanLightAccessory.js | 12 +- lib/SimpleHeaterAccessory.js | 2 +- lib/SimpleLightAccessory.js | 2 +- lib/SwitchAccessory.js | 2 +- lib/TuyaAccessory.js | 72 ++-- lib/TuyaDiscovery.js | 24 +- lib/ValveAccessory.js | 14 +- package-lock.json | 579 +++++++++++++++++++++------------ package.json | 6 +- 17 files changed, 518 insertions(+), 312 deletions(-) diff --git a/config.schema.json b/config.schema.json index ee892f68..79bbb3be 100644 --- a/config.schema.json +++ b/config.schema.json @@ -1,5 +1,5 @@ { - "pluginAlias": "Tuya", + "pluginAlias": "TuyaLan", "pluginType": "platform", "singular": true, "headerDisplay": "

\n\nBefore using the Tuya plugin you need to discover your devices by following [these instructions](https://github.com/AMoo-Miki/homebridge-tuya-lan/wiki/Setup-Instructions).\n\n", @@ -24,7 +24,7 @@ "null" ] }, - { + { "title": "Smart Plug / Barely Smart Power Strip", "enum": [ "Outlet" @@ -97,15 +97,21 @@ ] }, { - "title": "Simple Blinds2", + "title": "Smart Plug w/ White and Color Lights", "enum": [ - "Simple Blinds2" + "RGBTWOutlet" ] }, { - "title": "Smart Plug w/ White and Color Lights", + "title": "Simple Fan", "enum": [ - "RGBTWOutlet" + "Fan" + ] + }, + { + "title": "Simple Fan Light", + "enum": [ + "FanLight" ] } ] @@ -120,7 +126,7 @@ }, "id": { "type": "string", - "title": "Tuya ID", + "title": "Tuya ID", "description": "If you don't have the Tuya ID or Key, follow the steps found on the Setup Instructions page.", "required": true, "condition": { @@ -135,6 +141,14 @@ "functionBody": "return model.devices && model.devices[arrayIndices].type !== 'null';" } }, + "ip": { + "title": "IP Address", + "type": "string", + "required": false, + "condition": { + "functionBody": "return model.devices && model.devices[arrayIndices].type !== 'null';" + } + }, "manufacturer": { "type": "string", "description": "Anything you'd like to use to help identify this device.", @@ -366,6 +380,20 @@ "functionBody": "return model.devices && model.devices[arrayIndices] && ['Convector'].includes(model.devices[arrayIndices].type);" } }, + "maxSpeed": { + "type": "integer", + "placeholder": "3", + "condition": { + "functionBody": "return model.devices && model.devices[arrayIndices] && ['Fan', 'FanLight'].includes(model.devices[arrayIndices].type);" + } + }, + "fanDefaultSpeed": { + "type": "integer", + "placeholder": "1", + "condition": { + "functionBody": "return model.devices && model.devices[arrayIndices] && ['Fan', 'FanLight'].includes(model.devices[arrayIndices].type);" + } + }, "dpChildLock": { "type": "integer", "placeholder": "6", diff --git a/index.js b/index.js index 1d877714..26e8c067 100644 --- a/index.js +++ b/index.js @@ -23,7 +23,7 @@ const SwitchAccessory = require('./lib/SwitchAccessory'); const ValveAccessory = require('./lib/ValveAccessory'); const OilDiffuserAccessory = require('./lib/OilDiffuserAccessory'); -const PLUGIN_NAME = 'homebridge-tuya-lan'; +const PLUGIN_NAME = 'homebridge-tuya'; const PLATFORM_NAME = 'TuyaLan'; const CLASS_DEF = { @@ -105,7 +105,7 @@ class TuyaLan { this.log.info('Starting discovery...'); - TuyaDiscovery.start({ids: deviceIds}) + TuyaDiscovery.start({ids: deviceIds, log: this.log}) .on('discover', config => { if (!config || !config.id) return; if (!devices[config.id]) return this.log.warn('Discovered a device that has not been configured yet (%s@%s).', config.id, config.ip); @@ -116,6 +116,7 @@ class TuyaLan { const device = new TuyaAccessory({ ...devices[config.id], ...config, + log: this.log, UUID: UUID.generate(PLUGIN_NAME + ':' + config.id), connect: false }); @@ -126,6 +127,7 @@ class TuyaLan { this.log.info('Adding fake device: %s', config.name); this.addAccessory(new TuyaAccessory({ ...config, + log: this.log, UUID: UUID.generate(PLUGIN_NAME + ':fake:' + config.id), connect: false })); @@ -141,6 +143,7 @@ class TuyaLan { const device = new TuyaAccessory({ ...devices[deviceId], + log: this.log, UUID: UUID.generate(PLUGIN_NAME + ':' + deviceId), connect: false }); diff --git a/lib/BaseAccessory.js b/lib/BaseAccessory.js index be46addf..302a6130 100644 --- a/lib/BaseAccessory.js +++ b/lib/BaseAccessory.js @@ -79,6 +79,14 @@ class BaseAccessory { this.setMultiState({[dp.toString()]: value}, callback); } + setMultiStateLegacy(dps, callback) { + //Adding back the original set multistate command as the multistate command from PR #267 Breaks the Fan Code by splitting the command into two. + //For devices like the DETA Smart Fan Controller Switch that by default set the speed as 3 the new code in the setMultiState function causes issues. + if (!this.device.connected) return callback(true); + const ret = this.device.update(dps); + callback && callback(!ret); + } + setMultiState(dps, callback) { if (!this.device.connected) return callback(true); for (const dp in dps) { @@ -106,11 +114,11 @@ class BaseAccessory { this.colorFunction = this.device.context.colorFunction && {HSB: 'HSB', HEXHSB: 'HEXHSB'}[this.device.context.colorFunction.toUpperCase()]; if (!this.colorFunction && value) { this.colorFunction = {12: 'HSB', 14: 'HEXHSB'}[value.length] || 'Unknown'; - if (this.colorFunction) console.log(`[Tuya] Color format for ${this.device.context.name} (${this.device.context.version}) identified as ${this.colorFunction} (length: ${value.length}).`); + if (this.colorFunction) this.log.info(`Color format for ${this.device.context.name} (${this.device.context.version}) identified as ${this.colorFunction} (length: ${value.length}).`); } if (!this.colorFunction) { this.colorFunction = 'Unknown'; - console.log(`[Tuya] Color format for ${this.device.context.name} (${this.device.context.version}) is undetectable.`); + this.log.info(`Color format for ${this.device.context.name} (${this.device.context.version}) is undetectable.`); } else if (this.colorFunction === 'HSB') { // If not overridden by config, use the scale of 1000 if (!this.device.context.scaleBrightness) this.device.context.scaleBrightness = 1000; diff --git a/lib/GarageDoorAccessory.js b/lib/GarageDoorAccessory.js index 65baec21..d5fafa97 100644 --- a/lib/GarageDoorAccessory.js +++ b/lib/GarageDoorAccessory.js @@ -44,18 +44,15 @@ class GarageDoorAccessory extends BaseAccessory { // function to return a ID string for log messages _logPrefix() { - return '[Tuya] ' + - (this.manufacturer ? this.manufacturer + ' ' : '') + 'GarageDoor'; + return (this.manufacturer ? this.manufacturer + ' ' : '') + 'GarageDoor'; } // function to prefix a string ID and always log to console - _alwaysLog(...args) { console.log(this._logPrefix(), ...args); } + _alwaysLog(...args) { this.log.info(this._logPrefix(), ...args); } // function to log to console if debug is on _debugLog(...args) { - if (this.debug) { - this._alwaysLog(...args); - } + this.log.debug(this._logPrefix(), ...args); } // function to return true if the garage door manufacturer is Kogan and false @@ -82,13 +79,6 @@ class GarageDoorAccessory extends BaseAccessory { const service = this.accessory.getService(Service.GarageDoorOpener); this._checkServiceName(service, this.device.context.name); - // set the debug flag - if (this.device.context.debug) { - this.debug = true; - } else { - this.debug = false; - } - // Set the manufacturer string // If the manufacturer string matches a known manufacturer, set to that string // Otherwise set the manufacturer to the defined value diff --git a/lib/MultiOutletAccessory.js b/lib/MultiOutletAccessory.js index 05afad64..a2e08760 100644 --- a/lib/MultiOutletAccessory.js +++ b/lib/MultiOutletAccessory.js @@ -35,7 +35,7 @@ class MultiOutletAccessory extends BaseAccessory { this.accessory.services .filter(service => service.UUID === Service.Outlet.UUID && !_validServices.includes(service)) .forEach(service => { - console.log('Removing', service.displayName); + this.log.info('Removing', service.displayName); this.accessory.removeService(service); }); } diff --git a/lib/RGBTWLightAccessory.js b/lib/RGBTWLightAccessory.js index 94710a80..7ccd21be 100644 --- a/lib/RGBTWLightAccessory.js +++ b/lib/RGBTWLightAccessory.js @@ -153,7 +153,7 @@ class RGBTWLightAccessory extends BaseAccessory { } setColorTemperature(value, callback) { - console.log(`[Tuya] setColorTemperature: ${value}`); + this.log.debug(`setColorTemperature: ${value}`); if (value === 0) return callback(null, true); const newColor = this.convertHomeKitColorTemperatureToHomeKitColor(value); diff --git a/lib/SimpleBlindsAccessory.js b/lib/SimpleBlindsAccessory.js index e208ecc3..8f088207 100644 --- a/lib/SimpleBlindsAccessory.js +++ b/lib/SimpleBlindsAccessory.js @@ -112,7 +112,7 @@ class SimpleBlindsAccessory extends BaseAccessory { .on('get', this.getPositionState.bind(this)); this.device.on('change', changes => { - console.log("[Tuya] Blinds saw change to " + changes[this.dpAction]); + this.log.info(" Blinds saw change to " + changes[this.dpAction]); if (changes.hasOwnProperty(this.dpAction)) { switch (changes[this.dpAction]) { case this.cmdOpen: // Starting to open @@ -126,7 +126,7 @@ class SimpleBlindsAccessory extends BaseAccessory { const durationToOpen = Math.abs(this.assumedPosition - BLINDS_OPEN) * this.duration * 10; this.changeTime = Date.now() - durationToOpen; - console.log("[Tuya] Blinds will be marked open in " + durationToOpen + "ms"); + this.log.info(" Blinds will be marked open in " + durationToOpen + "ms"); if (this.changeTimeout) clearTimeout(this.changeTimeout); this.changeTimeout = setTimeout(() => { @@ -135,7 +135,7 @@ class SimpleBlindsAccessory extends BaseAccessory { this.changeTime = false; this.assumedPosition = BLINDS_OPEN; this.assumedState = BLINDS_STOPPED; - console.log("[Tuya] Blinds marked open"); + this.log.info(" Blinds marked open"); }, durationToOpen); } break; @@ -151,7 +151,7 @@ class SimpleBlindsAccessory extends BaseAccessory { const durationToClose = Math.abs(this.assumedPosition - BLINDS_CLOSED) * this.duration * 10; this.changeTime = Date.now() - durationToClose; - console.log("[Tuya] Blinds will be marked closed in " + durationToClose + "ms"); + this.log.info(" Blinds will be marked closed in " + durationToClose + "ms"); if (this.changeTimeout) clearTimeout(this.changeTimeout); this.changeTimeout = setTimeout(() => { @@ -160,7 +160,7 @@ class SimpleBlindsAccessory extends BaseAccessory { this.changeTime = false; this.assumedPosition = this.minPosition; this.assumedState = BLINDS_STOPPED; - console.log("[Tuya] Blinds marked closed"); + this.log.info(" Blinds marked closed"); }, durationToClose); } break; @@ -168,7 +168,7 @@ class SimpleBlindsAccessory extends BaseAccessory { case this.cmdStop: // Stopped in middle if (this.changeTimeout) clearTimeout(this.changeTimeout); - console.log("[Tuya] Blinds last change was " + this.changeTime + "; " + (Date.now() - this.changeTime) + 'ms ago'); + this.log.info(" Blinds last change was " + this.changeTime + "; " + (Date.now() - this.changeTime) + 'ms ago'); if (this.changeTime) { /* @@ -188,7 +188,7 @@ class SimpleBlindsAccessory extends BaseAccessory { characteristicCurrentPosition.updateValue(adjustedPosition); characteristicTargetPosition.updateValue(adjustedPosition); characteristicPositionState.updateValue(Characteristic.PositionState.STOPPED); - console.log("[Tuya] Blinds marked stopped at " + adjustedPosition + "; assumed to be at " + this.assumedPosition); + this.log.info(" Blinds marked stopped at " + adjustedPosition + "; assumed to be at " + this.assumedPosition); this.changeTime = this.targetPosition = false; this.assumedState = BLINDS_STOPPED; @@ -241,20 +241,20 @@ class SimpleBlindsAccessory extends BaseAccessory { } setTargetPosition(value, callback) { - console.log('[Tuya] Blinds asked to move from ' + this.assumedPosition + ' to ' + value); + this.log.info('Blinds asked to move from ' + this.assumedPosition + ' to ' + value); if (this.changeTimeout) clearTimeout(this.changeTimeout); this.targetPosition = value; if (this.changeTime !== false) { - console.log("[Tuya] Blinds " + (this.assumedState === BLINDS_CLOSING ? 'closing' : 'opening') + " had started " + this.changeTime + "; " + (Date.now() - this.changeTime) + 'ms ago'); + this.log.info(" Blinds " + (this.assumedState === BLINDS_CLOSING ? 'closing' : 'opening') + " had started " + this.changeTime + "; " + (Date.now() - this.changeTime) + 'ms ago'); const disposition = ((Date.now() - this.changeTime) / (10 * this.duration)); if (this.assumedState === BLINDS_CLOSING) { this.assumedPosition = BLINDS_OPEN - disposition; } else { this.assumedPosition = this.minPosition + disposition; } - console.log("[Tuya] Blinds' adjusted assumedPosition is " + this.assumedPosition); + this.log.info(" Blinds' adjusted assumedPosition is " + this.assumedPosition); } const duration = Math.abs(this.assumedPosition - value) * this.duration * 10; @@ -272,10 +272,10 @@ class SimpleBlindsAccessory extends BaseAccessory { } if (value !== BLINDS_OPEN && value !== BLINDS_CLOSED) { - console.log("[Tuya] Blinds will stop in " + duration + "ms"); - console.log("[Tuya] Blinds assumed started " + this.changeTime + "; " + (Date.now() - this.changeTime) + 'ms ago'); + this.log.info(" Blinds will stop in " + duration + "ms"); + this.log.info(" Blinds assumed started " + this.changeTime + "; " + (Date.now() - this.changeTime) + 'ms ago'); this.changeTimeout = setTimeout(() => { - console.log("[Tuya] Blinds asked to stop"); + this.log.info(" Blinds asked to stop"); this.setState(this.dpAction, this.cmdStop); }, duration); } diff --git a/lib/SimpleFanAccessory.js b/lib/SimpleFanAccessory.js index b5a3c14c..58bfe498 100644 --- a/lib/SimpleFanAccessory.js +++ b/lib/SimpleFanAccessory.js @@ -50,7 +50,7 @@ class SimpleFanAccessory extends BaseAccessory { if (changes.hasOwnProperty(this.dpRotationSpeed) && characteristicRotationSpeed.value !== changes[this.dpRotationSpeed]) characteristicRotationSpeed.updateValue(changes[this.dpRotationSpeed]); - console.log('[Tuya] SimpleFan changed: ' + JSON.stringify(state)); + this.log.debug('SimpleFan changed: ' + JSON.stringify(state)); }); } @@ -78,10 +78,10 @@ class SimpleFanAccessory extends BaseAccessory { } else { if (this.fanCurrentSpeed === 0) { // The current fanDefaultSpeed Variable is there to have the fan set to a sensible default if turned on. - return this.setMultiState({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); } else { // The current fanCurrentSpeed Variable is there to ensure the fan speed doesn't change if the fan is already on. - return this.setMultiState({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanCurrentSpeed.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanCurrentSpeed.toString()}, callback); } } callback(); @@ -105,12 +105,12 @@ class SimpleFanAccessory extends BaseAccessory { const {Characteristic} = this.hap; if (value === 0) { // This is to set the fan speed variable to be 1 when the fan is off. - return this.setMultiState({[this.dpFanOn]: false, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: false, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); } else { // This is to set the fan speed variable to match the current speed. this.fanCurrentSpeed = value; // This uses the multistate set command to send the fan on and speed request in one call. - return this.setMultiState({[this.dpFanOn]: true, [this.dpRotationSpeed]: value.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: true, [this.dpRotationSpeed]: value.toString()}, callback); } callback(); } diff --git a/lib/SimpleFanLightAccessory.js b/lib/SimpleFanLightAccessory.js index 7ed01532..7b251c59 100644 --- a/lib/SimpleFanLightAccessory.js +++ b/lib/SimpleFanLightAccessory.js @@ -84,7 +84,7 @@ class SimpleFanLightAccessory extends BaseAccessory { if (changes.hasOwnProperty(this.dpBrightness) && characteristicBrightness && characteristicBrightness.value !== changes[this.dpBrightness]) characteristicBrightness.updateValue(changes[this.dpBrightness]); - console.log('[Tuya] SimpleFanLight changed: ' + JSON.stringify(state)); + this.log.debug('SimpleFanLight changed: ' + JSON.stringify(state)); }); } @@ -104,7 +104,7 @@ class SimpleFanLightAccessory extends BaseAccessory { setFanOn(value, callback) { const {Characteristic} = this.hap; - // This uses the multistate set command to send the fan on and speed request in one call. + // This uses the multistatelegacy set command to send the fan on and speed request in one call. if (value == false ) { this.fanCurrentSpeed = 0; // This will turn off the fan speed if it is set to be 0. @@ -112,10 +112,10 @@ class SimpleFanLightAccessory extends BaseAccessory { } else { if (this.fanCurrentSpeed === 0) { // The current fanDefaultSpeed Variable is there to have the fan set to a sensible default if turned on. - return this.setMultiState({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); } else { // The current fanCurrentSpeed Variable is there to ensure the fan speed doesn't change if the fan is already on. - return this.setMultiState({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanCurrentSpeed.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: value, [this.dpRotationSpeed]: this.fanCurrentSpeed.toString()}, callback); } } callback(); @@ -139,12 +139,12 @@ class SimpleFanLightAccessory extends BaseAccessory { const {Characteristic} = this.hap; if (value === 0) { // This is to set the fan speed variable to be 1 when the fan is off. - return this.setMultiState({[this.dpFanOn]: false, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: false, [this.dpRotationSpeed]: this.fanDefaultSpeed.toString()}, callback); } else { // This is to set the fan speed variable to match the current speed. this.fanCurrentSpeed = value; // This uses the multistate set command to send the fan on and speed request in one call. - return this.setMultiState({[this.dpFanOn]: true, [this.dpRotationSpeed]: value.toString()}, callback); + return this.setMultiStateLegacy({[this.dpFanOn]: true, [this.dpRotationSpeed]: value.toString()}, callback); } callback(); } diff --git a/lib/SimpleHeaterAccessory.js b/lib/SimpleHeaterAccessory.js index 4308273a..a6862d75 100644 --- a/lib/SimpleHeaterAccessory.js +++ b/lib/SimpleHeaterAccessory.js @@ -80,7 +80,7 @@ class SimpleHeaterAccessory extends BaseAccessory { if (changes.hasOwnProperty(this.dpCurrentTemperature) && characteristicCurrentTemperature.value !== changes[this.dpCurrentTemperature]) characteristicCurrentTemperature.updateValue(this._getDividedState(changes[this.dpCurrentTemperature], this.temperatureDivisor)); - console.log('[Tuya] SimpleHeater changed: ' + JSON.stringify(state)); + this.log.info('SimpleHeater changed: ' + JSON.stringify(state)); }); } diff --git a/lib/SimpleLightAccessory.js b/lib/SimpleLightAccessory.js index 28da61ed..5086350c 100644 --- a/lib/SimpleLightAccessory.js +++ b/lib/SimpleLightAccessory.js @@ -31,7 +31,7 @@ class SimpleLightAccessory extends BaseAccessory { this.device.on('change', (changes, state) => { if (changes.hasOwnProperty(this.dpPower) && characteristicOn.value !== changes[this.dpPower]) characteristicOn.updateValue(changes[this.dpPower]); - console.log('[Tuya] SimpleLight changed: ' + JSON.stringify(state)); + this.log.info('SimpleLight changed: ' + JSON.stringify(state)); }); } } diff --git a/lib/SwitchAccessory.js b/lib/SwitchAccessory.js index f6b9504e..a9b11740 100644 --- a/lib/SwitchAccessory.js +++ b/lib/SwitchAccessory.js @@ -35,7 +35,7 @@ class SwitchAccessory extends BaseAccessory { this.accessory.services .filter(service => service.UUID === Service.Switch.UUID && !_validServices.includes(service)) .forEach(service => { - console.log('Removing', service.displayName); + this.log.info('Removing', service.displayName); this.accessory.removeService(service); }); } diff --git a/lib/TuyaAccessory.js b/lib/TuyaAccessory.js index 6f7a7b06..6627fb47 100644 --- a/lib/TuyaAccessory.js +++ b/lib/TuyaAccessory.js @@ -13,7 +13,9 @@ class TuyaAccessory extends EventEmitter { constructor(props) { super(); - if (!(props.id && props.key && props.ip) && !props.fake) return console.log('[Tuya] Insufficient details to initialize:', props); + if (!(props.id && props.key && props.ip) && !props.fake) return this.log.info('Insufficient details to initialize:', props); + + this.log = props.log; this.context = {version: '3.1', port: 6668, ...props}; @@ -24,7 +26,7 @@ class TuyaAccessory extends EventEmitter { if (this.context.version >= 3.2) { this.context.pingGap = Math.min(this.context.pingGap || 9, 9); - //console.log(`[Tuya] Changing ping gap for ${this.context.name} to ${this.context.pingGap}s`); + //this.log.info(`Changing ping gap for ${this.context.name} to ${this.context.pingGap}s`); } this.connected = false; @@ -47,7 +49,7 @@ class TuyaAccessory extends EventEmitter { this._incrementAttemptCounter(); (this._socket.reconnect = () => { - //console.log(`[Tuya DEBUG] reconnect called for ${this.context.name}`); + //this.log.debug(`reconnect called for ${this.context.name}`); if (this._socket._pinger) { clearTimeout(this._socket._pinger); this._socket._pinger = null; @@ -140,10 +142,10 @@ class TuyaAccessory extends EventEmitter { this._socket.on('error', err => { this.connected = false; - console.log(`[Tuya] Socket had a problem and will reconnect to ${this.context.name} (${err && err.code || err})`); + this.log.info(`Socket had a problem and will reconnect to ${this.context.name} (${err && err.code || err})`); if (err && (err.code === 'ECONNRESET' || err.code === 'EPIPE') && this._connectionAttempts < 10) { - console.log(`[Tuya DEBUG] Reconnecting with connection attempts = ${this._connectionAttempts}`); + this.log.debug(`Reconnecting with connection attempts = ${this._connectionAttempts}`); return process.nextTick(this._socket.reconnect.bind(this)); } @@ -152,19 +154,19 @@ class TuyaAccessory extends EventEmitter { let delay = 5000; if (err) { if (err.code === 'ENOBUFS') { - console.warn('[Tuya] Operating system complained of resource exhaustion; did I open too many sockets?'); - console.log('[Tuya] Slowing down retry attempts; if you see this happening often, it could mean some sort of incompatibility.'); + this.log.warn('Operating system complained of resource exhaustion; did I open too many sockets?'); + this.log.info('Slowing down retry attempts; if you see this happening often, it could mean some sort of incompatibility.'); delay = 60000; } else if (this._connectionAttempts > 10) { - console.log('[Tuya] Slowing down retry attempts; if you see this happening often, it could mean some sort of incompatibility.'); + this.log.info('Slowing down retry attempts; if you see this happening often, it could mean some sort of incompatibility.'); delay = 60000; } } if (!this._socket._errorReconnect) { - console.log(`[Tuya DEBUG] after error setting _connect in ${delay}ms`); + this.log.debug(`after error setting _connect in ${delay}ms`); this._socket._errorReconnect = setTimeout(() => { - console.log(`[Tuya DEBUG] executing _connect after ${delay}ms delay`); + this.log.debug(`executing _connect after ${delay}ms delay`); process.nextTick(this._connect.bind(this)); }, delay); } @@ -172,19 +174,19 @@ class TuyaAccessory extends EventEmitter { this._socket.on('close', err => { this.connected = false; - //console.log('[Tuya] Closed connection with', this.context.name); + //this.log.info('Closed connection with', this.context.name); }); this._socket.on('end', () => { this.connected = false; - console.log('[Tuya] Disconnected from', this.context.name); + this.log.info('Disconnected from', this.context.name); }); } _incrementAttemptCounter() { this._connectionAttempts++; setTimeout(() => { - console.log(`[Tuya DEBUG] decrementing this._connectionAttempts, currently ${this._connectionAttempts}`); + this.log.debug(`decrementing this._connectionAttempts, currently ${this._connectionAttempts}`); this._connectionAttempts--; }, 10000); } @@ -205,7 +207,7 @@ class TuyaAccessory extends EventEmitter { let data = task.msg.slice(len - size, len - 8).toString('utf8').trim().replace(/\0/g, ''); if (this.context.intro === false && cmd !== 9) - console.log('[Tuya] Message from', this.context.name + ':', data); + this.log.info('Message from', this.context.name + ':', data); switch (cmd) { case 7: @@ -233,13 +235,13 @@ class TuyaAccessory extends EventEmitter { data = JSON.parse(decryptedMsg); } catch (ex) { data = decryptedMsg; - console.log(`[Tuya] Odd message from ${this.context.name} with command ${cmd}:`, data); - console.log(`[Tuya] Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); + this.log.info(`Odd message from ${this.context.name} with command ${cmd}:`, data); + this.log.info(`Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); break; } if (data && data.dps) { - //console.log('[Tuya] Update from', this.context.name, 'with command', cmd + ':', data.dps); + //this.log.info('Update from', this.context.name, 'with command', cmd + ':', data.dps); this._change(data.dps); } break; @@ -247,7 +249,7 @@ class TuyaAccessory extends EventEmitter { case 10: if (data) { if (data === 'json obj data unvalid') { - console.log(`[Tuya] ${this.context.name} (${this.context.version}) didn't respond with its current state.`); + this.log.info(`${this.context.name} (${this.context.version}) didn't respond with its current state.`); this.emit('change', {}, this.state); break; } @@ -255,8 +257,8 @@ class TuyaAccessory extends EventEmitter { try { data = JSON.parse(data); } catch (ex) { - console.log(`[Tuya] Malformed update from ${this.context.name} with command ${cmd}:`, data); - console.log(`[Tuya] Raw update from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); + this.log.info(`Malformed update from ${this.context.name} with command ${cmd}:`, data); + this.log.info(`Raw update from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); break; } @@ -265,8 +267,8 @@ class TuyaAccessory extends EventEmitter { break; default: - console.log(`[Tuya] Odd message from ${this.context.name} with command ${cmd}:`, data); - console.log(`[Tuya] Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); + this.log.info(`Odd message from ${this.context.name} with command ${cmd}:`, data); + this.log.info(`Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); } callback(); @@ -310,7 +312,7 @@ class TuyaAccessory extends EventEmitter { } if (cmd === 10 && decryptedMsg === 'json obj data unvalid') { - console.log(`[Tuya] ${this.context.name} (${this.context.version}) didn't respond with its current state.`); + this.log.info(`${this.context.name} (${this.context.version}) didn't respond with its current state.`); this.emit('change', {}, this.state); return callback(); } @@ -319,8 +321,8 @@ class TuyaAccessory extends EventEmitter { try { data = JSON.parse(decryptedMsg); } catch(ex) { - console.log(`[Tuya] Odd message from ${this.context.name} with command ${cmd}:`, decryptedMsg); - console.log(`[Tuya] Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); + this.log.info(`Odd message from ${this.context.name} with command ${cmd}:`, decryptedMsg); + this.log.info(`Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); return callback(); } @@ -329,18 +331,18 @@ class TuyaAccessory extends EventEmitter { case 10: if (data) { if (data.dps) { - //console.log(`[Tuya] Heard back from ${this.context.name} with command ${cmd}`); + //this.log.info(`Heard back from ${this.context.name} with command ${cmd}`); this._change(data.dps); } else { - console.log(`[Tuya] Malformed message from ${this.context.name} with command ${cmd}:`, decryptedMsg); - console.log(`[Tuya] Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); + this.log.info(`Malformed message from ${this.context.name} with command ${cmd}:`, decryptedMsg); + this.log.info(`Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); } } break; default: - console.log(`[Tuya] Odd message from ${this.context.name} with command ${cmd}:`, decryptedMsg); - console.log(`[Tuya] Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); + this.log.info(`Odd message from ${this.context.name} with command ${cmd}:`, decryptedMsg); + this.log.info(`Raw message from ${this.context.name} (${this.context.version}) with command ${cmd}:`, task.msg.toString('hex')); } callback(); @@ -363,7 +365,7 @@ class TuyaAccessory extends EventEmitter { let result = false; if (hasDataPoint) { - //console.log("[Tuya] Sending", this.context.name, JSON.stringify(dps)); + //this.log.info(" Sending", this.context.name, JSON.stringify(dps)); result = this._send({ data: { devId: this.context.id, @@ -373,13 +375,13 @@ class TuyaAccessory extends EventEmitter { }, cmd: 7 }); - if (result !== true) console.log("[Tuya] Result", result); + if (result !== true) this.log.info(" Result", result); if (this.context.sendEmptyUpdate) { - //console.log("[Tuya] Sending", this.context.name, 'empty signature'); + //this.log.info(" Sending", this.context.name, 'empty signature'); this._send({cmd: 7}); } } else { - //console.log(`[Tuya] Sending first query to ${this.context.name} (${this.context.version})`); + //this.log.info(`Sending first query to ${this.context.name} (${this.context.version})`); result = this._send({ data: { gwId: this.context.id, @@ -488,7 +490,7 @@ class TuyaAccessory extends EventEmitter { } _fakeUpdate(dps) { - console.log('[Tuya] Fake update:', JSON.stringify(dps)); + this.log.info('Fake update:', JSON.stringify(dps)); Object.keys(dps).forEach(dp => { this.state[dp] = dps[dp]; }); diff --git a/lib/TuyaDiscovery.js b/lib/TuyaDiscovery.js index d0777155..c34c06b2 100644 --- a/lib/TuyaDiscovery.js +++ b/lib/TuyaDiscovery.js @@ -15,6 +15,8 @@ class TuyaDiscovery extends EventEmitter { } start(props) { + this.log = props.log; + const opts = props || {}; if (opts.clear) { @@ -45,7 +47,7 @@ class TuyaDiscovery extends EventEmitter { process.nextTick(() => { this.removeAllListeners(); this.discovered.clear(); - console.log('[Tuya] Discovery ended.'); + this.log.info('Discovery ended.'); this.emit('end'); }); @@ -61,7 +63,7 @@ class TuyaDiscovery extends EventEmitter { server.on('message', this._onDgramMessage.bind(this, port)); server.bind(port, () => { - console.log(`[TuyaDiscovery] Discovery started on port ${port}.`); + this.log.info(`Discovery - Discovery started on port ${port}.`); }); } @@ -77,20 +79,20 @@ class TuyaDiscovery extends EventEmitter { this._stop(port); if (err && err.code === 'EADDRINUSE') { - console.warn(`[TuyaDiscovery] Port ${port} is in use. Will retry in 15 seconds.`); + this.log.warn(`Discovery - Port ${port} is in use. Will retry in 15 seconds.`); setTimeout(() => { this._start(port); }, 15000); } else { - console.error(`[TuyaDiscovery] Port ${port} failed:\n${err.stack}`); + this.log.error(`Discovery - Port ${port} failed:\n${err.stack}`); } } _onDgramClose(port) { this._stop(port); - console.info(`[TuyaDiscovery] Port ${port} closed.${this._running ? ' Restarting...' : ''}`); + this.log.info(`Discovery - Port ${port} closed.${this._running ? ' Restarting...' : ''}`); if (this._running) setTimeout(() => { this._start(port); @@ -99,18 +101,18 @@ class TuyaDiscovery extends EventEmitter { _onDgramMessage(port, msg, info) { const len = msg.length; - // console.log(`[TuyaDiscovery] UDP from ${info.address}:${port} 0x${msg.readUInt32BE(0).toString(16).padStart(8, '0')}...0x${msg.readUInt32BE(len - 4).toString(16).padStart(8, '0')}`); + // this.log.info(`Discovery - UDP from ${info.address}:${port} 0x${msg.readUInt32BE(0).toString(16).padStart(8, '0')}...0x${msg.readUInt32BE(len - 4).toString(16).padStart(8, '0')}`); if (len < 16 || msg.readUInt32BE(0) !== 0x000055aa || msg.readUInt32BE(len - 4) !== 0x0000aa55 ) { - console.log(`[TuyaDiscovery] ERROR: UDP from ${info.address}:${port}`, msg.toString('hex')); + this.log.error(`Discovery - UDP from ${info.address}:${port}`, msg.toString('hex')); return; } const size = msg.readUInt32BE(12); if (len - size < 8) { - console.log(`[TuyaDiscovery] ERROR: UDP from ${info.address}:${port} size ${len - size}`); + this.log.error(`Discovery - UDP from ${info.address}:${port} size ${len - size}`); return; } @@ -131,10 +133,10 @@ class TuyaDiscovery extends EventEmitter { try { const result = JSON.parse(decryptedMsg); if (result && result.gwId && result.ip) this._onDiscover(result); - else console.log(`[TuyaDiscovery] ERROR: UDP from ${info.address}:${port} decrypted`, cleanMsg.toString('hex')); + else this.log.error(`Discovery - UDP from ${info.address}:${port} decrypted`, cleanMsg.toString('hex')); } catch (ex) { - console.error(`[TuyaDiscovery] Failed to parse discovery response on port ${port}: ${decryptedMsg}`); - console.error(`[TuyaDiscovery] Failed to parse discovery raw message on port ${port}: ${msg.toString('hex')}`); + this.log.error(`Discovery - Failed to parse discovery response on port ${port}: ${decryptedMsg}`); + this.log.error(`Discovery - Failed to parse discovery raw message on port ${port}: ${msg.toString('hex')}`); } } diff --git a/lib/ValveAccessory.js b/lib/ValveAccessory.js index b6b3ef5c..7cafc3a7 100644 --- a/lib/ValveAccessory.js +++ b/lib/ValveAccessory.js @@ -60,7 +60,7 @@ class ValveAccessory extends BaseAccessory { next(null, this.setDuration) }) .on('change', (data)=> { - console.log("[Tuya] Water Valve Time Duration Set to: " + data.newValue/60 + " Minutes") + this.log.info("Water Valve Time Duration Set to: " + data.newValue/60 + " Minutes") this.setDuration = data.newValue if(service.getCharacteristic(Characteristic.InUse).value) { @@ -70,7 +70,7 @@ class ValveAccessory extends BaseAccessory { clearTimeout(this.timer); // clear any existing timer this.timer = setTimeout( ()=> { - console.log("[Tuya] Water Valve Timer Expired. Shutting OFF Valve"); + this.log.info("Water Valve Timer Expired. Shutting OFF Valve"); service.getCharacteristic(Characteristic.Active).setValue(0); service.getCharacteristic(Characteristic.InUse).updateValue(0); this.lastActivationTime = null; @@ -94,16 +94,16 @@ class ValveAccessory extends BaseAccessory { service.getCharacteristic(Characteristic.RemainingDuration).updateValue(0); service.getCharacteristic(Characteristic.Active).updateValue(0); clearTimeout(this.timer); // clear the timer if it was used! - console.log("[Tuya] Water Valve is OFF!"); + this.log.info("Water Valve is OFF!"); break; case 1: this.lastActivationTime = (new Date()).getTime(); service.getCharacteristic(Characteristic.RemainingDuration).updateValue(this.setDuration); service.getCharacteristic(Characteristic.Active).updateValue(1); - console.log("[Tuya] Water Valve Turning ON with Timer Set to: "+ this.setDuration/60 + " Minutes"); + this.log.info("Water Valve Turning ON with Timer Set to: "+ this.setDuration/60 + " Minutes"); clearTimeout(this.timer); // clear any existing timer this.timer = setTimeout(()=> { - console.log("[Tuya] Water Valve Timer Expired. Shutting OFF Valve"); + this.log.info("Water Valve Timer Expired. Shutting OFF Valve"); // use 'setvalue' when the timer ends so it triggers the .on('set'...) event service.getCharacteristic(Characteristic.Active).setValue(0); service.getCharacteristic(Characteristic.InUse).updateValue(0); @@ -119,10 +119,10 @@ class ValveAccessory extends BaseAccessory { service.getCharacteristic(Characteristic.RemainingDuration).updateValue(this.setDuration); service.getCharacteristic(Characteristic.Active).updateValue(1); service.getCharacteristic(Characteristic.InUse).updateValue(1); - console.log("[Tuya] Water Valve is ON After Restart. Setting Timer to: "+ this.setDuration/60 + " Minutes"); + this.log.info("Water Valve is ON After Restart. Setting Timer to: "+ this.setDuration/60 + " Minutes"); clearTimeout(this.timer); // clear any existing timer this.timer = setTimeout(()=> { - console.log("[Tuya] Water Valve Timer Expired. Shutting OFF Valve"); + this.log.info("Water Valve Timer Expired. Shutting OFF Valve"); // use 'setvalue' when the timer ends so it triggers the .on('set'...) event service.getCharacteristic(Characteristic.Active).setValue(0); this.lastActivationTime = null; diff --git a/package-lock.json b/package-lock.json index 45fa44d3..306e08c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,129 +1,184 @@ { "name": "homebridge-tuya", - "version": "3.0.0-beta.2", - "lockfileVersion": 1, + "version": "3.1.0-beta.12", + "lockfileVersion": 3, "requires": true, - "dependencies": { - "@babel/runtime": { + "packages": { + "": { + "name": "homebridge-tuya", + "version": "3.1.0-beta.12", + "license": "MIT", + "dependencies": { + "async": "^3.2.2", + "commander": "^3.0.1", + "fs-extra": "^8.1.0", + "http-mitm-proxy": "^1.1.0", + "json5": "^2.2.0", + "qrcode": "^1.4.1", + "yaml": "^1.6.0" + }, + "bin": { + "tuya-lan": "bin/cli.js", + "tuya-lan-decode": "bin/cli-decode.js", + "tuya-lan-find": "bin/cli-find.js" + }, + "engines": { + "homebridge": ">=0.4.0", + "node": ">=8.6.0" + } + }, + "node_modules/@babel/runtime": { "version": "7.6.0", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.0.tgz", "integrity": "sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ==", - "requires": { + "dependencies": { "regenerator-runtime": "^0.13.2" } }, - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" + "node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "engines": { + "node": ">=6" + } }, - "ansi-styles": { + "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { + "dependencies": { "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" } }, - "async": { + "node_modules/async": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/async/-/async-3.2.2.tgz", "integrity": "sha512-H0E+qZaDEfx/FY4t7iLRv1W2fFI6+pyCeTw1uN20AQPiwqwM6ojPxHxdLv4z8hi2DtnW9BOckSspLucW7pIE5g==" }, - "camelcase": { + "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "engines": { + "node": ">=6" + } }, - "cliui": { + "node_modules/cliui": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "requires": { + "dependencies": { "string-width": "^3.1.0", "strip-ansi": "^5.2.0", "wrap-ansi": "^5.1.0" } }, - "color-convert": { + "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "requires": { + "dependencies": { "color-name": "1.1.3" } }, - "color-name": { + "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" }, - "commander": { + "node_modules/commander": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.1.tgz", "integrity": "sha512-UNgvDd+csKdc9GD4zjtkHKQbT8Aspt2jCBqNSPp53vAS0L1tS9sXB2TCEOPHJ7kt9bN/niWkYj8T3RQSoMXdSQ==" }, - "debug": { + "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "requires": { + "dependencies": { "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "decamelize": { + "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "engines": { + "node": ">=0.10.0" + } }, - "dijkstrajs": { + "node_modules/dijkstrajs": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz", "integrity": "sha1-082BIh4+pAdCz83lVtTpnpjdxxs=" }, - "emoji-regex": { + "node_modules/emoji-regex": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" }, - "escalade": { + "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } }, - "find-up": { + "node_modules/find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "requires": { + "dependencies": { "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "fs-extra": { + "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "requires": { + "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" } }, - "get-caller-file": { + "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } }, - "graceful-fs": { + "node_modules/graceful-fs": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==" }, - "http-mitm-proxy": { + "node_modules/http-mitm-proxy": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/http-mitm-proxy/-/http-mitm-proxy-1.1.0.tgz", "integrity": "sha512-GyjWXiukopLzp6Yg4Dk1M+6Yfp5c/rPtqXDGaRopeJH1bd9F6k2cyJrB98kKmJaMU2P7kA5LLHbtuFc8HcNvrA==", - "requires": { + "dependencies": { "async": "^3.2.5", "debug": "^4.3.4", "mkdirp": "^1.0.4", @@ -133,302 +188,420 @@ "ws": "^8.14.2", "yargs": "^17.7.2" }, + "bin": { + "http-mitm-proxy": "dist/bin/mitm-proxy.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/http-mitm-proxy/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/http-mitm-proxy/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dependencies": { - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "requires": { - "color-convert": "^2.0.1" - } - }, - "async": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", - "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" - }, - "cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" - }, - "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==" - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" - }, - "yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "requires": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - } - }, - "yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" - } + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/http-mitm-proxy/node_modules/async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" + }, + "node_modules/http-mitm-proxy/node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/http-mitm-proxy/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/http-mitm-proxy/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/http-mitm-proxy/node_modules/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==" + }, + "node_modules/http-mitm-proxy/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" } }, - "is-fullwidth-code-point": { + "node_modules/http-mitm-proxy/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/http-mitm-proxy/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/http-mitm-proxy/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/http-mitm-proxy/node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/http-mitm-proxy/node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/http-mitm-proxy/node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "engines": { + "node": ">=4" + } }, - "isarray": { + "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==" }, - "json5": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz", - "integrity": "sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ==", - "requires": { - "minimist": ">=1.2.2" + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" }, - "dependencies": { - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" - } + "engines": { + "node": ">=6" } }, - "jsonfile": { + "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { + "optionalDependencies": { "graceful-fs": "^4.1.6" } }, - "locate-path": { + "node_modules/locate-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "requires": { + "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "mkdirp": { + "node_modules/mkdirp": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } }, - "ms": { + "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, - "node-forge": { + "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", - "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==" + "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", + "engines": { + "node": ">= 6.13.0" + } }, - "p-limit": { + "node_modules/p-limit": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", - "requires": { + "dependencies": { "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" } }, - "p-locate": { + "node_modules/p-locate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "requires": { + "dependencies": { "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" } }, - "p-try": { + "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "engines": { + "node": ">=6" + } }, - "path-exists": { + "node_modules/path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=" + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "engines": { + "node": ">=4" + } }, - "pngjs": { + "node_modules/pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", + "engines": { + "node": ">=4.0.0" + } }, - "qrcode": { + "node_modules/qrcode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.4.1.tgz", "integrity": "sha512-3JhHQJkKqJL4PfoM6t+B40f0GWv9eNJAJmuNx2X/sHEOLvMyvEPN8GfbdN1qmr19O8N2nLraOzeWjXocHz1S4w==", - "requires": { + "dependencies": { "dijkstrajs": "^1.0.1", "isarray": "^2.0.1", "pngjs": "^3.3.0", "yargs": "^13.2.4" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=4" } }, - "regenerator-runtime": { + "node_modules/regenerator-runtime": { "version": "0.13.3", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" }, - "require-directory": { + "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "engines": { + "node": ">=0.10.0" + } }, - "require-main-filename": { + "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" }, - "semaphore": { + "node_modules/semaphore": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/semaphore/-/semaphore-1.1.0.tgz", - "integrity": "sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA==" + "integrity": "sha512-O4OZEaNtkMd/K0i6js9SL+gqy0ZCBMgUvlSqHKi4IBdjhe7wB8pwztUk1BbZ1fmrvpwFrPbHzqd2w5pTcJH6LA==", + "engines": { + "node": ">=0.8.0" + } }, - "set-blocking": { + "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, - "string-width": { + "node_modules/string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "requires": { + "dependencies": { "emoji-regex": "^7.0.1", "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" } }, - "strip-ansi": { + "node_modules/strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "requires": { + "dependencies": { "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" } }, - "universalify": { + "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "engines": { + "node": ">= 4.0.0" + } }, - "uuid": { + "node_modules/uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } }, - "which-module": { + "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" }, - "wrap-ansi": { + "node_modules/wrap-ansi": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "requires": { + "dependencies": { "ansi-styles": "^3.2.0", "string-width": "^3.0.0", "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" } }, - "ws": { + "node_modules/ws": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==" + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } }, - "y18n": { + "node_modules/y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" }, - "yaml": { + "node_modules/yaml": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.6.0.tgz", "integrity": "sha512-iZfse3lwrJRoSlfs/9KQ9iIXxs9++RvBFVzAqbbBiFT+giYtyanevreF9r61ZTbGMgWQBxAua3FzJiniiJXWWw==", - "requires": { + "dependencies": { "@babel/runtime": "^7.4.5" + }, + "engines": { + "node": ">= 6" } }, - "yargs": { + "node_modules/yargs": { "version": "13.3.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", - "requires": { + "dependencies": { "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", @@ -441,11 +614,11 @@ "yargs-parser": "^13.1.1" } }, - "yargs-parser": { + "node_modules/yargs-parser": { "version": "13.1.2", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "requires": { + "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" } diff --git a/package.json b/package.json index c03d5740..cc9984ef 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "homebridge-tuya", - "version": "3.0.0-beta.2", + "version": "3.1.0", "description": "🏠 Offical Homebridge plugin for TuyAPI ", "main": "index.js", @@ -24,11 +24,11 @@ }, "homepage": "https://github.com/iRayanKhan/homebridge-tuya#readme", "dependencies": { - "async": "^3.1.0", + "async": "^3.2.2", "commander": "^3.0.1", "fs-extra": "^8.1.0", "http-mitm-proxy": "^1.1.0", - "json5": "^2.1.0", + "json5": "^2.2.0", "qrcode": "^1.4.1", "yaml": "^1.6.0" },