From e07640b74d7e2843383a74a1363444af33dd359d Mon Sep 17 00:00:00 2001 From: Grzegorz Date: Sun, 4 Aug 2024 09:51:25 +0200 Subject: [PATCH] release v2.20.0 --- CHANGELOG.md | 9 +++++++++ README.md | 2 ++ config.schema.json | 16 ++++++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- sample-config.json | 2 ++ src/lgwebosdevice.js | 11 +++++++---- 7 files changed, 39 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aeed1be..e2f2eaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +## [2.20.0] - (04.08.2024) + +## Changes + +- added possiblity to set own volume control name and enable/disable prefix +- config schema updated +- bump dependencies +- cleanup + ## [2.19.0] - (19.05.2024) ## Changes diff --git a/README.md b/README.md index dec3dd1..0baa56a 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,8 @@ Tested with OLED65G6V, 32LM6300PLA, 49SK8500, OLED65C7T, 55SK800PLB, OLED48CX. | `soundOutputs.reference` | Here select output to be exposed in *Homebridge/HomeKit*. | | `soundModes.displayType` | Here select display type in HomeKit app, possible `0 - None/Disabled`, `1 - Outlet`, `2 - Switch`.| | `soundOutputs.namePrefix` | Here enable/disable the accessory name as a prefix for sound output.| +| `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 select volume control mode `0 - None/Disabled`, `1 - Slider`, `2 - Fan`. | | `turnScreenOnOff` | This enable possibility turn the screen ON/OFF, webOS >= 4.0. | | `turnScreenSaverOnOff` | This enable possibility turn the screen saver ON/OFF, webOS >= 4.0. | diff --git a/config.schema.json b/config.schema.json index daccec4..402c0b1 100644 --- a/config.schema.json +++ b/config.schema.json @@ -973,6 +973,20 @@ }, "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", "type": "integer", @@ -1605,6 +1619,8 @@ "key": "devices[]", "title": "Sound / Volume", "items": [ + "devices[].volumeControlNamePrefix", + "devices[].volumeControlName", "devices[].volumeControl", "devices[].soundModeControl", { diff --git a/package-lock.json b/package-lock.json index c0ac3c8..de46be7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "homebridge-lgwebos-tv", - "version": "2.19.21", + "version": "2.20.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "homebridge-lgwebos-tv", - "version": "2.19.21", + "version": "2.20.0", "license": "MIT", "dependencies": { "async-mqtt": "^2.6.3", diff --git a/package.json b/package.json index bc9f4ce..58a00bf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "displayName": "LG webOS TV", "name": "homebridge-lgwebos-tv", - "version": "2.19.22", + "version": "2.20.0", "description": "Homebridge plugin to control LG webOS TV.", "license": "MIT", "author": "grzegorz914", diff --git a/sample-config.json b/sample-config.json index 6b632ea..9060936 100644 --- a/sample-config.json +++ b/sample-config.json @@ -102,6 +102,8 @@ "namePrefix": false } ], + "volumeControlNamePrefix": false, + "volumeControlName": "Volume", "volumeControl": 0, "sensorPower": false, "sensorPixelRefresh": false, diff --git a/src/lgwebosdevice.js b/src/lgwebosdevice.js index 90f527c..92086c5 100644 --- a/src/lgwebosdevice.js +++ b/src/lgwebosdevice.js @@ -62,6 +62,8 @@ class LgWebOsDevice extends EventEmitter { this.turnScreenSaverOnOff = device.turnScreenSaverOnOff || false; this.sslWebSocket = device.sslWebSocket || false; this.infoButtonCommand = device.infoButtonCommand || 'INFO'; + this.volumeControlNamePrefix = device.volumeControlNamePrefix || false; + this.volumeControlName = device.volumeControlName || 'Volume'; this.volumeControl = device.volumeControl || false; //external integration @@ -1345,10 +1347,11 @@ class LgWebOsDevice extends EventEmitter { //Prepare volume service if (this.volumeControl) { const debug = this.enableDebugMode ? this.emit('debug', `Prepare volume service`) : false; + 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) .onGet(async () => { const volume = this.volume; @@ -1391,9 +1394,9 @@ class LgWebOsDevice extends EventEmitter { } if (this.volumeControl === 2) { - this.volumeServiceFan = accessory.addService(Service.Fan, `${accessoryName} Volume`, 'Volume Fan'); + this.volumeServiceFan = accessory.addService(Service.Fan, `${volumeServiceName}`, 'Volume Fan'); this.volumeServiceFan.addOptionalCharacteristic(Characteristic.ConfiguredName); - this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${accessoryName} Volume`); + this.volumeServiceFan.setCharacteristic(Characteristic.ConfiguredName, `${volumeServiceName}`); this.volumeServiceFan.getCharacteristic(Characteristic.RotationSpeed) .onGet(async () => { const volume = this.volume;