From c2d72fb6a6b33dfce1fded14bc76ce43d92393e8 Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Sun, 4 Aug 2024 09:41:22 +0200 Subject: [PATCH] enhancement #271 , release v4.14.0 --- CHANGELOG.md | 7 ++++ README.md | 10 +++--- config.schema.json | 84 +++++++++++++++++++++++++++++----------------- package-lock.json | 19 ++++++----- package.json | 2 +- sample-config.json | 54 +++++++++++++++++------------ src/mainzone.js | 11 +++--- src/surround.js | 11 +++--- src/zone2.js | 11 +++--- src/zone3.js | 11 +++--- 10 files changed, 137 insertions(+), 83 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c3e07e..7d37f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Note - after update to 4.7.x buttons, sensors, volume display type need to be configure again using config UI. ## Note - after update to 3.15.x need remove the accessory frome Home app and add it again. +## [4.14.0] - (04.08.2024) +## Changes +- added possiblity to set own volume control name and enable/disable prefix [#271](https://github.com/grzegorz914/homebridge-denon-tv/issues/271) +- config schema updated +- bump dependencies +- cleanup + ## [4.13.28] - (03.08.2024) ## Changes - fix custom inputs names not working [#270](https://github.com/grzegorz914/homebridge-denon-tv/issues/270) diff --git a/README.md b/README.md index e6b2718..469aeb9 100644 --- a/README.md +++ b/README.md @@ -103,17 +103,19 @@ Tested Denon AVR-2112CI, AVR-3311CI, AVR-X6300H, AVR-X2700H, AVC-X4800H, Marantz | `sensorSurrounds.reference` | Here choose `Sensor Reference`, sensor fired if switch to this reference. | | `sensorSurrounds.displayType` | Here choose characteristic type to be exposed in HomeKit app, `0 - None/Disabled`, `1 - Motion Sensor`, `2 - Occupancy Sensor`, `3 - Contact Sensor`. | | `sensorSurrounds.namePrefix` | Here enable/disable the accessory name as a prefix for sensor name. | -| `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 will turn the entire receiver `ON` or `OFF/STANDBY` rather than just the zone itself. | | `masterVolume`| If enabled, then the Volume for that zone will set the entire receiver `UP` or `DOWN` rather than just the zone itself, (only for the Zone 1 and 2). | | `masterMute`| If enabled, then the Mute switch for that zone will muted the entire receiver `ON` or `OFF` rather than just the zone itself, (only for the Zone 1 and 2). | +| `volumeControlNamePrefix` | Here enable/disable the accessory name as a prefix for volume control name. | +| `volumeControlName` | Here set Your own volume control name or leave empty. | | `volumeControl` | Here choose what a additional volume control mode You want to use, `0 - None/Disabled`, `1 - Lightbulb`, `2 - Fan`. | | `volumeMax` | Here set the maximum possible volume to set, `0 - 100`. | | `infoButtonCommand` | Here choose the function for `I` button in RC app. | | `refreshInterval` | Here set the data refresh interval. | +| `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. | | `enableRestFul` | If enabled, RESTful server will start automatically and respond to any path request. | | `restFulPort` | Here set the listening `Port` for RESTful server, every zone need own port. | | `restFulDebug` | If enabled, deep log will be present in homebridge console for RESTFul server. | diff --git a/config.schema.json b/config.schema.json index e235859..ea7a4ac 100644 --- a/config.schema.json +++ b/config.schema.json @@ -6443,33 +6443,6 @@ }, "required": false }, - "masterPower": { - "title": "Master Power Control", - "type": "boolean", - "default": false, - "description": "The power switch for that zone will turn the entire receiver *ON* or *OFF/STANDBY* rather than just the zone itself.", - "required": false - }, - "masterVolume": { - "title": "Master Volume Control", - "type": "boolean", - "default": false, - "description": "The volume for that zone will set the entire receiver volume *UP* or *DOWN* rather than just the zone itself.", - "condition": { - "functionBody": "return model.devices[arrayIndices].zoneControl >= 1 && model.devices[arrayIndices].zoneControl <= 2;" - }, - "required": false - }, - "masterMute": { - "title": "Master Mute Control", - "type": "boolean", - "default": false, - "description": "The mute switch for that zone will muted the entire receiver *ON* or *OFF* rather than just the zone itself.", - "condition": { - "functionBody": "return model.devices[arrayIndices].zoneControl >= 1 && model.devices[arrayIndices].zoneControl <= 2;" - }, - "required": false - }, "infoButtonCommand": { "title": "Info Button", "type": "string", @@ -6497,6 +6470,47 @@ "description": "Here select the function of info button in RC.", "required": true }, + "masterPower": { + "title": "Master Power Control", + "type": "boolean", + "default": false, + "description": "The power switch for that zone will turn the entire receiver *ON* or *OFF/STANDBY* rather than just the zone itself.", + "required": false + }, + "masterMute": { + "title": "Master Mute Control", + "type": "boolean", + "default": false, + "description": "The mute switch for that zone will muted the entire receiver *ON* or *OFF* rather than just the zone itself.", + "condition": { + "functionBody": "return model.devices[arrayIndices].zoneControl >= 1 && model.devices[arrayIndices].zoneControl <= 2;" + }, + "required": false + }, + "masterVolume": { + "title": "Master Volume Control", + "type": "boolean", + "default": false, + "description": "The volume for that zone will set the entire receiver volume *UP* or *DOWN* rather than just the zone itself.", + "condition": { + "functionBody": "return model.devices[arrayIndices].zoneControl >= 1 && model.devices[arrayIndices].zoneControl <= 2;" + }, + "required": false + }, + "volumeControlNamePrefix": { + "title": "Volume Control Name Prefix", + "type": "boolean", + "default": false, + "description": "Here enable/disable the accessory name as a prefix for volume control name.", + "required": false + }, + "volumeControlName": { + "title": "Volume Control Name", + "type": "string", + "placeholder": "Name", + "description": "Here set Your own volume control name or leave empty.", + "required": false + }, "volumeControl": { "title": "Volume Control Mode", "type": "integer", @@ -6832,6 +6846,18 @@ "type": "tabarray", "title": "{{ value.title }}", "items": [ + { + "key": "devices[]", + "title": "Volume", + "items": [ + "devices[].masterMute", + "devices[].masterVolume", + "devices[].volumeControlNamePrefix", + "devices[].volumeControlName", + "devices[].volumeControl", + "devices[].volumeMax" + ] + }, { "key": "devices[]", "title": "Sensors", @@ -6893,11 +6919,7 @@ "title": "Device", "items": [ "devices[].masterPower", - "devices[].masterVolume", - "devices[].masterMute", "devices[].infoButtonCommand", - "devices[].volumeControl", - "devices[].volumeMax", "devices[].refreshInterval" ] }, diff --git a/package-lock.json b/package-lock.json index 1aeb129..ec21123 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "homebridge-denon-tv", - "version": "4.13.26", + "version": "4.14.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "homebridge-denon-tv", - "version": "4.13.26", + "version": "4.14.0", "license": "MIT", "dependencies": { "async-mqtt": "^2.6.3", - "axios": "^1.7.2", + "axios": "^1.7.3", "express": "^4.19.2", "fast-xml-parser": "^4.4.1" }, @@ -54,9 +54,10 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "node_modules/axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", + "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -1288,9 +1289,9 @@ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "axios": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", - "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.3.tgz", + "integrity": "sha512-Ar7ND9pU99eJ9GpoGQKhKf58GpUOgnzuaB7ueNQ5BMi0p+LZ5oaEnfF999fAArcTIBwXTCHAmGcHOZJaWPq9Nw==", "requires": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", diff --git a/package.json b/package.json index 729836d..80a50c3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "Denon TV", "name": "homebridge-denon-tv", - "version": "4.13.28", + "version": "4.14.0", "description": "Homebridge plugin to control Denon/Marantz AV Receivers.", "license": "MIT", "author": "grzegorz914", diff --git a/sample-config.json b/sample-config.json index e18cbb8..107ca88 100644 --- a/sample-config.json +++ b/sample-config.json @@ -64,15 +64,17 @@ "namePrefix": false } ], - "enableDebugMode": false, - "disableLogInfo": false, - "disableLogDeviceInfo": false, - "disableLogConnectError": false, - "masterPower": false, "infoButtonCommand": "MNINF", + "masterPower": false, + "volumeControlNamePrefix": false, + "volumeControlName": "Volume", "volumeControl": 0, "volumeMax": 0, "refreshInterval": 5, + "enableDebugMode": false, + "disableLogInfo": false, + "disableLogDeviceInfo": false, + "disableLogConnectError": false, "enableRestFul": false, "restFulPort": 3000, "restFulDebug": false, @@ -122,17 +124,19 @@ "displayType": 0 } ], - "enableDebugMode": false, - "disableLogInfo": false, - "disableLogDeviceInfo": false, - "disableLogConnectError": false, + "infoButtonCommand": "MNINF", "masterPower": false, - "masterVolume": false, "masterMute": false, - "infoButtonCommand": "MNINF", + "masterVolume": false, + "volumeControlNamePrefix": false, + "volumeControlName": "Volume", "volumeControl": 0, "volumeMax": 0, "refreshInterval": 5, + "enableDebugMode": false, + "disableLogInfo": false, + "disableLogDeviceInfo": false, + "disableLogConnectError": false, "enableRestFul": false, "restFulPort": 3001, "restFulDebug": false, @@ -182,17 +186,19 @@ "displayType": 0 } ], - "enableDebugMode": false, - "disableLogInfo": false, - "disableLogDeviceInfo": false, - "disableLogConnectError": false, + "infoButtonCommand": "MNINF", "masterPower": false, - "masterVolume": false, "masterMute": false, - "infoButtonCommand": "MNINF", + "masterVolume": false, + "volumeControlNamePrefix": false, + "volumeControlName": "Volume", "volumeControl": 0, "volumeMax": 0, "refreshInterval": 5, + "enableDebugMode": false, + "disableLogInfo": false, + "disableLogDeviceInfo": false, + "disableLogConnectError": false, "enableRestFul": false, "restFulPort": 3002, "restFulDebug": false, @@ -233,15 +239,19 @@ "namePrefix": false } ], - "enableDebugMode": false, - "disableLogInfo": false, - "disableLogDeviceInfo": false, - "disableLogConnectError": false, - "masterPower": false, "infoButtonCommand": "MNINF", + "masterPower": false, + "masterMute": false, + "masterVolume": false, + "volumeControlNamePrefix": false, + "volumeControlName": "Volume", "volumeControl": 0, "volumeMax": 0, "refreshInterval": 5, + "enableDebugMode": false, + "disableLogInfo": false, + "disableLogDeviceInfo": false, + "disableLogConnectError": false, "enableRestFul": false, "restFulPort": 3003, "restFulDebug": false, diff --git a/src/mainzone.js b/src/mainzone.js index b70c36e..7b7a7f6 100644 --- a/src/mainzone.js +++ b/src/mainzone.js @@ -34,6 +34,8 @@ class MainZone extends EventEmitter { this.disableLogDeviceInfo = device.disableLogDeviceInfo || false; this.disableLogConnectError = device.disableLogConnectError || false; this.infoButtonCommand = device.infoButtonCommand || 'MNINF'; + this.volumeControlNamePrefix = device.volumeControlNamePrefix || false; + this.volumeControlName = device.volumeControlName || 'Volume'; this.volumeControl = device.volumeControl || false; this.volumeMax = device.volumeMax || 100; this.masterPower = device.masterPower || false; @@ -795,10 +797,11 @@ class MainZone extends EventEmitter { //prepare volume service if (this.volumeControl) { const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare volume service`); + const volumeServiceName = this.volumeControlNamePrefix ? `${accessoryName} ${this.volumeControlName}` : this.volumeControlName; if (this.volumeControl === 1) { - this.volumeService = accessory.addService(Service.Lightbulb, `${accessoryName} Volume`, 'Volume'); + this.volumeService = accessory.addService(Service.Lightbulb, `${volumeServiceName}`, 'Volume'); this.volumeService.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeService.getCharacteristic(Characteristic.Brightness) .setProps({ minValue: 0, @@ -824,9 +827,9 @@ class MainZone extends EventEmitter { } if (this.volumeControl === 2) { - this.volumeServiceFan = accessory.addService(Service.Fan, `${accessoryName} Volume`, 'Volume'); + this.volumeServiceFan = accessory.addService(Service.Fan, `${volumeServiceName}`, 'Volume'); this.volumeServiceFan.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeServiceFan.getCharacteristic(Characteristic.RotationSpeed) .setProps({ minValue: 0, diff --git a/src/surround.js b/src/surround.js index cbc7934..9dc69cd 100644 --- a/src/surround.js +++ b/src/surround.js @@ -34,6 +34,8 @@ class Surround extends EventEmitter { this.disableLogDeviceInfo = device.disableLogDeviceInfo || false; this.disableLogConnectError = device.disableLogConnectError || false; this.infoButtonCommand = device.infoButtonCommand || 'MNINF'; + this.volumeControlNamePrefix = device.volumeControlNamePrefix || false; + this.volumeControlName = device.volumeControlName || 'Volume'; this.volumeControl = device.volumeControl || false; this.volumeMax = device.volumeMax || 100; this.masterPower = device.masterPower || false; @@ -702,10 +704,11 @@ class Surround extends EventEmitter { //prepare volume service if (this.volumeControl) { const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare volume service`); + const volumeServiceName = this.volumeControlNamePrefix ? `${accessoryName} ${this.volumeControlName}` : this.volumeControlName; if (this.volumeControl === 1) { - this.volumeService = accessory.addService(Service.Lightbulb, `${accessoryName} Volume`, 'Volume'); + this.volumeService = accessory.addService(Service.Lightbulb, `${volumeServiceName}`, 'Volume'); this.volumeService.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeService.getCharacteristic(Characteristic.Brightness) .setProps({ minValue: 0, @@ -731,9 +734,9 @@ class Surround extends EventEmitter { } if (this.volumeControl === 2) { - this.volumeServiceFan = accessory.addService(Service.Fan, `${accessoryName} Volume`, 'Volume'); + this.volumeServiceFan = accessory.addService(Service.Fan, `${volumeServiceName}`, 'Volume'); this.volumeServiceFan.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeServiceFan.getCharacteristic(Characteristic.RotationSpeed) .setProps({ minValue: 0, diff --git a/src/zone2.js b/src/zone2.js index f837102..b1620b8 100644 --- a/src/zone2.js +++ b/src/zone2.js @@ -34,6 +34,8 @@ class Zone2 extends EventEmitter { this.disableLogDeviceInfo = device.disableLogDeviceInfo || false; this.disableLogConnectError = device.disableLogConnectError || false; this.infoButtonCommand = device.infoButtonCommand || 'MNINF'; + this.volumeControlNamePrefix = device.volumeControlNamePrefix || false; + this.volumeControlName = device.volumeControlName || 'Volume'; this.volumeControl = device.volumeControl || false; this.volumeMax = device.volumeMax || 100; this.masterPower = device.masterPower || false; @@ -714,10 +716,11 @@ class Zone2 extends EventEmitter { //prepare volume service if (this.volumeControl) { const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare volume service`); + const volumeServiceName = this.volumeControlNamePrefix ? `${accessoryName} ${this.volumeControlName}` : this.volumeControlName; if (this.volumeControl === 1) { - this.volumeService = accessory.addService(Service.Lightbulb, `${accessoryName} Volume`, 'Volume'); + this.volumeService = accessory.addService(Service.Lightbulb, `${volumeServiceName}`, 'Volume'); this.volumeService.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeService.getCharacteristic(Characteristic.Brightness) .setProps({ minValue: 0, @@ -743,9 +746,9 @@ class Zone2 extends EventEmitter { } if (this.volumeControl === 2) { - this.volumeServiceFan = accessory.addService(Service.Fan, `${accessoryName} Volume`, 'Volume'); + this.volumeServiceFan = accessory.addService(Service.Fan, `${volumeServiceName}`, 'Volume'); this.volumeServiceFan.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeServiceFan.getCharacteristic(Characteristic.RotationSpeed) .setProps({ minValue: 0, diff --git a/src/zone3.js b/src/zone3.js index ee54bbd..36a8193 100644 --- a/src/zone3.js +++ b/src/zone3.js @@ -34,6 +34,8 @@ class Zone3 extends EventEmitter { this.disableLogDeviceInfo = device.disableLogDeviceInfo || false; this.disableLogConnectError = device.disableLogConnectError || false; this.infoButtonCommand = device.infoButtonCommand || 'MNINF'; + this.volumeControlNamePrefix = device.volumeControlNamePrefix || false; + this.volumeControlName = device.volumeControlName || 'Volume'; this.volumeControl = device.volumeControl || false; this.volumeMax = device.volumeMax || 100; this.masterPower = device.masterPower || false; @@ -713,10 +715,11 @@ class Zone3 extends EventEmitter { //prepare volume service if (this.volumeControl) { const debug = !this.enableDebugMode ? false : this.emit('debug', `Prepare volume service`); + const volumeServiceName = this.volumeControlNamePrefix ? `${accessoryName} ${this.volumeControlName}` : this.volumeControlName; if (this.volumeControl === 1) { - this.volumeService = accessory.addService(Service.Lightbulb, `${accessoryName} Volume`, 'Volume'); + this.volumeService = accessory.addService(Service.Lightbulb, `${volumeServiceName}`, 'Volume'); this.volumeService.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeService.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeService.getCharacteristic(Characteristic.Brightness) .setProps({ minValue: 0, @@ -742,9 +745,9 @@ class Zone3 extends EventEmitter { } if (this.volumeControl === 2) { - this.volumeServiceFan = accessory.addService(Service.Fan, `${accessoryName} Volume`, 'Volume'); + this.volumeServiceFan = accessory.addService(Service.Fan, `${volumeServiceName}`, 'Volume'); this.volumeServiceFan.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeServiceFan.getCharacteristic(Characteristic.RotationSpeed) .setProps({ minValue: 0,