homebridge-denon-tv 4.3.8 → 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.
- package/package.json +1 -1
- package/src/denondevice.js +36 -21
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.
|
|
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",
|
package/src/denondevice.js
CHANGED
|
@@ -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) => {
|
|
@@ -503,12 +504,25 @@ class DenonDevice extends EventEmitter {
|
|
|
503
504
|
const zone = [inputMode, 'Z2', 'Z3', inputMode][zoneControl];
|
|
504
505
|
const reference = zone + inputReference;
|
|
505
506
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
507
|
+
switch (this.power) {
|
|
508
|
+
case false:
|
|
509
|
+
this.inputSet = false;
|
|
510
|
+
|
|
511
|
+
setInterval(async () => {
|
|
512
|
+
if (this.inputSet) {
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
509
515
|
|
|
510
|
-
|
|
511
|
-
|
|
516
|
+
const setInput = this.power ? await this.denon.send(reference) : false;
|
|
517
|
+
this.inputSet = this.power;
|
|
518
|
+
const info = this.disableLogInfo || this.firstRun || !this.power ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
|
|
519
|
+
}, 2000);
|
|
520
|
+
break;
|
|
521
|
+
case true:
|
|
522
|
+
await this.denon.send(reference);
|
|
523
|
+
const info = this.disableLogInfo || this.firstRun ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
512
526
|
} catch (error) {
|
|
513
527
|
this.emit('error', `set ${this.inputSurround} error: ${error}`);
|
|
514
528
|
};
|
|
@@ -605,7 +619,7 @@ class DenonDevice extends EventEmitter {
|
|
|
605
619
|
}
|
|
606
620
|
|
|
607
621
|
await this.denon.send(command);
|
|
608
|
-
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}`);
|
|
609
623
|
} catch (error) {
|
|
610
624
|
this.emit('error', `set Remote Key error: ${error}`);
|
|
611
625
|
};
|
|
@@ -624,7 +638,7 @@ class DenonDevice extends EventEmitter {
|
|
|
624
638
|
const newValue = (value / 100) * 12;
|
|
625
639
|
const brightness = `PVBR ${(newValue)}`;
|
|
626
640
|
await this.denon.send(brightness);
|
|
627
|
-
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}`);
|
|
628
642
|
} catch (error) {
|
|
629
643
|
this.emit('error', `set Brightness error: ${error}`);
|
|
630
644
|
};
|
|
@@ -634,7 +648,7 @@ class DenonDevice extends EventEmitter {
|
|
|
634
648
|
this.televisionService.getCharacteristic(Characteristic.PictureMode)
|
|
635
649
|
.onGet(async () => {
|
|
636
650
|
const pictureMode = this.pictureMode;
|
|
637
|
-
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]}`);
|
|
638
652
|
return pictureMode;
|
|
639
653
|
})
|
|
640
654
|
.onSet(async (command) => {
|
|
@@ -667,7 +681,7 @@ class DenonDevice extends EventEmitter {
|
|
|
667
681
|
}
|
|
668
682
|
|
|
669
683
|
await this.denon.send(command);
|
|
670
|
-
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]}`);
|
|
671
685
|
} catch (error) {
|
|
672
686
|
this.emit('error', `set Picture Mode error: ${error}`);
|
|
673
687
|
};
|
|
@@ -687,7 +701,7 @@ class DenonDevice extends EventEmitter {
|
|
|
687
701
|
}
|
|
688
702
|
|
|
689
703
|
await this.denon.send(command);
|
|
690
|
-
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'}`);
|
|
691
705
|
} catch (error) {
|
|
692
706
|
this.emit('error', `set Power Mode Selection error: ${error}`);
|
|
693
707
|
};
|
|
@@ -727,7 +741,7 @@ class DenonDevice extends EventEmitter {
|
|
|
727
741
|
}
|
|
728
742
|
|
|
729
743
|
await this.denon.send(command);
|
|
730
|
-
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}`);
|
|
731
745
|
} catch (error) {
|
|
732
746
|
this.emit('error', `set Volume Selector error: ${error}`);
|
|
733
747
|
};
|
|
@@ -736,7 +750,7 @@ class DenonDevice extends EventEmitter {
|
|
|
736
750
|
this.tvSpeakerService.getCharacteristic(Characteristic.Volume)
|
|
737
751
|
.onGet(async () => {
|
|
738
752
|
const volume = this.volume;
|
|
739
|
-
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}`);
|
|
740
754
|
return volume;
|
|
741
755
|
})
|
|
742
756
|
.onSet(async (value) => {
|
|
@@ -745,7 +759,7 @@ class DenonDevice extends EventEmitter {
|
|
|
745
759
|
const masterControl = this.masterVolume ? 0 : zoneControl;
|
|
746
760
|
const volume = [`MV${value}`, `Z2${value}`, `Z3${value}`, `MV${value}`][masterControl];
|
|
747
761
|
await this.denon.send(volume);
|
|
748
|
-
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}`);
|
|
749
763
|
} catch (error) {
|
|
750
764
|
this.emit('error', `set Volume error: ${error}`);
|
|
751
765
|
};
|
|
@@ -754,7 +768,7 @@ class DenonDevice extends EventEmitter {
|
|
|
754
768
|
this.tvSpeakerService.getCharacteristic(Characteristic.Mute)
|
|
755
769
|
.onGet(async () => {
|
|
756
770
|
const state = this.mute;
|
|
757
|
-
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'}`);
|
|
758
772
|
return state;
|
|
759
773
|
})
|
|
760
774
|
.onSet(async (state) => {
|
|
@@ -763,7 +777,7 @@ class DenonDevice extends EventEmitter {
|
|
|
763
777
|
const muteState = [(state ? 'MUON' : 'MUOFF'), (state ? 'Z2MUON' : 'Z2MUOFF'), (state ? 'Z3MUON' : 'Z3MUOFF'), (state ? 'MUON' : 'MUOFF')][masterControl];
|
|
764
778
|
|
|
765
779
|
await this.denon.send(muteState);
|
|
766
|
-
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'}`);
|
|
767
781
|
} catch (error) {
|
|
768
782
|
this.emit('error', `set Mute error: ${error}`);
|
|
769
783
|
};
|
|
@@ -1065,7 +1079,7 @@ class DenonDevice extends EventEmitter {
|
|
|
1065
1079
|
const reference = [`${command}`, `${zonePrefix}${command}`, `Z2${command}`][mode];
|
|
1066
1080
|
await this.denon.send(reference);
|
|
1067
1081
|
buttonService.updateCharacteristic(Characteristic.On, false);
|
|
1068
|
-
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}`);
|
|
1069
1083
|
} catch (error) {
|
|
1070
1084
|
buttonService.updateCharacteristic(Characteristic.On, false);
|
|
1071
1085
|
this.emit('error', `set Button error: ${error}`);
|
|
@@ -1082,6 +1096,7 @@ class DenonDevice extends EventEmitter {
|
|
|
1082
1096
|
};
|
|
1083
1097
|
};
|
|
1084
1098
|
|
|
1099
|
+
this.firstRun = false;
|
|
1085
1100
|
resolve(accessory);
|
|
1086
1101
|
} catch (error) {
|
|
1087
1102
|
reject(error)
|