homebridge-denon-tv 5.0.2 → 5.0.3
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/index.js +28 -16
- package/package.json +1 -1
- package/src/denon.js +5 -5
- package/src/mainzone.js +16 -13
- package/src/surround.js +13 -10
- package/src/zone2.js +13 -10
- package/src/zone3.js +17 -14
package/index.js
CHANGED
|
@@ -36,7 +36,7 @@ class DenonPlatform {
|
|
|
36
36
|
|
|
37
37
|
//debug config
|
|
38
38
|
const enableDebugMode = device.enableDebugMode || false;
|
|
39
|
-
const debug = enableDebugMode ? log(`Device: ${host} ${deviceName}, did finish launching.`) : false;
|
|
39
|
+
const debug = enableDebugMode ? log.info(`Device: ${host} ${deviceName}, did finish launching.`) : false;
|
|
40
40
|
const config = {
|
|
41
41
|
...device,
|
|
42
42
|
mqtt: {
|
|
@@ -44,7 +44,7 @@ class DenonPlatform {
|
|
|
44
44
|
passwd: 'removed'
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
const debug1 = enableDebugMode ? log(`Device: ${host} ${deviceName}, Config: ${JSON.stringify(config, null, 2)}`) : false;
|
|
47
|
+
const debug1 = enableDebugMode ? log.info(`Device: ${host} ${deviceName}, Config: ${JSON.stringify(config, null, 2)}`) : false;
|
|
48
48
|
|
|
49
49
|
//zones
|
|
50
50
|
const zoneControl = device.zoneControl;
|
|
@@ -81,16 +81,19 @@ class DenonPlatform {
|
|
|
81
81
|
const mainZone = new MainZone(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
82
82
|
mainZone.on('publishAccessory', (accessory) => {
|
|
83
83
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
84
|
-
|
|
84
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
85
85
|
})
|
|
86
86
|
.on('devInfo', (devInfo) => {
|
|
87
|
-
log(devInfo);
|
|
87
|
+
log.info(devInfo);
|
|
88
88
|
})
|
|
89
89
|
.on('message', (message) => {
|
|
90
|
-
log(`Device: ${host} ${deviceName}, ${message}`);
|
|
90
|
+
log.info(`Device: ${host} ${deviceName}, ${message}`);
|
|
91
91
|
})
|
|
92
92
|
.on('debug', (debug) => {
|
|
93
|
-
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
93
|
+
log.info(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
94
|
+
})
|
|
95
|
+
.on('warn', (warn) => {
|
|
96
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
94
97
|
})
|
|
95
98
|
.on('error', (error) => {
|
|
96
99
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
@@ -100,7 +103,7 @@ class DenonPlatform {
|
|
|
100
103
|
const zone2 = new Zone2(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
101
104
|
zone2.on('publishAccessory', (accessory) => {
|
|
102
105
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
103
|
-
|
|
106
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
104
107
|
})
|
|
105
108
|
.on('devInfo', (devInfo) => {
|
|
106
109
|
log(devInfo);
|
|
@@ -111,6 +114,9 @@ class DenonPlatform {
|
|
|
111
114
|
.on('debug', (debug) => {
|
|
112
115
|
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
113
116
|
})
|
|
117
|
+
.on('warn', (warn) => {
|
|
118
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
119
|
+
})
|
|
114
120
|
.on('error', (error) => {
|
|
115
121
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
116
122
|
});
|
|
@@ -119,16 +125,19 @@ class DenonPlatform {
|
|
|
119
125
|
const zone3 = new Zone3(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
120
126
|
zone3.on('publishAccessory', (accessory) => {
|
|
121
127
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
122
|
-
|
|
128
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
123
129
|
})
|
|
124
130
|
.on('devInfo', (devInfo) => {
|
|
125
|
-
log(devInfo);
|
|
131
|
+
log.info(devInfo);
|
|
126
132
|
})
|
|
127
133
|
.on('message', (message) => {
|
|
128
|
-
log(`Device: ${host} ${deviceName}, ${message}`);
|
|
134
|
+
log.info(`Device: ${host} ${deviceName}, ${message}`);
|
|
129
135
|
})
|
|
130
136
|
.on('debug', (debug) => {
|
|
131
|
-
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
137
|
+
log.info(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
138
|
+
})
|
|
139
|
+
.on('warn', (warn) => {
|
|
140
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
132
141
|
})
|
|
133
142
|
.on('error', (error) => {
|
|
134
143
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
@@ -138,23 +147,26 @@ class DenonPlatform {
|
|
|
138
147
|
const surround = new Surround(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
139
148
|
surround.on('publishAccessory', (accessory) => {
|
|
140
149
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
141
|
-
|
|
150
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
142
151
|
})
|
|
143
152
|
.on('devInfo', (devInfo) => {
|
|
144
|
-
log(devInfo);
|
|
153
|
+
log.info(devInfo);
|
|
145
154
|
})
|
|
146
155
|
.on('message', (message) => {
|
|
147
|
-
log(`Device: ${host} ${deviceName}, ${message}`);
|
|
156
|
+
log.info(`Device: ${host} ${deviceName}, ${message}`);
|
|
148
157
|
})
|
|
149
158
|
.on('debug', (debug) => {
|
|
150
|
-
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
159
|
+
log.info(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
160
|
+
})
|
|
161
|
+
.on('warn', (warn) => {
|
|
162
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
151
163
|
})
|
|
152
164
|
.on('error', (error) => {
|
|
153
165
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
154
166
|
});
|
|
155
167
|
break;
|
|
156
168
|
default:
|
|
157
|
-
log(`Device: ${host} ${deviceName}, unknoen zone: ${zoneControl}`);
|
|
169
|
+
log.warn(`Device: ${host} ${deviceName}, unknoen zone: ${zoneControl}`);
|
|
158
170
|
break;
|
|
159
171
|
}
|
|
160
172
|
}
|
package/package.json
CHANGED
package/src/denon.js
CHANGED
|
@@ -193,7 +193,7 @@ class DENON extends EventEmitter {
|
|
|
193
193
|
|
|
194
194
|
//check seriaql number
|
|
195
195
|
if (!serialNumber) {
|
|
196
|
-
|
|
196
|
+
this.emit('warn', `Missing Serial Number, reconnect in 15s.`);
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -215,7 +215,7 @@ class DENON extends EventEmitter {
|
|
|
215
215
|
//prepare accessory
|
|
216
216
|
this.emit('prepareAccessory', allInputs);
|
|
217
217
|
} catch (error) {
|
|
218
|
-
const debug = disableLogConnectError ? false : this.emit('error', `Info error: ${error},
|
|
218
|
+
const debug = disableLogConnectError ? false : this.emit('error', `Info error: ${error}, check again in 15s.`);
|
|
219
219
|
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
220
220
|
this.impulseGenerator.emit('checkDeviceInfo');
|
|
221
221
|
};
|
|
@@ -307,7 +307,7 @@ class DENON extends EventEmitter {
|
|
|
307
307
|
|
|
308
308
|
return true;
|
|
309
309
|
} catch (error) {
|
|
310
|
-
throw new Error(
|
|
310
|
+
throw new Error(error);
|
|
311
311
|
};
|
|
312
312
|
};
|
|
313
313
|
|
|
@@ -417,7 +417,7 @@ class DENON extends EventEmitter {
|
|
|
417
417
|
|
|
418
418
|
return inputsArr;
|
|
419
419
|
} catch (error) {
|
|
420
|
-
throw new Error(
|
|
420
|
+
throw new Error(error);
|
|
421
421
|
}
|
|
422
422
|
};
|
|
423
423
|
|
|
@@ -427,7 +427,7 @@ class DENON extends EventEmitter {
|
|
|
427
427
|
await this.axiosInstance(path);
|
|
428
428
|
return true;
|
|
429
429
|
} catch (error) {
|
|
430
|
-
throw new Error(
|
|
430
|
+
throw new Error(error);
|
|
431
431
|
};
|
|
432
432
|
};
|
|
433
433
|
};
|
package/src/mainzone.js
CHANGED
|
@@ -319,7 +319,7 @@ class MainZone extends EventEmitter {
|
|
|
319
319
|
break;
|
|
320
320
|
};
|
|
321
321
|
} catch (error) {
|
|
322
|
-
this.emit('
|
|
322
|
+
this.emit('warn', `MQTT send error: ${error}.`);
|
|
323
323
|
};
|
|
324
324
|
})
|
|
325
325
|
.on('debug', (debug) => {
|
|
@@ -362,6 +362,9 @@ class MainZone extends EventEmitter {
|
|
|
362
362
|
.on('debug', (debug) => {
|
|
363
363
|
this.emit('debug', debug);
|
|
364
364
|
})
|
|
365
|
+
.on('warn', (warn) => {
|
|
366
|
+
this.emit('warn', warn);
|
|
367
|
+
})
|
|
365
368
|
.on('error', (error) => {
|
|
366
369
|
this.emit('error', error);
|
|
367
370
|
})
|
|
@@ -465,7 +468,7 @@ class MainZone extends EventEmitter {
|
|
|
465
468
|
await this.denon.send(powerState);
|
|
466
469
|
const info = this.disableLogInfo ? false : this.emit('message', `set Power: ${powerState}`);
|
|
467
470
|
} catch (error) {
|
|
468
|
-
this.emit('
|
|
471
|
+
this.emit('warn', `set Power error: ${error}`);
|
|
469
472
|
};
|
|
470
473
|
});
|
|
471
474
|
|
|
@@ -494,7 +497,7 @@ class MainZone extends EventEmitter {
|
|
|
494
497
|
break;
|
|
495
498
|
}
|
|
496
499
|
} catch (error) {
|
|
497
|
-
this.emit('
|
|
500
|
+
this.emit('warn', `set Input error: ${error}`);
|
|
498
501
|
};
|
|
499
502
|
});
|
|
500
503
|
|
|
@@ -548,7 +551,7 @@ class MainZone extends EventEmitter {
|
|
|
548
551
|
await this.denon.send(command);
|
|
549
552
|
const info = this.disableLogInfo ? false : this.emit('message', `set Remote Key: ${command}`);
|
|
550
553
|
} catch (error) {
|
|
551
|
-
this.emit('
|
|
554
|
+
this.emit('warn', `set Remote Key error: ${error}`);
|
|
552
555
|
};
|
|
553
556
|
});
|
|
554
557
|
|
|
@@ -566,7 +569,7 @@ class MainZone extends EventEmitter {
|
|
|
566
569
|
await this.denon.send(brightness);
|
|
567
570
|
const info = this.disableLogInfo ? false : this.emit('message', `set Brightness: ${value}`);
|
|
568
571
|
} catch (error) {
|
|
569
|
-
this.emit('
|
|
572
|
+
this.emit('warn', `set Brightness error: ${error}`);
|
|
570
573
|
};
|
|
571
574
|
});
|
|
572
575
|
|
|
@@ -608,7 +611,7 @@ class MainZone extends EventEmitter {
|
|
|
608
611
|
await this.denon.send(command);
|
|
609
612
|
const info = this.disableLogInfo ? false : this.emit('message', `set Picture Mode: ${CONSTANTS.PictureModesDenonString[command]}`);
|
|
610
613
|
} catch (error) {
|
|
611
|
-
this.emit('
|
|
614
|
+
this.emit('warn', `set Picture Mode error: ${error}`);
|
|
612
615
|
};
|
|
613
616
|
});
|
|
614
617
|
};
|
|
@@ -628,7 +631,7 @@ class MainZone extends EventEmitter {
|
|
|
628
631
|
await this.denon.send(command);
|
|
629
632
|
const info = this.disableLogInfo ? false : this.emit('message', `set Power Mode Selection: ${command === 'MNOPT' ? 'SHOW' : 'HIDE'}`);
|
|
630
633
|
} catch (error) {
|
|
631
|
-
this.emit('
|
|
634
|
+
this.emit('warn', `set Power Mode Selection error: ${error}`);
|
|
632
635
|
};
|
|
633
636
|
});
|
|
634
637
|
this.allServices.push(this.televisionService);
|
|
@@ -664,7 +667,7 @@ class MainZone extends EventEmitter {
|
|
|
664
667
|
await this.denon.send(command);
|
|
665
668
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume Selector: ${command}`);
|
|
666
669
|
} catch (error) {
|
|
667
|
-
this.emit('
|
|
670
|
+
this.emit('warn', `set Volume Selector error: ${error}`);
|
|
668
671
|
};
|
|
669
672
|
});
|
|
670
673
|
|
|
@@ -684,7 +687,7 @@ class MainZone extends EventEmitter {
|
|
|
684
687
|
await this.denon.send(volume);
|
|
685
688
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume: ${value - 80}`);
|
|
686
689
|
} catch (error) {
|
|
687
|
-
this.emit('
|
|
690
|
+
this.emit('warn', `set Volume error: ${error}`);
|
|
688
691
|
};
|
|
689
692
|
});
|
|
690
693
|
|
|
@@ -699,7 +702,7 @@ class MainZone extends EventEmitter {
|
|
|
699
702
|
await this.denon.send(muteState);
|
|
700
703
|
const info = this.disableLogInfo ? false : this.emit('message', `set Mute: ${state ? 'ON' : 'OFF'}`);
|
|
701
704
|
} catch (error) {
|
|
702
|
-
this.emit('
|
|
705
|
+
this.emit('warn', `set Mute error: ${error}`);
|
|
703
706
|
};
|
|
704
707
|
});
|
|
705
708
|
|
|
@@ -766,7 +769,7 @@ class MainZone extends EventEmitter {
|
|
|
766
769
|
this.inputsConfigured[index].name = value;
|
|
767
770
|
await this.displayOrder();
|
|
768
771
|
} catch (error) {
|
|
769
|
-
this.emit('
|
|
772
|
+
this.emit('warn', `save Input Name error: ${error}`);
|
|
770
773
|
}
|
|
771
774
|
});
|
|
772
775
|
|
|
@@ -785,7 +788,7 @@ class MainZone extends EventEmitter {
|
|
|
785
788
|
await this.saveData(this.inputsTargetVisibilityFile, this.savedInputsTargetVisibility);
|
|
786
789
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Saved Input: ${input.name} Target Visibility: ${state ? 'HIDEN' : 'SHOWN'}`);
|
|
787
790
|
} catch (error) {
|
|
788
|
-
this.emit('
|
|
791
|
+
this.emit('warn', `save Input Target Visibility error: ${error}`);
|
|
789
792
|
}
|
|
790
793
|
});
|
|
791
794
|
|
|
@@ -990,7 +993,7 @@ class MainZone extends EventEmitter {
|
|
|
990
993
|
const set2 = state && directSound ? await this.denon.send(directSoundModeSurround) : false;
|
|
991
994
|
const info = this.disableLogInfo || !state ? false : this.emit('message', `set Button Name: ${buttonName}, Reference: ${reference}`);
|
|
992
995
|
} catch (error) {
|
|
993
|
-
this.emit('
|
|
996
|
+
this.emit('warn', `set Button error: ${error}`);
|
|
994
997
|
};
|
|
995
998
|
});
|
|
996
999
|
|
package/src/surround.js
CHANGED
|
@@ -287,7 +287,7 @@ class Surround extends EventEmitter {
|
|
|
287
287
|
break;
|
|
288
288
|
};
|
|
289
289
|
} catch (error) {
|
|
290
|
-
this.emit('
|
|
290
|
+
this.emit('warn', `MQTT send error: ${error}.`);
|
|
291
291
|
};
|
|
292
292
|
})
|
|
293
293
|
.on('debug', (debug) => {
|
|
@@ -330,6 +330,9 @@ class Surround extends EventEmitter {
|
|
|
330
330
|
.on('debug', (debug) => {
|
|
331
331
|
this.emit('debug', debug);
|
|
332
332
|
})
|
|
333
|
+
.on('warn', (warn) => {
|
|
334
|
+
this.emit('warn', warn);
|
|
335
|
+
})
|
|
333
336
|
.on('error', (error) => {
|
|
334
337
|
this.emit('error', error);
|
|
335
338
|
})
|
|
@@ -433,7 +436,7 @@ class Surround extends EventEmitter {
|
|
|
433
436
|
await this.denon.send(powerState);
|
|
434
437
|
const info = this.disableLogInfo ? false : this.emit('message', `set Power: ${powerState}`);
|
|
435
438
|
} catch (error) {
|
|
436
|
-
this.emit('
|
|
439
|
+
this.emit('warn', `set Power error: ${error}`);
|
|
437
440
|
};
|
|
438
441
|
});
|
|
439
442
|
|
|
@@ -462,7 +465,7 @@ class Surround extends EventEmitter {
|
|
|
462
465
|
break;
|
|
463
466
|
}
|
|
464
467
|
} catch (error) {
|
|
465
|
-
this.emit('
|
|
468
|
+
this.emit('warn', `set Surround error: ${error}`);
|
|
466
469
|
};
|
|
467
470
|
});
|
|
468
471
|
|
|
@@ -516,7 +519,7 @@ class Surround extends EventEmitter {
|
|
|
516
519
|
await this.denon.send(command);
|
|
517
520
|
const info = this.disableLogInfo ? false : this.emit('message', `set Remote Key: ${command}`);
|
|
518
521
|
} catch (error) {
|
|
519
|
-
this.emit('
|
|
522
|
+
this.emit('warn', `set Remote Key error: ${error}`);
|
|
520
523
|
};
|
|
521
524
|
});
|
|
522
525
|
|
|
@@ -535,7 +538,7 @@ class Surround extends EventEmitter {
|
|
|
535
538
|
await this.denon.send(command);
|
|
536
539
|
const info = this.disableLogInfo ? false : this.emit('message', `set Power Mode Selection: ${command === 'MNOPT' ? 'SHOW' : 'HIDE'}`);
|
|
537
540
|
} catch (error) {
|
|
538
|
-
this.emit('
|
|
541
|
+
this.emit('warn', `set Power Mode Selection error: ${error}`);
|
|
539
542
|
};
|
|
540
543
|
});
|
|
541
544
|
this.allServices.push(this.televisionService);
|
|
@@ -571,7 +574,7 @@ class Surround extends EventEmitter {
|
|
|
571
574
|
await this.denon.send(command);
|
|
572
575
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume Selector: ${command}`);
|
|
573
576
|
} catch (error) {
|
|
574
|
-
this.emit('
|
|
577
|
+
this.emit('warn', `set Volume Selector error: ${error}`);
|
|
575
578
|
};
|
|
576
579
|
});
|
|
577
580
|
|
|
@@ -591,7 +594,7 @@ class Surround extends EventEmitter {
|
|
|
591
594
|
await this.denon.send(volume);
|
|
592
595
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume: ${value - 80}`);
|
|
593
596
|
} catch (error) {
|
|
594
|
-
this.emit('
|
|
597
|
+
this.emit('warn', `set Volume error: ${error}`);
|
|
595
598
|
};
|
|
596
599
|
});
|
|
597
600
|
|
|
@@ -606,7 +609,7 @@ class Surround extends EventEmitter {
|
|
|
606
609
|
await this.denon.send(muteState);
|
|
607
610
|
const info = this.disableLogInfo ? false : this.emit('message', `set Mute: ${state ? 'ON' : 'OFF'}`);
|
|
608
611
|
} catch (error) {
|
|
609
|
-
this.emit('
|
|
612
|
+
this.emit('warn', `set Mute error: ${error}`);
|
|
610
613
|
};
|
|
611
614
|
});
|
|
612
615
|
|
|
@@ -673,7 +676,7 @@ class Surround extends EventEmitter {
|
|
|
673
676
|
this.inputsConfigured[index].name = value;
|
|
674
677
|
await this.displayOrder();
|
|
675
678
|
} catch (error) {
|
|
676
|
-
this.emit('
|
|
679
|
+
this.emit('warn', `save Surround Name error: ${error}`);
|
|
677
680
|
}
|
|
678
681
|
});
|
|
679
682
|
|
|
@@ -692,7 +695,7 @@ class Surround extends EventEmitter {
|
|
|
692
695
|
await this.saveData(this.inputsTargetVisibilityFile, this.savedInputsTargetVisibility);
|
|
693
696
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Saved Surround: ${input.name} Target Visibility: ${state ? 'HIDEN' : 'SHOWN'}`);
|
|
694
697
|
} catch (error) {
|
|
695
|
-
this.emit('
|
|
698
|
+
this.emit('warn', `save Surround Target Visibility error: ${error}`);
|
|
696
699
|
}
|
|
697
700
|
});
|
|
698
701
|
|
package/src/zone2.js
CHANGED
|
@@ -317,7 +317,7 @@ class Zone2 extends EventEmitter {
|
|
|
317
317
|
break;
|
|
318
318
|
};
|
|
319
319
|
} catch (error) {
|
|
320
|
-
this.emit('
|
|
320
|
+
this.emit('warn', `MQTT send error: ${error}.`);
|
|
321
321
|
};
|
|
322
322
|
})
|
|
323
323
|
.on('debug', (debug) => {
|
|
@@ -360,6 +360,9 @@ class Zone2 extends EventEmitter {
|
|
|
360
360
|
.on('debug', (debug) => {
|
|
361
361
|
this.emit('debug', debug);
|
|
362
362
|
})
|
|
363
|
+
.on('warn', (warn) => {
|
|
364
|
+
this.emit('warn', warn);
|
|
365
|
+
})
|
|
363
366
|
.on('error', (error) => {
|
|
364
367
|
this.emit('error', error);
|
|
365
368
|
})
|
|
@@ -463,7 +466,7 @@ class Zone2 extends EventEmitter {
|
|
|
463
466
|
await this.denon.send(powerState);
|
|
464
467
|
const info = this.disableLogInfo ? false : this.emit('message', `set Power: ${powerState}`);
|
|
465
468
|
} catch (error) {
|
|
466
|
-
this.emit('
|
|
469
|
+
this.emit('warn', `set Power error: ${error}`);
|
|
467
470
|
};
|
|
468
471
|
});
|
|
469
472
|
|
|
@@ -492,7 +495,7 @@ class Zone2 extends EventEmitter {
|
|
|
492
495
|
break;
|
|
493
496
|
}
|
|
494
497
|
} catch (error) {
|
|
495
|
-
this.emit('
|
|
498
|
+
this.emit('warn', `set Input error: ${error}`);
|
|
496
499
|
};
|
|
497
500
|
});
|
|
498
501
|
|
|
@@ -546,7 +549,7 @@ class Zone2 extends EventEmitter {
|
|
|
546
549
|
await this.denon.send(command);
|
|
547
550
|
const info = this.disableLogInfo ? false : this.emit('message', `set Remote Key: ${command}`);
|
|
548
551
|
} catch (error) {
|
|
549
|
-
this.emit('
|
|
552
|
+
this.emit('warn', `set Remote Key error: ${error}`);
|
|
550
553
|
};
|
|
551
554
|
});
|
|
552
555
|
this.allServices.push(this.televisionService);
|
|
@@ -582,7 +585,7 @@ class Zone2 extends EventEmitter {
|
|
|
582
585
|
await this.denon.send(command);
|
|
583
586
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume Selector: ${command}`);
|
|
584
587
|
} catch (error) {
|
|
585
|
-
this.emit('
|
|
588
|
+
this.emit('warn', `set Volume Selector error: ${error}`);
|
|
586
589
|
};
|
|
587
590
|
});
|
|
588
591
|
|
|
@@ -602,7 +605,7 @@ class Zone2 extends EventEmitter {
|
|
|
602
605
|
await this.denon.send(volume);
|
|
603
606
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume: ${value - 80}`);
|
|
604
607
|
} catch (error) {
|
|
605
|
-
this.emit('
|
|
608
|
+
this.emit('warn', `set Volume error: ${error}`);
|
|
606
609
|
};
|
|
607
610
|
});
|
|
608
611
|
|
|
@@ -617,7 +620,7 @@ class Zone2 extends EventEmitter {
|
|
|
617
620
|
await this.denon.send(muteState);
|
|
618
621
|
const info = this.disableLogInfo ? false : this.emit('message', `set Mute: ${state ? 'ON' : 'OFF'}`);
|
|
619
622
|
} catch (error) {
|
|
620
|
-
this.emit('
|
|
623
|
+
this.emit('warn', `set Mute error: ${error}`);
|
|
621
624
|
};
|
|
622
625
|
});
|
|
623
626
|
|
|
@@ -685,7 +688,7 @@ class Zone2 extends EventEmitter {
|
|
|
685
688
|
this.inputsConfigured[index].name = value;
|
|
686
689
|
await this.displayOrder();
|
|
687
690
|
} catch (error) {
|
|
688
|
-
this.emit('
|
|
691
|
+
this.emit('warn', `save Input Name error: ${error}`);
|
|
689
692
|
}
|
|
690
693
|
});
|
|
691
694
|
|
|
@@ -704,7 +707,7 @@ class Zone2 extends EventEmitter {
|
|
|
704
707
|
await this.saveData(this.inputsTargetVisibilityFile, this.savedInputsTargetVisibility);
|
|
705
708
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Saved Input: ${input.name} Target Visibility: ${state ? 'HIDEN' : 'SHOWN'}`);
|
|
706
709
|
} catch (error) {
|
|
707
|
-
this.emit('
|
|
710
|
+
this.emit('warn', `save Input Target Visibility error: ${error}`);
|
|
708
711
|
}
|
|
709
712
|
});
|
|
710
713
|
|
|
@@ -903,7 +906,7 @@ class Zone2 extends EventEmitter {
|
|
|
903
906
|
const set = state ? await this.denon.send(reference) : false;
|
|
904
907
|
const info = this.disableLogInfo || !state ? false : this.emit('message', `set Button Name: ${buttonName}, Reference: ${reference}`);
|
|
905
908
|
} catch (error) {
|
|
906
|
-
this.emit('
|
|
909
|
+
this.emit('warn', `set Button error: ${error}`);
|
|
907
910
|
};
|
|
908
911
|
});
|
|
909
912
|
|
package/src/zone3.js
CHANGED
|
@@ -317,7 +317,7 @@ class Zone3 extends EventEmitter {
|
|
|
317
317
|
break;
|
|
318
318
|
};
|
|
319
319
|
} catch (error) {
|
|
320
|
-
this.emit('
|
|
320
|
+
this.emit('warn', `MQTT send error: ${error}.`);
|
|
321
321
|
};
|
|
322
322
|
})
|
|
323
323
|
.on('debug', (debug) => {
|
|
@@ -360,6 +360,9 @@ class Zone3 extends EventEmitter {
|
|
|
360
360
|
.on('debug', (debug) => {
|
|
361
361
|
this.emit('debug', debug);
|
|
362
362
|
})
|
|
363
|
+
.on('warn', (warn) => {
|
|
364
|
+
this.emit('warn', warn);
|
|
365
|
+
})
|
|
363
366
|
.on('error', (error) => {
|
|
364
367
|
this.emit('error', error);
|
|
365
368
|
})
|
|
@@ -399,7 +402,7 @@ class Zone3 extends EventEmitter {
|
|
|
399
402
|
this.televisionService.setCharacteristic(Characteristic.DisplayOrder, Encode(1, displayOrder).toString('base64'));
|
|
400
403
|
return true;
|
|
401
404
|
} catch (error) {
|
|
402
|
-
throw new Error(
|
|
405
|
+
throw new Error(error);
|
|
403
406
|
};
|
|
404
407
|
}
|
|
405
408
|
|
|
@@ -409,7 +412,7 @@ class Zone3 extends EventEmitter {
|
|
|
409
412
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Saved data: ${JSON.stringify(data, null, 2)}`);
|
|
410
413
|
return true;
|
|
411
414
|
} catch (error) {
|
|
412
|
-
throw new Error(
|
|
415
|
+
throw new Error(error);
|
|
413
416
|
};
|
|
414
417
|
}
|
|
415
418
|
|
|
@@ -418,7 +421,7 @@ class Zone3 extends EventEmitter {
|
|
|
418
421
|
const data = await fsPromises.readFile(path);
|
|
419
422
|
return data;
|
|
420
423
|
} catch (error) {
|
|
421
|
-
throw new Error(
|
|
424
|
+
throw new Error(`Read saved data error: ${error}`);
|
|
422
425
|
};
|
|
423
426
|
}
|
|
424
427
|
|
|
@@ -463,7 +466,7 @@ class Zone3 extends EventEmitter {
|
|
|
463
466
|
await this.denon.send(powerState);
|
|
464
467
|
const info = this.disableLogInfo ? false : this.emit('message', `set Power: ${powerState}`);
|
|
465
468
|
} catch (error) {
|
|
466
|
-
this.emit('
|
|
469
|
+
this.emit('warn', `set Power error: ${error}`);
|
|
467
470
|
};
|
|
468
471
|
});
|
|
469
472
|
|
|
@@ -492,7 +495,7 @@ class Zone3 extends EventEmitter {
|
|
|
492
495
|
break;
|
|
493
496
|
}
|
|
494
497
|
} catch (error) {
|
|
495
|
-
this.emit('
|
|
498
|
+
this.emit('warn', `set Input error: ${error}`);
|
|
496
499
|
};
|
|
497
500
|
});
|
|
498
501
|
|
|
@@ -546,7 +549,7 @@ class Zone3 extends EventEmitter {
|
|
|
546
549
|
await this.denon.send(command);
|
|
547
550
|
const info = this.disableLogInfo ? false : this.emit('message', `set Remote Key: ${command}`);
|
|
548
551
|
} catch (error) {
|
|
549
|
-
this.emit('
|
|
552
|
+
this.emit('warn', `set Remote Key error: ${error}`);
|
|
550
553
|
};
|
|
551
554
|
});
|
|
552
555
|
this.allServices.push(this.televisionService);
|
|
@@ -582,7 +585,7 @@ class Zone3 extends EventEmitter {
|
|
|
582
585
|
await this.denon.send(command);
|
|
583
586
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume Selector: ${command}`);
|
|
584
587
|
} catch (error) {
|
|
585
|
-
this.emit('
|
|
588
|
+
this.emit('warn', `set Volume Selector error: ${error}`);
|
|
586
589
|
};
|
|
587
590
|
});
|
|
588
591
|
|
|
@@ -602,7 +605,7 @@ class Zone3 extends EventEmitter {
|
|
|
602
605
|
await this.denon.send(volume);
|
|
603
606
|
const info = this.disableLogInfo ? false : this.emit('message', `set Volume: ${value - 80}`);
|
|
604
607
|
} catch (error) {
|
|
605
|
-
this.emit('
|
|
608
|
+
this.emit('warn', `set Volume error: ${error}`);
|
|
606
609
|
};
|
|
607
610
|
});
|
|
608
611
|
|
|
@@ -617,7 +620,7 @@ class Zone3 extends EventEmitter {
|
|
|
617
620
|
await this.denon.send(muteState);
|
|
618
621
|
const info = this.disableLogInfo ? false : this.emit('message', `set Mute: ${state ? 'ON' : 'OFF'}`);
|
|
619
622
|
} catch (error) {
|
|
620
|
-
this.emit('
|
|
623
|
+
this.emit('warn', `set Mute error: ${error}`);
|
|
621
624
|
};
|
|
622
625
|
});
|
|
623
626
|
|
|
@@ -684,7 +687,7 @@ class Zone3 extends EventEmitter {
|
|
|
684
687
|
this.inputsConfigured[index].name = value;
|
|
685
688
|
await this.displayOrder();
|
|
686
689
|
} catch (error) {
|
|
687
|
-
this.emit('
|
|
690
|
+
this.emit('warn', `save Input Name error: ${error}`);
|
|
688
691
|
}
|
|
689
692
|
});
|
|
690
693
|
|
|
@@ -703,7 +706,7 @@ class Zone3 extends EventEmitter {
|
|
|
703
706
|
await this.saveData(this.inputsTargetVisibilityFile, this.savedInputsTargetVisibility);
|
|
704
707
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Saved Input: ${input.name} Target Visibility: ${state ? 'HIDEN' : 'SHOWN'}`);
|
|
705
708
|
} catch (error) {
|
|
706
|
-
this.emit('
|
|
709
|
+
this.emit('warn', `save Input Target Visibility error: ${error}`);
|
|
707
710
|
}
|
|
708
711
|
});
|
|
709
712
|
|
|
@@ -902,7 +905,7 @@ class Zone3 extends EventEmitter {
|
|
|
902
905
|
const set = state ? await this.denon.send(reference) : false;
|
|
903
906
|
const info = this.disableLogInfo || !state ? false : this.emit('message', `set Button Name: ${buttonName}, Reference: ${reference}`);
|
|
904
907
|
} catch (error) {
|
|
905
|
-
this.emit('
|
|
908
|
+
this.emit('warn', `set Button error: ${error}`);
|
|
906
909
|
};
|
|
907
910
|
});
|
|
908
911
|
|
|
@@ -914,7 +917,7 @@ class Zone3 extends EventEmitter {
|
|
|
914
917
|
|
|
915
918
|
return accessory;
|
|
916
919
|
} catch (error) {
|
|
917
|
-
throw new Error(
|
|
920
|
+
throw new Error(error)
|
|
918
921
|
};
|
|
919
922
|
}
|
|
920
923
|
};
|