From b4ec78afbb74811290389ff32567cdcc3255d12f Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Wed, 8 Feb 2023 10:19:57 +0100 Subject: [PATCH] bump 3.23.0 --- CHANGELOG.md | 5 +++++ README.md | 5 +++++ config.schema.json | 8 ++++++++ index.js | 6 ++++-- package.json | 4 ++-- sample-config.json | 4 ++++ src/denon.js | 7 ++++--- 7 files changed, 32 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 667a635..5f71476 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Note - after update to 3.15.x need remove the accessory frome Home app and add it again. +## [3.23.0] - (08.02.2023) +## Changes +- added possibility to disable log device connect error +- config.schema updated + ## [3.22.0] - (07.02.2023) ## Changes - added possibility load inputs from device (release) diff --git a/README.md b/README.md index d9f54f1..e9fb511 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ This plugin is based upon the official documentation for communicating with and | `enableDebugMode` | If enabled, deep log will be present in homebridge console. | | `disableLogInfo` | If enabled, disable log info, all values and state will not be displayed in Homebridge log console. | | `disableLogDeviceInfo` | If enabled, add ability to disable log device info by every connections device to the network. | +| `disableLogConnectError` | If enabled, disable logging device connect error. | | `masterPower` | If enabled, then the Power switch for that zone (typically you would only use this for the Main Zone) will turn the entire receiver `ON` or `OFF/STANDBY` rather than just the zone itself | | `masterVolume`| If enabled, then the Volume for that zone (typically you would only use this for the Main Zone) will set the entire receiver `UP` or `DOWN` rather than just the zone itself | | `masterMute`| If enabled, then the Mute switch for that zone (typically you would only use this for the Main Zone) will muted the entire receiver `ON` or `OFF` rather than just the zone itself | @@ -158,6 +159,7 @@ This plugin is based upon the official documentation for communicating with and "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, @@ -214,6 +216,7 @@ This plugin is based upon the official documentation for communicating with and "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, @@ -270,6 +273,7 @@ This plugin is based upon the official documentation for communicating with and "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, @@ -309,6 +313,7 @@ This plugin is based upon the official documentation for communicating with and "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "refreshInterval": 5, "infoButtonCommand": "MNINF", "enableMqtt": false, diff --git a/config.schema.json b/config.schema.json index 744cb2d..7b669b3 100644 --- a/config.schema.json +++ b/config.schema.json @@ -239,6 +239,13 @@ "description": "This disable log device info by every connections device to the network.", "required": false }, + "disableLogConnectError": { + "title": "Disable Log Connect Error", + "type": "boolean", + "default": false, + "description": "This disable logging device connect error.", + "required": false + }, "enableDebugMode": { "title": "Debug", "type": "boolean", @@ -3665,6 +3672,7 @@ "devices[].enableDebugMode", "devices[].disableLogInfo", "devices[].disableLogDeviceInfo", + "devices[].disableLogConnectError", "devices[].masterPower", "devices[].masterVolume", "devices[].masterMute", diff --git a/index.js b/index.js index d10c3cb..8251572 100644 --- a/index.js +++ b/index.js @@ -78,6 +78,7 @@ class denonTvDevice { this.sensorInputs = config.sensorInputs || []; this.disableLogInfo = config.disableLogInfo || false; this.disableLogDeviceInfo = config.disableLogDeviceInfo || false; + this.disableLogConnectError = config.disableLogConnectError || false; this.enableDebugMode = config.enableDebugMode || false; this.getInputsFromDevice = config.getInputsFromDevice || false; this.inputs = config.inputs || []; @@ -171,6 +172,7 @@ class denonTvDevice { host: this.host, port: this.port, debugLog: this.enableDebugMode, + disableLogConnectError: this.disableLogConnectError, zoneControl: this.zoneControl, refreshInterval: this.refreshInterval, mqttEnabled: this.mqttEnabled @@ -346,8 +348,8 @@ class denonTvDevice { } if (!this.getInputsFromDevice && this.inputSwitchButtonServices) { - const switchServicesCount = this.inputSwitchButtonServices.length; - for (let i = 0; i < switchServicesCount; i++) { + const switchButtonServicesCount = this.inputSwitchButtonServices.length; + for (let i = 0; i < switchButtonServicesCount; i++) { const index = this.inputsSwitchesButtons[i]; const state = power ? (this.inputsReference[index] === reference) : false; const displayType = this.inputsDisplayType[index]; diff --git a/package.json b/package.json index d1929cd..4c43ceb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "Denon TV", "name": "homebridge-denon-tv", - "version": "3.22.3", + "version": "3.23.0", "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Denon/Marantz AV Receivers.", "license": "MIT", "author": "grzegorz914", @@ -30,7 +30,7 @@ "dependencies": { "async-mqtt": "^2.6.3", "axios": "^1.3.2", - "xml2js": ">=0.4.23" + "xml2js": "^0.4.23" }, "keywords": [ "homebridge", diff --git a/sample-config.json b/sample-config.json index 03db049..7afec78 100644 --- a/sample-config.json +++ b/sample-config.json @@ -63,6 +63,7 @@ "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, @@ -119,6 +120,7 @@ "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, @@ -175,6 +177,7 @@ "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, @@ -214,6 +217,7 @@ "enableDebugMode": false, "disableLogInfo": false, "disableLogDeviceInfo": false, + "disableLogConnectError": false, "infoButtonCommand": "MNINF", "refreshInterval": 5, "enableMqtt": false, diff --git a/src/denon.js b/src/denon.js index b9b38c4..8eb4054 100644 --- a/src/denon.js +++ b/src/denon.js @@ -22,6 +22,7 @@ class DENON extends EventEmitter { const host = config.host; const port = config.port; const debugLog = config.debugLog; + const disableLogConnectError = config.disableLogConnectError; const zoneControl = config.zoneControl; const mqttEnabled = config.mqttEnabled; this.refreshInterval = config.refreshInterval; @@ -74,7 +75,7 @@ class DENON extends EventEmitter { await new Promise(resolve => setTimeout(resolve, 1000)); this.emit('checkState'); } catch (error) { - this.emit('error', `Info error: ${error}, reconnect in 15s.`) + const debug = disableLogConnectError ? false : this.emit('error', `Info error: ${error}, reconnect in 15s.`) this.checkDeviceInfo(); }; }) @@ -110,7 +111,7 @@ class DENON extends EventEmitter { const mqtt2 = mqttEnabled && zoneControl === 3 ? this.emit('mqtt', 'Sound Mode', JSON.stringify({ 'surround': zoneControl === 3 ? reference : '' }, null, 2)) : false; this.checkState(); } catch (error) { - this.emit('error', `State error: ${error}, reconnect in 15s.`); + const debug = disableLogConnectError ? false : this.emit('error', `State error: ${error}, reconnect in 15s.`); const firstRun = this.checkStateOnFirstRun ? this.checkDeviceInfo() : this.emit('disconnect'); }; }) @@ -139,7 +140,7 @@ class DENON extends EventEmitter { await this.axiosInstance(apiUrl); resolve(true); } catch (error) { - this.emit('error', `Send command error: ${error}`); + this.emit('error', error); reject(error); }; });