From 0258d09b98027bd471c28996e2346875f410fc6d Mon Sep 17 00:00:00 2001 From: Matthias Kleine Date: Tue, 10 Nov 2020 17:10:06 +0100 Subject: [PATCH] Added brightness and volume limit information (min, max) - fixes #27 --- README.md | 1 + io-package.json | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ main.js | 11 +++++++++++ 3 files changed, 64 insertions(+) diff --git a/README.md b/README.md index 22308e4..45a56a2 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,7 @@ show(); * (klein0r) First stable release * (klein0r) Added iobroker sentry +* (klein0r) Added brightness and volume limit information (min, max) ### 0.0.10 diff --git a/io-package.json b/io-package.json index 81ca942..6d30ade 100644 --- a/io-package.json +++ b/io-package.json @@ -210,6 +210,32 @@ }, "native": {} }, + { + "_id": "meta.audio.volumeMin", + "type": "state", + "common": { + "name": "Audio volume (min)", + "type": "number", + "role": "level.volume", + "unit": "%", + "read": true, + "write": false + }, + "native": {} + }, + { + "_id": "meta.audio.volumeMax", + "type": "state", + "common": { + "name": "Audio volume (max)", + "type": "number", + "role": "level.volume", + "unit": "%", + "read": true, + "write": false + }, + "native": {} + }, { "_id": "meta.bluetooth", "type": "channel", @@ -313,6 +339,32 @@ }, "native": {} }, + { + "_id": "meta.display.brightnessMin", + "type": "state", + "common": { + "name": "Brightness (min)", + "type": "number", + "role": "level.dimmer", + "unit": "%", + "read": true, + "write": false + }, + "native": {} + }, + { + "_id": "meta.display.brightnessMax", + "type": "state", + "common": { + "name": "Brightness (max)", + "type": "number", + "role": "level.dimmer", + "unit": "%", + "read": true, + "write": false + }, + "native": {} + }, { "_id": "meta.display.brightnessAuto", "type": "state", diff --git a/main.js b/main.js index e189eff..911b055 100644 --- a/main.js +++ b/main.js @@ -41,6 +41,8 @@ class LaMetric extends utils.Adapter { 'device/display', (content, status) => { this.setState('meta.display.brightness', {val: content.success.data.brightness, ack: true}); + this.setState('meta.display.brightnessMin', {val: content.success.data.brightness_limit.min, ack: true}); + this.setState('meta.display.brightnessMax', {val: content.success.data.brightness_limit.max, ack: true}); this.setState('meta.display.brightnessAuto', {val: content.success.data.brightness_mode === 'auto', ack: true}); this.setState('meta.display.brightnessMode', {val: content.success.data.brightness_mode, ack: true}); }, @@ -57,6 +59,8 @@ class LaMetric extends utils.Adapter { 'device/display', (content, status) => { this.setState('meta.display.brightness', {val: content.success.data.brightness, ack: true}); + this.setState('meta.display.brightnessMin', {val: content.success.data.brightness_limit.min, ack: true}); + this.setState('meta.display.brightnessMax', {val: content.success.data.brightness_limit.max, ack: true}); this.setState('meta.display.brightnessAuto', {val: content.success.data.brightness_mode === 'auto', ack: true}); this.setState('meta.display.brightnessMode', {val: content.success.data.brightness_mode, ack: true}); }, @@ -72,6 +76,8 @@ class LaMetric extends utils.Adapter { 'device/audio', (content, status) => { this.setState('meta.audio.volume', {val: content.success.data.volume, ack: true}); + this.setState('meta.audio.volumeMin', {val: content.success.data.volume_limit.min, ack: true}); + this.setState('meta.audio.volumeMax', {val: content.success.data.volume_limit.max, ack: true}); }, 'PUT', { @@ -324,6 +330,8 @@ class LaMetric extends utils.Adapter { this.setState('meta.mode', {val: content.mode, ack: true}); this.setState('meta.audio.volume', {val: content.audio.volume, ack: true}); + this.setState('meta.audio.volumeMin', {val: content.audio.volume_limit.min, ack: true}); + this.setState('meta.audio.volumeMax', {val: content.audio.volume_limit.max, ack: true}); this.setState('meta.bluetooth.available', {val: content.bluetooth.available, ack: true}); this.setState('meta.bluetooth.name', {val: content.bluetooth.name, ack: true}); @@ -350,8 +358,11 @@ class LaMetric extends utils.Adapter { 'device/display', (content, status) => { this.setState('meta.display.brightness', {val: content.brightness, ack: true}); + this.setState('meta.display.brightnessMin', {val: content.brightness_limit.min, ack: true}); + this.setState('meta.display.brightnessMax', {val: content.brightness_limit.max, ack: true}); this.setState('meta.display.brightnessAuto', {val: content.brightness_mode === 'auto', ack: true}); this.setState('meta.display.brightnessMode', {val: content.brightness_mode, ack: true}); + this.setState('meta.display.width', {val: content.width, ack: true}); this.setState('meta.display.height', {val: content.height, ack: true}); this.setState('meta.display.type', {val: content.type, ack: true});