homebridge-denon-tv 4.3.7-beta.2 → 4.3.8

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
@@ -101,11 +101,12 @@ Tested with Denon AVR-X6300H, Denon AVR-X2700H, Denon AVR-3311CI, Marantz SR8012
101
101
  | `restFulPort` | Here set the listening `Port` for RESTful server, every zone need own port. |
102
102
  | `restFulDebug` | If enabled, deep log will be present in homebridge console for RESTFul server. |
103
103
  | `enableMqtt` | If enabled, MQTT Broker will start automatically and publish all awailable PV installation data. |
104
- | `mqttDebug` | If enabled, deep log will be present in homebridge console for MQTT. |
105
- | `mqttHost` | Here set the *IP Address* or *Hostname* for MQTT Broker. |
106
- | `mqttPort` | Here set the *Port* for MQTT Broker, default 1883. |
107
- | `mqttPrefix` | Here set the *Prefix* for *Topic* or leave empty. |
104
+ | `mqttHost` | Here set the `IP Address` or `Hostname` for MQTT Broker. |
105
+ | `mqttPort` | Here set the `Port` for MQTT Broker, default 1883. |
106
+ | `mqttClientId` | Here optional set the `Client Id` of MQTT Broker. |
107
+ | `mqttPrefix` | Here set the `Prefix` for `Topic` or leave empty. |
108
108
  | `mqttAuth` | If enabled, MQTT Broker will use authorization credentials. |
109
109
  | `mqttUser` | Here set the MQTT Broker user. |
110
110
  | `mqttPasswd` | Here set the MQTT Broker password. |
111
+ | `mqttDebug` | If enabled, deep log will be present in homebridge console for MQTT. |
111
112
  | `AV Surround Mode` | This extra Accessory will control all functions of Main Zone except (Inputs). |
@@ -4669,6 +4669,16 @@
4669
4669
  "functionBody": "return model.devices[arrayIndices].enableMqtt === true;"
4670
4670
  }
4671
4671
  },
4672
+ "mqttClientId": {
4673
+ "title": "Client ID",
4674
+ "type": "string",
4675
+ "placeholder": "client id",
4676
+ "required": false,
4677
+ "description": "Here optional set the Client ID of MQTT Broker.",
4678
+ "condition": {
4679
+ "functionBody": "return model.devices[arrayIndices].enableMqtt === true"
4680
+ }
4681
+ },
4672
4682
  "mqttPrefix": {
4673
4683
  "title": "Prefix",
4674
4684
  "type": "string",
@@ -4852,44 +4862,41 @@
4852
4862
  "devices[].disableLogDeviceInfo",
4853
4863
  "devices[].disableLogConnectError"
4854
4864
  ]
