homebridge-denon-tv 4.3.13 → 4.3.16

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/denondevice.js +18 -20
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Denon TV",
3
3
  "name": "homebridge-denon-tv",
4
- "version": "4.3.13",
4
+ "version": "4.3.16",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Denon/Marantz AV Receivers.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -71,7 +71,6 @@ class DenonDevice extends EventEmitter {
71
71
  this.inputsReference = [];
72
72
  this.inputsName = [];
73
73
  this.inputsMode = [];
74
- this.firstRun = true;
75
74
 
76
75
  this.sensorInputsReference = [];
77
76
  this.sensorInputsDisplayType = [];
@@ -453,7 +452,7 @@ class DenonDevice extends EventEmitter {
453
452
  .onSet(async (value) => {
454
453
  try {
455
454
  this.name = value;
456
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Accessory Name: ${value}`);
455
+ const info = this.disableLogInfo ? false : this.emit('message', `set Accessory Name: ${value}`);
457
456
  } catch (error) {
458
457
  this.emit('error', `set Brightness error: ${error}`);
459
458
  };
@@ -465,7 +464,7 @@ class DenonDevice extends EventEmitter {
465
464
  })
466
465
  .onSet(async (state) => {
467
466
  try {
468
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Discovery Mode: ${state ? 'Always Discoverable' : 'Not Discoverable'}`);
467
+ const info = this.disableLogInfo ? false : this.emit('message', `set Discovery Mode: ${state ? 'Always Discoverable' : 'Not Discoverable'}`);
469
468
  } catch (error) {
470
469
  this.emit('error', `set Discovery Mode error: ${error}`);
471
470
  };
@@ -473,7 +472,7 @@ class DenonDevice extends EventEmitter {
473
472
  this.televisionService.getCharacteristic(Characteristic.Active)
474
473
  .onGet(async () => {
475
474
  const state = this.power;
476
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `Power: ${state ? 'ON' : 'OFF'}`);
475
+ const info = this.disableLogInfo ? false : this.emit('message', `Power: ${state ? 'ON' : 'OFF'}`);
477
476
  return state;
478
477
  })
479
478
  .onSet(async (state) => {
@@ -482,7 +481,7 @@ class DenonDevice extends EventEmitter {
482
481
  const powerState = [(state ? 'ZMON' : 'ZMOFF'), (state ? 'Z2ON' : 'Z2OFF'), (state ? 'Z3ON' : 'Z3OFF'), (state ? 'ZMON' : 'ZMOFF'), (state ? 'PWON' : 'PWSTANDBY')][masterControl];
483
482
 
484
483
  const setPower = state != this.power ? await this.denon.send(powerState) : false;
485
- const info = this.disableLogInfo || this.firstRun && (state != this.power) ? false : this.emit('message', `set Power: ${powerState}`);
484
+ const info = this.disableLogInfo || (state === this.power) ? false : this.emit('message', `set Power: ${powerState}`);
486
485
  } catch (error) {
487
486
  this.emit('error', `set Power error: ${error}`);
488
487
  };
@@ -493,7 +492,7 @@ class DenonDevice extends EventEmitter {
493
492
  const inputIdentifier = this.inputIdentifier;
494
493
  const inputName = this.inputsName[inputIdentifier];
495
494
  const inputReference = this.inputsReference[inputIdentifier];
496
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
495
+ const info = this.disableLogInfo ? false : this.emit('message', `${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
497
496
  return inputIdentifier;
498
497
  })
499
498
  .onSet(async (inputIdentifier) => {
@@ -515,12 +514,12 @@ class DenonDevice extends EventEmitter {
515
514
 
516
515
  const setInput = this.power ? await this.denon.send(reference) : false;
517
516
  this.inputSet = this.power;
518
- const info = this.disableLogInfo || this.firstRun || !this.power ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
517
+ const info = this.disableLogInfo || !this.power ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
519
518
  }, 3000);
520
519
  break;
521
520
  case true:
522
521
  await this.denon.send(reference);
523
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
522
+ const info = this.disableLogInfo ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
524
523
  break;
525
524
  }
526
525
  } catch (error) {
@@ -619,7 +618,7 @@ class DenonDevice extends EventEmitter {
619
618
  }
620
619
 
621
620
  await this.denon.send(command);
622
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Remote Key: ${command}`);
621
+ const info = this.disableLogInfo ? false : this.emit('message', `set Remote Key: ${command}`);
623
622
  } catch (error) {
624
623
  this.emit('error', `set Remote Key error: ${error}`);
625
624
  };
@@ -638,7 +637,7 @@ class DenonDevice extends EventEmitter {
638
637
  const newValue = (value / 100) * 12;
639
638
  const brightness = `PVBR ${(newValue)}`;
640
639
  await this.denon.send(brightness);
641
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Brightness: ${value}`);
640
+ const info = this.disableLogInfo ? false : this.emit('message', `set Brightness: ${value}`);
642
641
  } catch (error) {
643
642
  this.emit('error', `set Brightness error: ${error}`);
644
643
  };
@@ -648,7 +647,7 @@ class DenonDevice extends EventEmitter {
648
647
  this.televisionService.getCharacteristic(Characteristic.PictureMode)
649
648
  .onGet(async () => {
650
649
  const pictureMode = this.pictureMode;
651
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `Picture Mode: ${CONSTANS.PictureModesDenonNumber[pictureMode]}`);
650
+ const info = this.disableLogInfo ? false : this.emit('message', `Picture Mode: ${CONSTANS.PictureModesDenonNumber[pictureMode]}`);
652
651
  return pictureMode;
653
652
  })
654
653
  .onSet(async (command) => {
@@ -681,7 +680,7 @@ class DenonDevice extends EventEmitter {
681
680
  }
682
681
 
683
682
  await this.denon.send(command);
684
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Picture Mode: ${CONSTANS.PictureModesDenonString[command]}`);
683
+ const info = this.disableLogInfo ? false : this.emit('message', `set Picture Mode: ${CONSTANS.PictureModesDenonString[command]}`);
685
684
  } catch (error) {
686
685
  this.emit('error', `set Picture Mode error: ${error}`);
687
686
  };
@@ -701,7 +700,7 @@ class DenonDevice extends EventEmitter {
701
700
  }
702
701
 
703
702
  await this.denon.send(command);
704
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Power Mode Selection: ${command === 'MNOPT' ? 'SHOW' : 'HIDE'}`);
703
+ const info = this.disableLogInfo ? false : this.emit('message', `set Power Mode Selection: ${command === 'MNOPT' ? 'SHOW' : 'HIDE'}`);
705
704
  } catch (error) {
706
705
  this.emit('error', `set Power Mode Selection error: ${error}`);
707
706
  };
@@ -741,7 +740,7 @@ class DenonDevice extends EventEmitter {
741
740
  }
742
741
 
743
742
  await this.denon.send(command);
744
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Volume Selector: ${command}`);
743
+ const info = this.disableLogInfo ? false : this.emit('message', `set Volume Selector: ${command}`);
745
744
  } catch (error) {
746
745
  this.emit('error', `set Volume Selector error: ${error}`);
747
746
  };
@@ -750,7 +749,7 @@ class DenonDevice extends EventEmitter {
750
749
  this.tvSpeakerService.getCharacteristic(Characteristic.Volume)
751
750
  .onGet(async () => {
752
751
  const volume = this.volume;
753
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `Volume: ${volume - 80}`);
752
+ const info = this.disableLogInfo ? false : this.emit('message', `Volume: ${volume - 80}`);
754
753
  return volume;
755
754
  })
756
755
  .onSet(async (value) => {
@@ -759,7 +758,7 @@ class DenonDevice extends EventEmitter {
759
758
  const masterControl = this.masterVolume ? 0 : zoneControl;
760
759
  const volume = [`MV${value}`, `Z2${value}`, `Z3${value}`, `MV${value}`][masterControl];
761
760
  await this.denon.send(volume);
762
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Volume: ${value - 80}`);
761
+ const info = this.disableLogInfo ? false : this.emit('message', `set Volume: ${value - 80}`);
763
762
  } catch (error) {
764
763
  this.emit('error', `set Volume error: ${error}`);
765
764
  };
@@ -768,7 +767,7 @@ class DenonDevice extends EventEmitter {
768
767
  this.tvSpeakerService.getCharacteristic(Characteristic.Mute)
769
768
  .onGet(async () => {
770
769
  const state = this.mute;
771
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `Mute: ${state ? 'ON' : 'OFF'}`);
770
+ const info = this.disableLogInfo ? false : this.emit('message', `Mute: ${state ? 'ON' : 'OFF'}`);
772
771
  return state;
773
772
  })
774
773
  .onSet(async (state) => {
@@ -777,7 +776,7 @@ class DenonDevice extends EventEmitter {
777
776
  const muteState = [(state ? 'MUON' : 'MUOFF'), (state ? 'Z2MUON' : 'Z2MUOFF'), (state ? 'Z3MUON' : 'Z3MUOFF'), (state ? 'MUON' : 'MUOFF')][masterControl];
778
777
 
779
778
  await this.denon.send(muteState);
780
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Mute: ${state ? 'ON' : 'OFF'}`);
779
+ const info = this.disableLogInfo ? false : this.emit('message', `set Mute: ${state ? 'ON' : 'OFF'}`);
781
780
  } catch (error) {
782
781
  this.emit('error', `set Mute error: ${error}`);
783
782
  };
@@ -1079,7 +1078,7 @@ class DenonDevice extends EventEmitter {
1079
1078
  const reference = [`${command}`, `${zonePrefix}${command}`, `Z2${command}`][mode];
1080
1079
  await this.denon.send(reference);
1081
1080
  buttonService.updateCharacteristic(Characteristic.On, false);
1082
- const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set Button Name: ${buttonName}, Reference: ${reference}`);
1081
+ const info = this.disableLogInfo ? false : this.emit('message', `set Button Name: ${buttonName}, Reference: ${reference}`);
1083
1082
  } catch (error) {
1084
1083
  buttonService.updateCharacteristic(Characteristic.On, false);
1085
1084
  this.emit('error', `set Button error: ${error}`);
@@ -1096,7 +1095,6 @@ class DenonDevice extends EventEmitter {
1096
1095
  };
1097
1096
  };
1098
1097
 
1099
- this.firstRun = false;
1100
1098
  resolve(accessory);
1101
1099
  } catch (error) {
1102
1100
  reject(error)