homebridge-denon-tv 4.3.9 → 4.3.10

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