homebridge-denon-tv 5.1.13 → 5.1.14
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 +12 -44
- package/package.json +1 -1
- package/src/denon.js +17 -22
- package/src/mainzone.js +1 -5
- package/src/surround.js +1 -5
- package/src/zone2.js +1 -5
- package/src/zone3.js +1 -5
package/index.js
CHANGED
|
@@ -83,8 +83,8 @@ class DenonPlatform {
|
|
|
83
83
|
switch (zoneControl) {
|
|
84
84
|
case 0: //main zone
|
|
85
85
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
const mainZone = new MainZone(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
87
|
+
mainZone.on('publishAccessory', (accessory) => {
|
|
88
88
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
89
89
|
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
90
90
|
})
|
|
@@ -105,25 +105,17 @@ class DenonPlatform {
|
|
|
105
105
|
})
|
|
106
106
|
.on('error', async (error) => {
|
|
107
107
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
108
|
-
|
|
109
|
-
//start
|
|
110
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
111
|
-
await this.mainZone.start()
|
|
112
108
|
});
|
|
113
109
|
|
|
114
|
-
await
|
|
110
|
+
await mainZone.start();
|
|
115
111
|
} catch (error) {
|
|
116
112
|
log.error(`Device: ${host} ${deviceName}, did finish launching error: ${error}`);
|
|
117
|
-
|
|
118
|
-
//start
|
|
119
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
120
|
-
await this.mainZone.start();
|
|
121
113
|
}
|
|
122
114
|
break;
|
|
123
115
|
case 1: //zone 1
|
|
124
116
|
try {
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
const zone2 = new Zone2(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
118
|
+
zone2.on('publishAccessory', (accessory) => {
|
|
127
119
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
128
120
|
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
129
121
|
})
|
|
@@ -144,25 +136,17 @@ class DenonPlatform {
|
|
|
144
136
|
})
|
|
145
137
|
.on('error', async (error) => {
|
|
146
138
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
147
|
-
|
|
148
|
-
//start
|
|
149
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
150
|
-
await this.zone2.start()
|
|
151
139
|
});
|
|
152
140
|
|
|
153
|
-
await
|
|
141
|
+
await zone2.start();
|
|
154
142
|
} catch (error) {
|
|
155
143
|
log.error(`Device: ${host} ${deviceName}, did finish launching error: ${error}`);
|
|
156
|
-
|
|
157
|
-
//start
|
|
158
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
159
|
-
await this.zone2.start();
|
|
160
144
|
}
|
|
161
145
|
break;
|
|
162
146
|
case 2: //zone 2
|
|
163
147
|
try {
|
|
164
|
-
|
|
165
|
-
|
|
148
|
+
const zone3 = new Zone3(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
149
|
+
zone3.on('publishAccessory', (accessory) => {
|
|
166
150
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
167
151
|
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
168
152
|
})
|
|
@@ -183,25 +167,17 @@ class DenonPlatform {
|
|
|
183
167
|
})
|
|
184
168
|
.on('error', async (error) => {
|
|
185
169
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
186
|
-
|
|
187
|
-
//start
|
|
188
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
189
|
-
await this.zone3.start()
|
|
190
170
|
});
|
|
191
171
|
|
|
192
|
-
await
|
|
172
|
+
await zone3.start();
|
|
193
173
|
} catch (error) {
|
|
194
174
|
log.error(`Device: ${host} ${deviceName}, did finish launching error: ${error}`);
|
|
195
|
-
|
|
196
|
-
//start
|
|
197
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
198
|
-
await this.zone3.start();
|
|
199
175
|
}
|
|
200
176
|
break;
|
|
201
177
|
case 3: //surround
|
|
202
178
|
try {
|
|
203
|
-
|
|
204
|
-
|
|
179
|
+
const surround = new Surround(api, device, zoneControl, deviceName, host, port, generation, devInfoFile, inputsFile, inputsNamesFile, inputsTargetVisibilityFile, refreshInterval);
|
|
180
|
+
surround.on('publishAccessory', (accessory) => {
|
|
205
181
|
api.publishExternalAccessories(CONSTANTS.PluginName, [accessory]);
|
|
206
182
|
log.success(`Device: ${host} ${deviceName}, published as external accessory.`);
|
|
207
183
|
})
|
|
@@ -222,19 +198,11 @@ class DenonPlatform {
|
|
|
222
198
|
})
|
|
223
199
|
.on('error', async (error) => {
|
|
224
200
|
log.error(`Device: ${host} ${deviceName}, ${error}`);
|
|
225
|
-
|
|
226
|
-
//start
|
|
227
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
228
|
-
await this.surround.start()
|
|
229
201
|
});
|
|
230
202
|
|
|
231
|
-
await
|
|
203
|
+
await surround.start();
|
|
232
204
|
} catch (error) {
|
|
233
205
|
log.error(`Device: ${host} ${deviceName}, did finish launching error: ${error}`);
|
|
234
|
-
|
|
235
|
-
//start
|
|
236
|
-
await new Promise(resolve => setTimeout(resolve, 15000));
|
|
237
|
-
await this.surround.start();
|
|
238
206
|
}
|
|
239
207
|
break;
|
|
240
208
|
default:
|
package/package.json
CHANGED
package/src/denon.js
CHANGED
|
@@ -81,8 +81,7 @@ class DENON extends EventEmitter {
|
|
|
81
81
|
try {
|
|
82
82
|
await this.checkState();
|
|
83
83
|
} catch (error) {
|
|
84
|
-
|
|
85
|
-
this.emit('error', `Impulse generator check state error: ${error.message || error}, check again in 15s.`);
|
|
84
|
+
this.emit('error', `Impulse generator check state error: ${error.message || error}.`);
|
|
86
85
|
};
|
|
87
86
|
}).on('state', (state) => { });
|
|
88
87
|
};
|
|
@@ -135,6 +134,8 @@ class DENON extends EventEmitter {
|
|
|
135
134
|
const supportAllZoneStereo = capabilitiesSetupSupport && capabilitiesSetupKeys.includes('AllZoneStereo') ? capabilitiesSetup.AllZoneStereo.Control === 1 : false;
|
|
136
135
|
const supportPictureMode = capabilitiesSetupSupport && capabilitiesSetupKeys.includes('PictureMode') ? capabilitiesSetup.PictureMode.Control === 1 : false;
|
|
137
136
|
const supportSoundMode = capabilitiesSetupSupport && capabilitiesSetupKeys.includes('SoundMode') ? capabilitiesSetup.SoundMode.Control === 1 : false
|
|
137
|
+
this.supportPictureMode = supportPictureMode;
|
|
138
|
+
this.supportSoundMode = supportSoundMode;
|
|
138
139
|
|
|
139
140
|
//net link
|
|
140
141
|
const capabilitiesNetLinkSupport = capabilitiesSupport && capabilitiesKeys.includes('NetLink');
|
|
@@ -200,28 +201,27 @@ class DENON extends EventEmitter {
|
|
|
200
201
|
|
|
201
202
|
//check seriaql number
|
|
202
203
|
if (!serialNumber) {
|
|
203
|
-
|
|
204
|
-
this.emit('error', `Missing Serial Number, check again in 15s.`);
|
|
204
|
+
this.emit('error', `Missing Serial Number.`);
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
//save device info to the file
|
|
209
209
|
const saveDevInfo = this.zone === 0 ? await this.saveData(this.devInfoFile, devInfo) : false;
|
|
210
210
|
|
|
211
|
-
//
|
|
212
|
-
const deviceInputsOldAvr = this.
|
|
213
|
-
const deviceInputsNewAvr =
|
|
214
|
-
const deviceInputs = [deviceInputsOldAvr, deviceInputsNewAvr, deviceInputsNewAvr][this.generation];
|
|
211
|
+
//prepare all inputs
|
|
212
|
+
const deviceInputsOldAvr = this.generation === 0 ? devInfo.InputFuncList.value : [];
|
|
213
|
+
const deviceInputsNewAvr = supportInputSource ? zoneCapabilities.InputSource.List.Source : [];
|
|
214
|
+
const deviceInputs = this.getInputsFromDevice ? [deviceInputsOldAvr, deviceInputsNewAvr, deviceInputsNewAvr][this.generation] : this.inputs;
|
|
215
215
|
const allInputs = await this.getInputs(devInfo, this.generation, this.zone, deviceInputs, zoneCapabilities, this.getInputsFromDevice, this.getFavoritesFromDevice, this.getQuickSmartSelectFromDevice, supportFavorites, supportShortcut, supportQuickSmartSelect);
|
|
216
|
+
const inputsExist = allInputs.length > 0;
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
this.emit('
|
|
220
|
-
return;
|
|
218
|
+
//check inputs
|
|
219
|
+
if (!inputsExist) {
|
|
220
|
+
this.emit('warn', `Found: ${allInputs} inputs.`);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
//save inputs
|
|
224
|
-
await this.saveData(this.inputsFile, allInputs);
|
|
223
|
+
//save inputs if exist
|
|
224
|
+
const saveInputs = inputsExist ? await this.saveData(this.inputsFile, allInputs) : false;
|
|
225
225
|
|
|
226
226
|
//connect to deice success
|
|
227
227
|
this.emit('success', `Connect Success.`)
|
|
@@ -229,9 +229,6 @@ class DENON extends EventEmitter {
|
|
|
229
229
|
//emit device info
|
|
230
230
|
this.emit('deviceInfo', manufacturer, modelName, serialNumber, firmwareRevision, deviceZones, apiVersion, supportPictureMode);
|
|
231
231
|
|
|
232
|
-
this.supportPictureMode = supportPictureMode;
|
|
233
|
-
this.supportSoundMode = supportSoundMode;
|
|
234
|
-
|
|
235
232
|
//start external integration
|
|
236
233
|
this.emit('externalIntegration');
|
|
237
234
|
|
|
@@ -241,10 +238,9 @@ class DENON extends EventEmitter {
|
|
|
241
238
|
return true;
|
|
242
239
|
} catch (error) {
|
|
243
240
|
if (this.disableLogConnectError) {
|
|
244
|
-
return
|
|
241
|
+
return;
|
|
245
242
|
};
|
|
246
|
-
|
|
247
|
-
throw new Error(`Connect error: ${error.message || error}, check again in 15s.`);
|
|
243
|
+
throw new Error(`Connect error: ${error.message || error}.`);
|
|
248
244
|
|
|
249
245
|
};
|
|
250
246
|
};
|
|
@@ -323,9 +319,8 @@ class DENON extends EventEmitter {
|
|
|
323
319
|
return true;
|
|
324
320
|
} catch (error) {
|
|
325
321
|
if (this.disableLogConnectError) {
|
|
326
|
-
return
|
|
322
|
+
return;
|
|
327
323
|
};
|
|
328
|
-
await this.impulseGenerator.stop();
|
|
329
324
|
throw new Error(`Check state error: ${error.message || error}.`);
|
|
330
325
|
};
|
|
331
326
|
};
|
package/src/mainzone.js
CHANGED
|
@@ -365,9 +365,6 @@ class MainZone extends EventEmitter {
|
|
|
365
365
|
.on('error', async (error) => {
|
|
366
366
|
this.emit('error', error);
|
|
367
367
|
})
|
|
368
|
-
.on('disconnected', (message) => {
|
|
369
|
-
this.emit('message', message);
|
|
370
|
-
})
|
|
371
368
|
.on('restFul', (path, data) => {
|
|
372
369
|
const restFul = this.restFulConnected ? this.restFul1.update(path, data) : false;
|
|
373
370
|
})
|
|
@@ -384,8 +381,7 @@ class MainZone extends EventEmitter {
|
|
|
384
381
|
|
|
385
382
|
return true;
|
|
386
383
|
} catch (error) {
|
|
387
|
-
|
|
388
|
-
throw new Error(`Start error: ${error.message || error}, check again in 15s.`);
|
|
384
|
+
throw new Error(`Start error: ${error.message || error}.`);
|
|
389
385
|
};
|
|
390
386
|
};
|
|
391
387
|
|
package/src/surround.js
CHANGED
|
@@ -337,9 +337,6 @@ class Surround extends EventEmitter {
|
|
|
337
337
|
.on('error', async (error) => {
|
|
338
338
|
this.emit('error', error);
|
|
339
339
|
})
|
|
340
|
-
.on('disconnected', (message) => {
|
|
341
|
-
this.emit('message', message);
|
|
342
|
-
})
|
|
343
340
|
.on('restFul', (path, data) => {
|
|
344
341
|
const restFul = this.restFulConnected ? this.restFul1.update(path, data) : false;
|
|
345
342
|
})
|
|
@@ -356,8 +353,7 @@ class Surround extends EventEmitter {
|
|
|
356
353
|
|
|
357
354
|
return true;
|
|
358
355
|
} catch (error) {
|
|
359
|
-
|
|
360
|
-
throw new Error(`Start error: ${error.message || error}, check again in 15s.`);
|
|
356
|
+
throw new Error(`Start error: ${error.message || error}.`);
|
|
361
357
|
};
|
|
362
358
|
};
|
|
363
359
|
|
package/src/zone2.js
CHANGED
|
@@ -367,9 +367,6 @@ class Zone2 extends EventEmitter {
|
|
|
367
367
|
.on('error', async (error) => {
|
|
368
368
|
this.emit('error', error);
|
|
369
369
|
})
|
|
370
|
-
.on('disconnected', (message) => {
|
|
371
|
-
this.emit('message', message);
|
|
372
|
-
})
|
|
373
370
|
.on('restFul', (path, data) => {
|
|
374
371
|
const restFul = this.restFulConnected ? this.restFul1.update(path, data) : false;
|
|
375
372
|
})
|
|
@@ -386,8 +383,7 @@ class Zone2 extends EventEmitter {
|
|
|
386
383
|
|
|
387
384
|
return true;
|
|
388
385
|
} catch (error) {
|
|
389
|
-
|
|
390
|
-
throw new Error(`Start error: ${error.message || error}, check again in 15s.`);
|
|
386
|
+
throw new Error(`Start error: ${error.message || error}.`);
|
|
391
387
|
};
|
|
392
388
|
};
|
|
393
389
|
|
package/src/zone3.js
CHANGED
|
@@ -367,9 +367,6 @@ class Zone3 extends EventEmitter {
|
|
|
367
367
|
.on('error', async (error) => {
|
|
368
368
|
this.emit('error', error);
|
|
369
369
|
})
|
|
370
|
-
.on('disconnected', (message) => {
|
|
371
|
-
this.emit('message', message);
|
|
372
|
-
})
|
|
373
370
|
.on('restFul', (path, data) => {
|
|
374
371
|
const restFul = this.restFulConnected ? this.restFul1.update(path, data) : false;
|
|
375
372
|
})
|
|
@@ -386,8 +383,7 @@ class Zone3 extends EventEmitter {
|
|
|
386
383
|
|
|
387
384
|
return true;
|
|
388
385
|
} catch (error) {
|
|
389
|
-
|
|
390
|
-
throw new Error(`Start error: ${error.message || error}, check again in 15s.`);
|
|
386
|
+
throw new Error(`Start error: ${error.message || error}.`);
|
|
391
387
|
};
|
|
392
388
|
};
|
|
393
389
|
|