homebridge-denon-tv 3.17.13 → 3.17.15

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/README.md CHANGED
@@ -1,12 +1,15 @@
1
1
  <p align="center">
2
- <a href="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/master/homebridge-denon-tv.png" width="540"></a>
2
+ <a href="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/main/homebridge-denon-tv.png" width="540"></a>
3
3
  </p>
4
4
 
5
5
  <span align="center">
6
6
 
7
7
  # Homebridge Denon TV
8
8
  [![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
9
- [![npm](https://badgen.net/npm/dt/homebridge-denon-tv?color=purple)](https://www.npmjs.com/package/homebridge-denon-tv) [![npm](https://badgen.net/npm/v/homebridge-denon-tv?color=purple)](https://www.npmjs.com/package/homebridge-denon-tv) [![GitHub pull requests](https://img.shields.io/github/issues-pr/grzegorz914/homebridge-denon-tv.svg)](https://github.com/grzegorz914/homebridge-denon-tv/pulls)
9
+ [![npm](https://badgen.net/npm/dt/homebridge-denon-tv?color=purple)](https://www.npmjs.com/package/homebridge-denon-tv)
10
+ [![npm](https://badgen.net/npm/v/homebridge-denon-tv?color=purple)](https://www.npmjs.com/package/homebridge-denon-tv)
11
+ [![npm](https://img.shields.io/npm/v/homebridge-denon-tv/beta.svg?style=flat-square)](https://www.npmjs.com/package/homebridge-denon-tv)
12
+ [![GitHub pull requests](https://img.shields.io/github/issues-pr/grzegorz914/homebridge-denon-tv.svg)](https://github.com/grzegorz914/homebridge-denon-tv/pulls)
10
13
  [![GitHub issues](https://img.shields.io/github/issues/grzegorz914/homebridge-denon-tv.svg)](https://github.com/grzegorz914/homebridge-denon-tv/issues)
11
14
 
12
15
  Homebridge plugin for Denon/Marantz AV Receivers series X/SR.
@@ -29,7 +32,7 @@ This plugin is based upon the official documentation for communicating with and
29
32
 
30
33
  ## Troubleshooting
31
34
  * If for some reason the device is not displayed in HomeKit app try this procedure:
32
- * Go to `./homebridge/persist`.
35
+ * Go to `./homebridge/persist` macOS or `/var/lib/homebridge/persist` for RPI.
33
36
  * Remove `AccessoryInfo.xxx` file which contain Your device data: `{"displayName":"AV Receiver"}`.
34
37
  * Next remove `IdentifierCashe.xxx` file with same name as `AccessoryInfo.xxx`.
35
38
  * Restart Homebridge and try add it to the HomeKit app again.
@@ -48,16 +51,18 @@ This plugin is based upon the official documentation for communicating with and
48
51
  * MQTT Client publisch all available data from device.
49
52
 
50
53
  <p align="left">
51
- <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/master/graphics/homekit.png" width="382"></a>
52
- <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/master/graphics/inputs.png" width="135"></a> <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/master/graphics/rc1.png" width="135"></a>
53
- <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/master/graphics/RC.png" width="135"></a>
54
+ <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/main/graphics/homekit.png" width="382"></a>
55
+ <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/main/graphics/inputs.png" width="135"></a> <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/main/graphics/rc1.png" width="135"></a>
56
+ <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/main/graphics/RC.png" width="135"></a>
54
57
  </p>
55
58
 
56
- ## Configuration
57
- Install and use [Homebridge Config UI X](https://github.com/oznu/homebridge-config-ui-x/wiki) plugin to configure this plugin (Highly Recommended). The sample configuration can be edited and used manually as an alternative. See the `sample-config.json` file in this repository for an example or copy the example below into your config.json file, making the apporpriate changes before saving it. Be sure to always make a backup copy of your config.json file before making any changes to it.
59
+ ### Configuration
60
+ * Run this plugin as a child bridge (Highly Recommended).
61
+ * Install and use [Homebridge Config UI X](https://github.com/oznu/homebridge-config-ui-x/wiki) to configure this plugin (Highly Recommended).
62
+ * The sample configuration can be edited and used manually as an alternative. See the `sample-config.json` file in this repository for an example or copy the example below into your config.json file, making the apporpriate changes before saving it. Be sure to always make a backup copy of your config.json file before making any changes to it.
58
63
 
59
64
  <p align="left">
60
- <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/master/graphics/ustawienia.png" width="840"></a>
65
+ <a href="https://github.com/grzegorz914/homebridge-denon-tv"><img src="https://raw.githubusercontent.com/grzegorz914/homebridge-denon-tv/main/graphics/ustawienia.png" width="840"></a>
61
66
  </p>
62
67
 
63
68
  | Key | Description |
@@ -282,14 +287,15 @@ Install and use [Homebridge Config UI X](https://github.com/oznu/homebridge-conf
282
287
  }
283
288
  ```
284
289
 
285
- ## Adding to HomeKit
286
- Each accessory needs to be manually paired.
287
- 1. Open the Home <img src='https://user-images.githubusercontent.com/3979615/78010622-4ea1d380-738e-11ea-8a17-e6a465eeec35.png' width='16.42px'> app on your device.
288
- 2. Tap the <img src='https://user-images.githubusercontent.com/3979615/78010869-9aed1380-738e-11ea-9644-9f46b3633026.png' width='16.42px'>.
289
- 3. Tap *Add Accessory*, and select *I Don't Have a Code or Cannot Scan* or *More Options*.
290
- 4. Select Your accessory.
291
- 5. Enter the Homebridge PIN or scan the QR code, this can be found in Homebridge UI or Homebridge logs.
292
- 6. Complete the accessory setup.
290
+ ### Adding to HomeKit
291
+ * Each accessory needs to be manually paired.
292
+ * Open the Home <img src='https://user-images.githubusercontent.com/3979615/78010622-4ea1d380-738e-11ea-8a17-e6a465eeec35.png' width='16.42px'> app on your device.
293
+ * Tap the Home tab, then tap <img src='https://user-images.githubusercontent.com/3979615/78010869-9aed1380-738e-11ea-9644-9f46b3633026.png' width='16.42px'>.
294
+ * Tap *Add Accessory*, and select *I Don't Have a Code, Cannot Scan* or *More options*.
295
+ * Select Your accessory and press add anyway.
296
+ * Enter the PIN or scan the QR code, this can be found in Homebridge UI or Homebridge logs.
297
+ * Complete the accessory setup.
298
+
293
299
  ## Limitations
294
300
  * That maximum Services for 1 accessory is 100. If Services > 100, accessory stop responding.
295
301
  * To solve this problem the plugin counts the number of Services and not allow add more as 100.
@@ -303,7 +309,7 @@ Each accessory needs to be manually paired.
303
309
  * Inputs, which may range from 6 to 100 as each input is 1 service.
304
310
  * Buttons, which may range from 6 to 100 as each button is 1 service.
305
311
 
306
- ## [What's New](https://github.com/grzegorz914/homebridge-denon-tv/blob/master/CHANGELOG.md)
312
+ ## [What's New](https://github.com/grzegorz914/homebridge-denon-tv/blob/main/CHANGELOG.md)
307
313
 
308
314
  ## Development
309
315
  Please feel free to create a Pull request and help in development. It will be highly appreciated.
@@ -2,7 +2,7 @@
2
2
  "pluginAlias": "DenonTv",
3
3
  "pluginType": "platform",
4
4
  "singular": true,
5
- "headerDisplay": "This plugin works with Denon/Marantz AV Receivers and each needs to be manually paired.\n\n1. Open the Home <img src='https://user-images.githubusercontent.com/3979615/78010622-4ea1d380-738e-11ea-8a17-e6a465eeec35.png' height='16.42px'> app on your device.\n2. Tap the <img src='https://user-images.githubusercontent.com/3979615/78010869-9aed1380-738e-11ea-9644-9f46b3633026.png' height='16.42px'>.\n3. Tap *Add Accessory*, and select *I Don't Have a Code or Cannot Scan* or *More Options*.\n4. Select Your accessory.\n5. Enter the Homebridge PIN or scan the QR code, this can be found in Homebridge UI or Homebridge logs.\n6. Complete the accessory setup.",
5
+ "headerDisplay": "This plugin works with Denon/Marantz AV Receivers. Devices are exposed to HomeKit as separate accessories and each needs to be manually paired.\n\n1. Open the Home <img src='https://user-images.githubusercontent.com/3979615/78010622-4ea1d380-738e-11ea-8a17-e6a465eeec35.png' height='16.42px'> app on your device.\n2. Tap the <img src='https://user-images.githubusercontent.com/3979615/78010869-9aed1380-738e-11ea-9644-9f46b3633026.png' height='16.42px'>.\n3. Tap *Add Accessory*, and select *I Don't Have a Code or Cannot Scan* or *More Options*.\n4. Select Your accessory and press add anyway.\n5. Enter the PIN or scan the QR code, this can be found in Homebridge UI or Homebridge logs.\n6. Complete the accessory setup.",
6
6
  "footerDisplay": "For documentation please see [GitHub repository](https://github.com/grzegorz914/homebridge-denon-tv).",
7
7
  "schema": {
8
8
  "type": "object",
package/index.js CHANGED
@@ -29,7 +29,7 @@ class denonTvPlatform {
29
29
  constructor(log, config, api) {
30
30
  // only load if configured
31
31
  if (!config || !Array.isArray(config.devices)) {
32
- log('No configuration found for %s', PLUGIN_NAME);
32
+ log(`No configuration found for ${PLUGIN_NAME}`);
33
33
  return;
34
34
  }
35
35
  this.log = log;
@@ -740,8 +740,7 @@ class denonTvDevice {
740
740
  newName[nameIdentifier] = name;
741
741
  const newCustomName = JSON.stringify(newName, null, 2);
742
742
  try {
743
- const writeNewCustomName = (nameIdentifier != false) ? await fsPromises.writeFile(this.inputsNamesFile, newCustomName) : false;
744
- const debug = this.enableDebugMode ? this.log('Device: %s %s, saved new Input successful, savedInputsNames: %s', this.host, accessoryName, newCustomName) : false;
743
+ const writeNewCustomName = nameIdentifier ? await fsPromises.writeFile(this.inputsNamesFile, newCustomName) : false;
745
744
  const logInfo = this.disableLogInfo ? false : this.log('Device: %s %s, new %s name saved successful, name: %s, reference: %s', this.host, accessoryName, this.zoneControl <= 2 ? 'Input' : 'Sound Mode', name, inputReference);
746
745
  } catch (error) {
747
746
  this.log.error('Device: %s %s, new %s name saved failed, Error: %s', this.host, accessoryName, this.zoneControl <= 2 ? 'Input' : 'Sound Mode', error);
@@ -756,8 +755,7 @@ class denonTvDevice {
756
755
  newState[targetVisibilityIdentifier] = state;
757
756
  const newTargetVisibility = JSON.stringify(newState, null, 2);
758
757
  try {
759
- const writeNewTargetVisibility = (targetVisibilityIdentifier != false) ? await fsPromises.writeFile(this.inputsTargetVisibilityFile, newTargetVisibility) : false;
760
- const debug = this.enableDebugMode ? this.log('Device: %s %s, %s: %s, saved Target Visibility state: %s', this.host, accessoryName, this.zoneControl <= 2 ? 'Input' : 'Sound Mode', inputName, newTargetVisibility) : false;
758
+ const writeNewTargetVisibility = targetVisibilityIdentifier ? await fsPromises.writeFile(this.inputsTargetVisibilityFile, newTargetVisibility) : false;
761
759
  const logInfo = this.disableLogInfo ? false : this.log('Device: %s %s, new %s Target Visibility saved successful, name: %s, state: %s', this.host, accessoryName, this.zoneControl <= 2 ? 'Input' : 'Sound Mode', inputName, state ? 'HIDEN' : 'SHOWN');
762
760
  inputService.setCharacteristic(Characteristic.CurrentVisibilityState, state);
763
761
  } catch (error) {
@@ -878,8 +876,8 @@ class denonTvDevice {
878
876
  }
879
877
  }
880
878
 
881
- this.startPrepareAccessory = false;
882
- const debug3 = this.enableDebugMode ? this.log('Device: %s %s, publishExternalAccessory.', this.host, accessoryName) : false;
883
879
  this.api.publishExternalAccessories(PLUGIN_NAME, [accessory]);
880
+ const debug3 = this.enableDebugMode ? this.log(`Device: ${ this.host} ${accessoryName}, published as external accessory.`) : false;
881
+ this.startPrepareAccessory = false;
884
882
  }
885
883
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Denon TV",
3
3
  "name": "homebridge-denon-tv",
4
- "version": "3.17.13",
4
+ "version": "3.17.15",
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,14 +55,17 @@ class DENON extends EventEmitter {
55
55
  this.firstRun = true;
56
56
  this.checkStateOnFirstRun = true;
57
57
  this.emit('connected', 'Connected.');
58
- this.checkState();
58
+
59
+ setTimeout(() => {
60
+ this.emit('checkState');
61
+ }, 1500)
59
62
  })
60
63
  .on('checkDeviceInfo', async () => {
61
64
  try {
62
65
  const deviceInfo = await this.axiosInstance(API_URL.DeviceInfo);
63
66
  const parseDeviceInfo = await parseStringPromise(deviceInfo.data);
64
67
  const devInfo = JSON.stringify(parseDeviceInfo.Device_Info, null, 2);
65
- const debug = this.debugLog ? this.emit('debug', `Parse device info data: ${devInfo}`) : false;
68
+ const debug = this.debugLog ? this.emit('debug', `Parse info data: ${devInfo}`) : false;
66
69
  const writeDevInfo = (this.zoneControl == 0) ? await fsPromises.writeFile(this.devInfoFile, devInfo) : false;
67
70
  this.devInfo = devInfo;
68
71
 
@@ -80,11 +83,11 @@ class DENON extends EventEmitter {
80
83
  this.emit('connect');
81
84
  this.emit('deviceInfo', manufacturer, modelName, serialNumber, firmwareRevision, zones, apiVersion);
82
85
  } else {
83
- const debug1 = this.debugLog ? this.emit('debug', `Device serial number unknown: ${serialNumber}`) : false;
86
+ const debug1 = this.debugLog ? this.emit('debug', `Serial number unknown: ${serialNumber}`) : false;
84
87
  this.checkDeviceInfo();
85
88
  }
86
89
  } catch (error) {
87
- this.emit('error', `Device info error: ${error}`)
90
+ this.emit('error', `Info error: ${error}`)
88
91
  this.checkDeviceInfo();
89
92
  };
90
93
  })
@@ -120,16 +123,19 @@ class DENON extends EventEmitter {
120
123
  'surround': soundMode
121
124
  }
122
125
  const emitMgtt = checkSoundMode ? this.emit('mqtt', 'Sound Mode', JSON.stringify(surroundMode, null, 2)) : false;
123
- this.checkState();
126
+
127
+ setTimeout(() => {
128
+ this.emit('checkState');
129
+ }, 1500)
124
130
  } catch (error) {
125
- this.emit('error', `Device state error: ${error}`);
131
+ this.emit('error', `State error: ${error}`);
126
132
  const firstRun = this.checkStateOnFirstRun ? this.checkDeviceInfo() : this.emit('disconnect');
127
133
  };
128
134
  })
129
135
  .on('disconnect', () => {
130
136
  if (this.firstRun) {
131
137
  this.firstRun = false;
132
- this.emit('disconnected', 'Disconnected, trying to reconnect.');
138
+ this.emit('disconnected', 'Disconnected.');
133
139
  };
134
140
 
135
141
  this.emit('stateChanged', false, this.reference, this.volume, true, this.soundMode);
@@ -139,13 +145,8 @@ class DENON extends EventEmitter {
139
145
  this.emit('checkDeviceInfo');
140
146
  };
141
147
 
142
- checkState() {
143
- setTimeout(() => {
144
- this.emit('checkState');
145
- }, 1500)
146
- };
147
-
148
148
  checkDeviceInfo() {
149
+ this.emit('debug', 'Reconnect in 10s.');
149
150
  setTimeout(() => {
150
151
  this.emit('checkDeviceInfo');
151
152
  }, 10000);