4855
- }
4856
- ]
4857
- }
4858
- ]
4859
- },
4860
- {
4861
- "key": "devices[]",
4862
- "type": "section",
4863
- "title": "External Integrations",
4864
- "expandable": true,
4865
- "expanded": false,
4866
- "items": [
4867
- {
4868
- "key": "devices[]",
4869
- "type": "tabarray",
4870
- "title": "{{ value.title }}",
4871
- "items": [
4872
- {
4873
- "key": "devices[]",
4874
- "title": "RESTFul",
4875
- "items": [
4876
- "devices[].enableRestFul",
4877
- "devices[].restFulDebug",
4878
- "devices[].restFulPort"
4879
- ]
4880
4865
  },
4881
4866
  {
4882
4867
  "key": "devices[]",
4883
- "title": "MQTT",
4868
+ "title": "External Integrations",
4884
4869
  "items": [
4885
- "devices[].enableMqtt",
4886
- "devices[].mqttDebug",
4887
- "devices[].mqttHost",
4888
- "devices[].mqttPort",
4889
- "devices[].mqttPrefix",
4890
- "devices[].mqttAuth",
4891
- "devices[].mqttUser",
4892
- "devices[].mqttPasswd"
4870
+ {
4871
+ "key": "devices[]",
4872
+ "type": "tabarray",
4873
+ "title": "{{ value.title }}",
4874
+ "items": [
4875
+ {
4876
+ "key": "devices[]",
4877
+ "title": "RESTFul",
4878
+ "items": [
4879
+ "devices[].enableRestFul",
4880
+ "devices[].restFulDebug",
4881
+ "devices[].restFulPort"
4882
+ ]
4883
+ },
4884
+ {
4885
+ "key": "devices[]",
4886
+ "title": "MQTT",
4887
+ "items": [
4888
+ "devices[].enableMqtt",
4889
+ "devices[].mqttDebug",
4890
+ "devices[].mqttHost",
4891
+ "devices[].mqttPort",
4892
+ "devices[].mqttPrefix",
4893
+ "devices[].mqttAuth",
4894
+ "devices[].mqttUser",
4895
+ "devices[].mqttPasswd"
4896
+ ]
4897
+ }
4898
+ ]
4899
+ }
4893
4900
  ]
4894
4901
  }
4895
4902
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "displayName": "Denon TV",
3
3
  "name": "homebridge-denon-tv",
4
- "version": "4.3.7-beta.2",
4
+ "version": "4.3.8",
5
5
  "description": "Homebridge plugin (https://github.com/homebridge/homebridge) to control Denon/Marantz AV Receivers.",
6
6
  "license": "MIT",
7
7
  "author": "grzegorz914",
@@ -49,13 +49,14 @@ class DenonDevice extends EventEmitter {
49
49
  this.restFulPort = config.restFulPort || 3000;
50
50
  this.restFulDebug = config.restFulDebug || false;
51
51
  this.mqttEnabled = config.enableMqtt || false;
52
- this.mqttDebug = config.mqttDebug || false;
53
52
  this.mqttHost = config.mqttHost;
54
53
  this.mqttPort = config.mqttPort || 1883;
54
+ this.mqttClientId = config.mqttClientId || `mqtt_${Math.random().toString(16).slice(3)}`;
55
55
  this.mqttPrefix = config.mqttPrefix;
56
56
  this.mqttAuth = config.mqttAuth || false;
57
57
  this.mqttUser = config.mqttUser;
58
58
  this.mqttPasswd = config.mqttPasswd;
59
+ this.mqttDebug = config.mqttDebug || false;
59
60
 
60
61
  //zones
61
62
  this.zoneName = CONSTANS.ZoneName[this.zoneControl];
@@ -118,10 +119,10 @@ class DenonDevice extends EventEmitter {
118
119
  this.mqtt = new Mqtt({
119
120
  host: this.mqttHost,
120
121
  port: this.mqttPort,
121
- prefix: `${this.mqttPrefix}/${this.name}`,
122
- auth: this.mqttAuth,
122
+ clientId: this.mqttClientId,
123
123
  user: this.mqttUser,
124
124
  passwd: this.mqttPasswd,
125
+ prefix: `${this.mqttPrefix}/${this.name}`,
125
126
  debug: this.mqttDebug
126
127
  });
127
128
 
@@ -502,6 +503,10 @@ class DenonDevice extends EventEmitter {
502
503
  const zone = [inputMode, 'Z2', 'Z3', inputMode][zoneControl];
503
504
  const reference = zone + inputReference;
504
505
 
506
+ if (!this.power) {
507
+ await new Promise(resolve => setTimeout(resolve, 3000));
508
+ }
509
+
505
510
  await this.denon.send(reference);
506
511
  const info = this.disableLogInfo ? false : this.emit('message', `set ${this.inputSurround} Name: ${inputName}, Reference: ${inputReference}`);
507
512
  } catch (error) {
package/src/mqtt.js CHANGED
@@ -7,10 +7,10 @@ class MQTTCLIENT extends EventEmitter {
7
7
  super();
8
8
  this.mqttHost = config.host;
9
9
  this.mqttPort = config.port;
10
- this.mqttPrefix = config.prefix;
11
- this.mqttAuth = config.auth;
10
+ this.mqttClientId = config.clientId;
12
11
  this.mqttUser = config.user;
13
12
  this.mqttPasswd = config.passwd;
13
+ this.mqttPrefix = config.prefix;
14
14
  this.mqttDebug = config.debug;
15
15
  this.isConnected = false;
16
16
 
@@ -20,6 +20,7 @@ class MQTTCLIENT extends EventEmitter {
20
20
  async connect() {
21
21
  try {
22
22
  const options = {
23
+ clientId: this.mqttClientId,
23
24
  username: this.mqttUser,
24
25
  password: this.mqttPasswd
25
26
  }