homebridge-denon-tv 4.4.2 → 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Denon TV",
3
3
  "name": "homebridge-denon-tv",
4
- "version": "4.4.2",
4
+ "version": "4.4.4",
5
5
  "description": "Homebridge plugin to control Denon/Marantz AV Receivers.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
package/src/denon.js CHANGED
@@ -224,6 +224,12 @@ class DENON extends EventEmitter {
224
224
  //select reference
225
225
  const reference = zoneControl <= 2 ? input : soundMode;
226
226
 
227
+ //update only if value change
228
+ if (power === this.power && reference === this.reference && volume === this.volume && volumeDisplay === this.volumeDisplay && mute === this.mute && pictureMode === this.pictureMode && soundMode === this.soundMode) {
229
+ this.checkState();
230
+ return;
231
+ };
232
+
227
233
  this.power = power;
228
234
  this.reference = reference;
229
235
  this.volume = volume;
@@ -232,7 +238,7 @@ class DENON extends EventEmitter {
232
238
  this.pictureMode = pictureMode;
233
239
  this.soundMode = soundMode;
234
240
 
235
- //emit state
241
+ //emit state changes
236
242
  const emitConnected = !this.connected ? this.emit('message', `Connected.`) : false;
237
243
  this.connected = true;
238
244
  this.emit('stateChanged', power, reference, volume, volumeDisplay, mute, pictureMode);
@@ -249,7 +255,7 @@ class DENON extends EventEmitter {
249
255
 
250
256
  this.checkState();
251
257
  } catch (error) {
252
- const debug = disableLogConnectError ? false : this.emit('error', `State error: ${error}, reconnect in 15s.`);
258
+ const debug = disableLogConnectError ? false : this.emit('error', `State error: ${error}, reconnect in ${this.refreshInterval}s.`);
253
259
  this.emit('disconnect');
254
260
  };
255
261
  })
@@ -83,7 +83,7 @@ class DenonDevice extends EventEmitter {
83
83
  this.volumeControlType = ';';
84
84
  this.mute = true;
85
85
  this.mediaState = false;
86
- this.inputIdentifier = 0;
86
+ this.inputIdentifier = 1;
87
87
  this.supportPictureMode = false;
88
88
  this.pictureMode = 0;
89
89
  this.brightness = 0;
@@ -793,25 +793,24 @@ class DenonDevice extends EventEmitter {
793
793
  const inputsCount = inputs.length;
794
794
  const possibleInputsCount = 85 - this.allServices.length;
795
795
  const maxInputsCount = inputsCount >= possibleInputsCount ? possibleInputsCount : inputsCount;
796
- let inputIdentifier = 0;
797
796
  for (let i = 0; i < maxInputsCount; i++) {
798
797
  //input
799
798
  const input = inputs[i];
800
-
801
- //get input reference
802
- const inputReference = input.reference;
799
+ input.identifier = i + 1;
803
800
 
804
801
  //get input name
805
802
  const name = input.name ?? 'App/Input';
806
- const savedInputsNames = this.savedInputsNames[inputReference] ?? false;
803
+ const savedInputsNames = this.savedInputsNames[input.reference] ?? false;
807
804
  const inputName = !savedInputsNames ? name : savedInputsNames;
805
+ input.name = inputName;
806
+
807
+ //get input reference
808
+ const inputReference = input.reference;
808
809
 
809
810
  //get visibility
810
811
  const currentVisibility = this.savedInputsTargetVisibility[inputReference] ?? 0;
811
-
812
- input.identifier = inputIdentifier++;
813
- input.name = inputName;
814
812
  input.visibility = currentVisibility;
813
+
815
814
  this.inputsConfigured.push(input);
816
815
  }
817
816