homebridge-denon-tv 4.0.0-beta.21 → 4.0.0-beta.22
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/denon.js +44 -34
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "Denon TV",
|
|
3
3
|
"name": "homebridge-denon-tv",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.22",
|
|
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/denon.js
CHANGED
|
@@ -55,58 +55,68 @@ class DENON extends EventEmitter {
|
|
|
55
55
|
const firmwareRevision = deviceInfoArray.includes('UpgradeVersion') ? devInfo.UpgradeVersion[0] : '00';
|
|
56
56
|
const zones = deviceInfoArray.includes('DeviceZones') ? devInfo.DeviceZones[0] : '0';
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.checkDeviceInfo();
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
58
|
+
//device capabilities
|
|
59
|
+
const capabilitiesSupport = deviceInfoArray.includes('DeviceCapabilities');
|
|
63
60
|
|
|
64
|
-
//
|
|
65
|
-
const
|
|
66
|
-
const
|
|
61
|
+
//setup
|
|
62
|
+
const capabilitiesSetupArray = capabilitiesSupport ? Object.keys(devInfo.DeviceCapabilities[0].Setup[0]) : [];
|
|
63
|
+
const capabilitiesSetupSupport = capabilitiesSetupArray.includes('Setup');
|
|
64
|
+
const capabilitiesSetup = capabilitiesSetupSupport ? devInfo.DeviceCapabilities[0].Setup[0] : [];
|
|
67
65
|
this.supportTone = capabilitiesSetupArray.includes('ToneControl') ? capabilitiesSetup.ToneControl[0].Control[0] === '1' : false;
|
|
68
66
|
this.supportSubwooferLevel = capabilitiesSetupArray.includes('SubwooferLevel') ? capabilitiesSetup.SubwooferLevel[0].Control[0] === '1' : false;
|
|
69
67
|
this.supportChannelLevel = capabilitiesSetupArray.includes('ChannelLevel') ? capabilitiesSetup.ChannelLevel[0].Control[0] === '1' : false;
|
|
70
68
|
this.supportAllZoneStereo = capabilitiesSetupArray.includes('AllZoneStereo') ? capabilitiesSetup.AllZoneStereo[0].Control[0] === '1' : false;
|
|
71
69
|
this.supportPictureMode = capabilitiesSetupArray.includes('PictureMode') ? capabilitiesSetup.PictureMode[0].Control[0] === '1' : false;
|
|
72
|
-
this.supportSoundMode = capabilitiesSetupArray.includes('SoundMode') ? capabilitiesSetup.SoundMode[0].Control[0] === '1' : false
|
|
70
|
+
this.supportSoundMode = capabilitiesSetupArray.includes('SoundMode') ? capabilitiesSetup.SoundMode[0].Control[0] === '1' : false
|
|
73
71
|
|
|
74
72
|
//operation
|
|
75
|
-
const
|
|
76
|
-
const
|
|
73
|
+
const capabilitiesOperatonArray = capabilitiesSupport ? Object.keys(devInfo.DeviceCapabilities[0].Operation[0]) : [];
|
|
74
|
+
const capabilitiesOperationSupport = capabilitiesOperatonArray.includes('Operation');
|
|
75
|
+
const capabilitiesOperaton = capabilitiesOperationSupport ? devInfo.DeviceCapabilities[0].Operation[0] : [];
|
|
77
76
|
this.supportClock = capabilitiesOperatonArray.includes('Clock') ? capabilitiesOperaton.Clock[0].Control[0] === '1' : false;
|
|
78
77
|
this.supportAllZonePower = capabilitiesOperatonArray.includes('AllZonePower') ? capabilitiesOperaton.AllZonePower[0].Control[0] === '1' : false;
|
|
79
78
|
this.supportAllZoneMute = capabilitiesOperatonArray.includes('AllZoneMute') ? capabilitiesOperaton.AllZoneMute[0].Control[0] === '1' : false;
|
|
80
79
|
this.supportFavorite = capabilitiesOperatonArray.includes('Favorites') ? capabilitiesOperaton.Favorites[0].Control[0] === '1' : false;
|
|
81
80
|
this.supportFavoriteStation = capabilitiesOperatonArray.includes('FavoriteStation') ? capabilitiesOperaton.Operation[0].FavoriteStation[0].Control[0] === '1' : false;
|
|
82
81
|
|
|
83
|
-
//zone capabilities
|
|
82
|
+
//device zone capabilities
|
|
84
83
|
const checkZone = zoneControl <= 2 ? true : false;
|
|
85
|
-
const
|
|
86
|
-
const zoneCapabilitiesArray =
|
|
87
|
-
this.
|
|
88
|
-
this.supportPower =
|
|
89
|
-
this.supportVolume =
|
|
90
|
-
this.supportMute =
|
|
91
|
-
this.supportInputSource =
|
|
92
|
-
|
|
84
|
+
const zoneCapabilitiesSupport = checkZone ? deviceInfoArray.includes('DeviceZoneCapabilities') : false;
|
|
85
|
+
const zoneCapabilitiesArray = zoneCapabilitiesSupport ? Object.keys(devInfo.DeviceZoneCapabilities[zoneControl]) : [];
|
|
86
|
+
this.supportShortcutControl = zoneCapabilitiesArray.includes('ShortcutControl') ? devInfo.DeviceZoneCapabilities[zoneControl].ShortcutControl[0].Control[0] === '1' : false;
|
|
87
|
+
this.supportPower = zoneCapabilitiesArray.includes('Power') ? devInfo.DeviceZoneCapabilities[zoneControl].Power[0].Control[0] === '1' : false;
|
|
88
|
+
this.supportVolume = zoneCapabilitiesArray.includes('Volume') ? devInfo.DeviceZoneCapabilities[zoneControl].Volume[0].Control[0] === '1' : false;
|
|
89
|
+
this.supportMute = zoneCapabilitiesArray.includes('Mute') ? devInfo.DeviceZoneCapabilities[zoneControl].Mute[0].Control[0] === '1' : false;
|
|
90
|
+
this.supportInputSource = zoneCapabilitiesArray.includes('InputSource') ? devInfo.DeviceZoneCapabilities[zoneControl].InputSource[0].Control[0] === '1' : false;
|
|
91
|
+
|
|
92
|
+
//surround mode Marantz M-CR611
|
|
93
|
+
this.supportSurroundMode = zoneCapabilitiesArray.includes('SurroundMode') ? devInfo.DeviceZoneCapabilities[zoneControl].SurroundMode[0].Control[0] === '1' : false;
|
|
93
94
|
|
|
94
95
|
//setup
|
|
95
|
-
const
|
|
96
|
+
const zoneCapabilitiesSetupSupport = zoneCapabilitiesArray.includes('Setup');
|
|
97
|
+
const zonesCapabilitiesSetupArray = zoneCapabilitiesSetupSupport ? Object.keys(devInfo.DeviceZoneCapabilities[zoneControl].Setup[0]) : [];
|
|
98
|
+
|
|
96
99
|
//operation
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const netUsbArray = netUsbSupport ? Object.keys(
|
|
103
|
-
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
106
|
-
this.supportInternet =
|
|
107
|
-
this.supportInternet =
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
100
|
+
const zoneCapabilitiesOperationSupport = zoneCapabilitiesArray.includes('Operation');
|
|
101
|
+
const zonesCapabilitiesOperationArray = zoneCapabilitiesOperationSupport ? Object.keys(devInfo.DeviceZoneCapabilities[zoneControl].Operation[0]) : [];
|
|
102
|
+
|
|
103
|
+
//net usb Marantz M-CR611
|
|
104
|
+
const netUsbSupport = zoneCapabilitiesArray.includes('NetUsb');
|
|
105
|
+
const netUsbArray = netUsbSupport ? Object.keys(devInfo.DeviceZoneCapabilities[zoneControl].NetUsb[0]) : [];
|
|
106
|
+
const netUsb = netUsbSupport ? devInfo.DeviceZoneCapabilities[zoneControl].NetUsb[0] : [];
|
|
107
|
+
this.supportInternetRadio = netUsbArray.includes('InternetRadio') ? netUsb.InternetRadio[0].Control[0] === '1' : false;
|
|
108
|
+
this.supportMediaServer = netUsbArray.includes('MediaServer') ? netUsb.MediaServer[0].Control[0] === '1' : false;
|
|
109
|
+
this.supportInternet = netUsbArray.includes('iPod') ? netUsb.iPod[0].Control[0] === '1' : false;
|
|
110
|
+
this.supportInternet = netUsbArray.includes('USB') ? netUsb.USB[0].Control[0] === '1' : false;
|
|
111
|
+
this.supportInternet = netUsbArray.includes('USB2') ? netUsb.USB2[0].Control[0] === '1' : false;
|
|
112
|
+
this.supportIpodPlayer = netUsbArray.includes('iPodPlayer') ? netUsb.iPodPlayer[0].Control[0] === '1' : false;
|
|
113
|
+
this.supportSpotifyConnect = netUsbArray.includes('iPodPlayer') ? netUsb.SpotifyConnect[0].Control[0] === '1' : false;
|
|
114
|
+
|
|
115
|
+
if (!serialNumber) {
|
|
116
|
+
const debug1 = debugLog ? this.emit('debug', `Missing Serial Number, reconnect in 15s.`) : false;
|
|
117
|
+
this.checkDeviceInfo();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
110
120
|
|
|
111
121
|
this.emit('deviceInfo', devInfo, manufacturer, modelName, serialNumber, firmwareRevision, zones, apiVersion, this.supportPictureMode, this.supportFavorite, this.supportShortcut, this.supportInputSource);
|
|
112
122
|
await new Promise(resolve => setTimeout(resolve, 2000));
|