homebridge-denon-tv 5.0.2 → 5.0.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/index.js +29 -16
- package/package.json +1 -1
- package/src/denon.js +5 -5
- package/src/mainzone.js +20 -17
- package/src/restful.js +2 -2
- package/src/surround.js +23 -20
- package/src/zone2.js +23 -20
- package/src/zone3.js +21 -18
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;
|
|
@@ -73,6 +73,7 @@ class DenonPlatform {
|
|
|
73
73
|
});
|
|
74
74
|
} catch (error) {
|
|
75
75
|
log.error(`Device: ${host} ${deviceName}, prepare files error: ${error}`);
|
|
76
|
+
return;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
//zones
|
|
@@ -81,16 +82,19 @@ class DenonPlatform {
|
|
|
81
82
|
const mainZone = new MainZone(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
82
83
|
mainZone.on('publishAccessory', (accessory) => {
|
|
83
84
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
84
|
-
|
|
85
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
85
86
|
})
|
|
86
87
|
.on('devInfo', (devInfo) => {
|
|
87
|
-
log(devInfo);
|
|
88
|
+
log.info(devInfo);
|
|
88
89
|
})
|
|
89
90
|
.on('message', (message) => {
|
|
90
|
-
log(`Device: ${host} ${deviceName}, ${message}`);
|
|
91
|
+
log.info(`Device: ${host} ${deviceName}, ${message}`);
|
|
91
92
|
})
|
|
92
93
|
.on('debug', (debug) => {
|
|
93
|
-
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
94
|
+
log.info(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
95
|
+
})
|
|
96
|
+
.on('warn', (warn) => {
|
|
97
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
94
98
|
})
|
|
95
99
|
.on('error', (error) => {
|
|
96
100
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
@@ -100,7 +104,7 @@ class DenonPlatform {
|
|
|
100
104
|
const zone2 = new Zone2(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
101
105
|
zone2.on('publishAccessory', (accessory) => {
|
|
102
106
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
103
|
-
|
|
107
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
104
108
|
})
|
|
105
109
|
.on('devInfo', (devInfo) => {
|
|
106
110
|
log(devInfo);
|
|
@@ -111,6 +115,9 @@ class DenonPlatform {
|
|
|
111
115
|
.on('debug', (debug) => {
|
|
112
116
|
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
113
117
|
})
|
|
118
|
+
.on('warn', (warn) => {
|
|
119
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
120
|
+
})
|
|
114
121
|
.on('error', (error) => {
|
|
115
122
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
116
123
|
});
|
|
@@ -119,16 +126,19 @@ class DenonPlatform {
|
|
|
119
126
|
const zone3 = new Zone3(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
120
127
|
zone3.on('publishAccessory', (accessory) => {
|
|
121
128
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
122
|
-
|
|
129
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
123
130
|
})
|
|
124
131
|
.on('devInfo', (devInfo) => {
|
|
125
|
-
log(devInfo);
|
|
132
|
+
log.info(devInfo);
|
|
126
133
|
})
|
|
127
134
|
.on('message', (message) => {
|
|
128
|
-
log(`Device: ${host} ${deviceName}, ${message}`);
|
|
135
|
+
log.info(`Device: ${host} ${deviceName}, ${message}`);
|
|
129
136
|
})
|
|
130
137
|
.on('debug', (debug) => {
|
|
131
|
-
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
138
|
+
log.info(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
139
|
+
})
|
|
140
|
+
.on('warn', (warn) => {
|
|
141
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
132
142
|
})
|
|
133
143
|
.on('error', (error) => {
|
|
134
144
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
@@ -138,23 +148,26 @@ class DenonPlatform {
|
|
|
138
148
|
const surround = new Surround(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
139
149
|
surround.on('publishAccessory', (accessory) => {
|
|
140
150
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
141
|
-
|
|
151
|
+
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
142
152
|
})
|
|
143
153
|
.on('devInfo', (devInfo) => {
|
|
144
|
-
log(devInfo);
|
|
154
|
+
log.info(devInfo);
|
|
145
155
|
})
|
|
146
156
|
.on('message', (message) => {
|
|
147
|
-
log(`Device: ${host} ${deviceName}, ${message}`);
|
|
157
|
+
log.info(`Device: ${host} ${deviceName}, ${message}`);
|
|
148
158
|
})
|
|
149
159
|
.on('debug', (debug) => {
|
|
150
|
-
log(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
160
|
+
log.info(`Device: ${host} ${deviceName}, debug: ${debug}`);
|
|
161
|
+
})
|
|
162
|
+
.on('warn', (warn) => {
|
|
163
|
+
log.warn(`Device: ${host} ${deviceName}, ${warn}`);
|
|
151
164
|
})
|
|
152
165
|
.on('error', (error) => {
|
|
153
166
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
154
167
|
});
|
|
155
168
|
break;
|
|
156
169
|
default:
|
|
157
|
-
log(`Device: ${host} ${deviceName}, unknoen zone: ${zoneControl}`);
|
|
170
|
+
log.warn(`Device: ${host} ${deviceName}, unknoen zone: ${zoneControl}`);
|
|
158
171
|
break;
|
|
159
172
|
}
|
|
160
173
|
}
|
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
|
@@ -259,11 +259,11 @@ class MainZone extends EventEmitter {
|
|
|
259
259
|
this.emit('message', message);
|
|
260
260
|
this.restFulConnected = true;
|
|
261
261
|
})
|
|
262
|
-
.on('error', (error) => {
|
|
263
|
-
this.emit('error', error);
|
|
264
|
-
})
|
|
265
262
|
.on('debug', (debug) => {
|
|
266
263
|
this.emit('debug', debug);
|
|
264
|
+
})
|
|
265
|
+
.on('error', (error) => {
|
|
266
|
+
this.emit('warn', error);
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -319,14 +319,14 @@ 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) => {
|
|
326
326
|
this.emit('debug', debug);
|
|
327
327
|
})
|
|
328
328
|
.on('error', (error) => {
|
|
329
|
-
this.emit('
|
|
329
|
+
this.emit('warn', error);
|
|
330
330
|
});
|
|
331
331
|
};
|
|
332
332
|
|
|
@@ -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/restful.js
CHANGED
|
@@ -32,7 +32,7 @@ class RestFul extends EventEmitter {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
} catch (error) {
|
|
35
|
-
this.emit('error', `RESTful error: ${error}`)
|
|
35
|
+
this.emit('error', `RESTful Connect error: ${error}`)
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -51,7 +51,7 @@ class RestFul extends EventEmitter {
|
|
|
51
51
|
this.restFulData.surround = data;
|
|
52
52
|
break;
|
|
53
53
|
default:
|
|
54
|
-
this.emit('
|
|
54
|
+
this.emit('error', `RESTFul update unknown path: ${path}, data: ${data}`)
|
|
55
55
|
break;
|
|
56
56
|
};
|
|
57
57
|
const emitDebug = this.restFulDebug ? this.emit('debug', `RESTFul update path: ${path}, data: ${data}`) : false;
|
package/src/surround.js
CHANGED
|
@@ -227,11 +227,11 @@ class Surround extends EventEmitter {
|
|
|
227
227
|
this.emit('message', message);
|
|
228
228
|
this.restFulConnected = true;
|
|
229
229
|
})
|
|
230
|
-
.on('error', (error) => {
|
|
231
|
-
this.emit('error', error);
|
|
232
|
-
})
|
|
233
230
|
.on('debug', (debug) => {
|
|
234
231
|
this.emit('debug', debug);
|
|
232
|
+
})
|
|
233
|
+
.on('error', (error) => {
|
|
234
|
+
this.emit('warn', error);
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -287,14 +287,14 @@ 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) => {
|
|
294
294
|
this.emit('debug', debug);
|
|
295
295
|
})
|
|
296
296
|
.on('error', (error) => {
|
|
297
|
-
this.emit('
|
|
297
|
+
this.emit('warn', error);
|
|
298
298
|
});
|
|
299
299
|
};
|
|
300
300
|
|
|
@@ -316,8 +316,8 @@ class Surround extends EventEmitter {
|
|
|
316
316
|
//sort surrounds list
|
|
317
317
|
const sortInputsDisplayOrder = this.televisionService ? await this.displayOrder() : false;
|
|
318
318
|
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
//start check state
|
|
320
|
+
this.denon.impulseGenerator.start([{ name: 'checkState', sampling: refreshInterval }]);
|
|
321
321
|
} catch (error) {
|
|
322
322
|
this.emit('error', `prepare accessory error: ${error}`);
|
|
323
323
|
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
@@ -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
|
})
|
|
@@ -369,7 +372,7 @@ class Surround extends EventEmitter {
|
|
|
369
372
|
this.televisionService.setCharacteristic(Characteristic.DisplayOrder, Encode(1, displayOrder).toString('base64'));
|
|
370
373
|
return true;
|
|
371
374
|
} catch (error) {
|
|
372
|
-
throw new Error(
|
|
375
|
+
throw new Error(error);
|
|
373
376
|
};
|
|
374
377
|
}
|
|
375
378
|
|
|
@@ -379,7 +382,7 @@ class Surround extends EventEmitter {
|
|
|
379
382
|
const debug = !this.enableDebugMode ? false : this.emit('debug', `Saved data: ${JSON.stringify(data, null, 2)}`);
|
|
380
383
|
return true;
|
|
381
384
|
} catch (error) {
|
|
382
|
-
throw new Error(
|
|
385
|
+
throw new Error(error);
|
|
383
386
|
};
|
|
384
387
|
}
|
|
385
388
|
|
|
@@ -388,7 +391,7 @@ class Surround extends EventEmitter {
|
|
|
388
391
|
const data = await fsPromises.readFile(path);
|
|
389
392
|
return data;
|
|
390
393
|
} catch (error) {
|
|
391
|
-
throw new Error(
|
|
394
|
+
throw new Error(`Read saved data error: ${error}`);
|
|
392
395
|
};
|
|
393
396
|
}
|
|
394
397
|
|
|
@@ -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
|
|
|
@@ -857,7 +860,7 @@ class Surround extends EventEmitter {
|
|
|
857
860
|
|
|
858
861
|
return accessory;
|
|
859
862
|
} catch (error) {
|
|
860
|
-
throw new Error(
|
|
863
|
+
throw new Error(error)
|
|
861
864
|
};
|
|
862
865
|
}
|
|
863
866
|
};
|
package/src/zone2.js
CHANGED
|
@@ -257,11 +257,11 @@ class Zone2 extends EventEmitter {
|
|
|
257
257
|
this.emit('message', message);
|
|
258
258
|
this.restFulConnected = true;
|
|
259
259
|
})
|
|
260
|
-
.on('error', (error) => {
|
|
261
|
-
this.emit('error', error);
|
|
262
|
-
})
|
|
263
260
|
.on('debug', (debug) => {
|
|
264
261
|
this.emit('debug', debug);
|
|
262
|
+
})
|
|
263
|
+
.on('error', (error) => {
|
|
264
|
+
this.emit('warn', error);
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -317,14 +317,14 @@ 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) => {
|
|
324
324
|
this.emit('debug', debug);
|
|
325
325
|
})
|
|
326
326
|
.on('error', (error) => {
|
|
327
|
-
this.emit('
|
|
327
|
+
this.emit('warn', error);
|
|
328
328
|
});
|
|
329
329
|
};
|
|
330
330
|
|
|
@@ -346,8 +346,8 @@ class Zone2 extends EventEmitter {
|
|
|
346
346
|
//sort inputs list
|
|
347
347
|
const sortInputsDisplayOrder = this.televisionService ? await this.displayOrder() : false;
|
|
348
348
|
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
//start check state
|
|
350
|
+
this.denon.impulseGenerator.start([{ name: 'checkState', sampling: refreshInterval }]);
|
|
351
351
|
} catch (error) {
|
|
352
352
|
this.emit('error', `prepare accessory error: ${error}`);
|
|
353
353
|
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
@@ -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
|
})
|
|
@@ -399,7 +402,7 @@ class Zone2 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 Zone2 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 Zone2 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 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
|
|
|
@@ -915,7 +918,7 @@ class Zone2 extends EventEmitter {
|
|
|
915
918
|
|
|
916
919
|
return accessory;
|
|
917
920
|
} catch (error) {
|
|
918
|
-
throw new Error(
|
|
921
|
+
throw new Error(error)
|
|
919
922
|
};
|
|
920
923
|
}
|
|
921
924
|
};
|
package/src/zone3.js
CHANGED
|
@@ -257,11 +257,11 @@ class Zone3 extends EventEmitter {
|
|
|
257
257
|
this.emit('message', message);
|
|
258
258
|
this.restFulConnected = true;
|
|
259
259
|
})
|
|
260
|
-
.on('error', (error) => {
|
|
261
|
-
this.emit('error', error);
|
|
262
|
-
})
|
|
263
260
|
.on('debug', (debug) => {
|
|
264
261
|
this.emit('debug', debug);
|
|
262
|
+
})
|
|
263
|
+
.on('error', (error) => {
|
|
264
|
+
this.emit('warn', error);
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
267
|
|
|
@@ -317,14 +317,14 @@ 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) => {
|
|
324
324
|
this.emit('debug', debug);
|
|
325
325
|
})
|
|
326
326
|
.on('error', (error) => {
|
|
327
|
-
this.emit('
|
|
327
|
+
this.emit('warn', error);
|
|
328
328
|
});
|
|
329
329
|
};
|
|
330
330
|
|
|
@@ -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
|
};
|