Skip to content

Commit

Permalink
Added brightness and volume limit information (min, max) - fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Nov 10, 2020
1 parent 9278963 commit 0258d09
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
52 changes: 52 additions & 0 deletions io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
},
Expand All @@ -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});
},
Expand All @@ -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',
{
Expand Down Expand Up @@ -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});
Expand All @@ -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});
Expand Down

0 comments on commit 0258d09

Please sign in to comment.