homebridge-alexa 0.5.60-beta.2 → 0.5.60

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/CHANGELOG.md CHANGED
@@ -2,17 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).
4
4
 
5
- ## 0.5.60 (2021-01-17)
5
+ ## 0.5.59 (2022-03-21)
6
6
 
7
- ## [Version 0.5.60](https://github.com/northernman54/homebridge-alexa/compare/v0.5.55...v0.5.60)
7
+ ## [Version 0.5.56](https://github.com/northernman54/homebridge-alexa/compare/v0.5.56...v0.5.59)
8
8
 
9
9
  #### Changes
10
10
 
11
- - Enable the usage of websockets instead of mqtt, to provide improved connectivity in some setups
12
- - New configuration option `LegacyCloudTransport` which enables the mqtt transport
13
- - Removed the Alexa contact sensor ( which shows the status of the connection to the cloud servers ) from the list of devices passed to Alexa.
11
+ - Updates to README in regards to switch to subscription based model for the cloud services to support the services.
12
+ - Further fixes for #507/#508
14
13
 
15
- ## 0.5.54 (2021-01-03)
14
+ ## 0.5.56 (2022-03-21)
15
+
16
+ ## [Version 0.5.56](https://github.com/northernman54/homebridge-alexa/compare/v0.5.54...v0.5.56)
17
+
18
+ #### Changes
19
+
20
+ - Fix for #507
21
+
22
+ ## 0.5.54 (2022-01-03)
16
23
 
17
24
  ## [Version 0.5.54](https://github.com/northernman54/homebridge-alexa/compare/v0.5.52...v0.5.54)
18
25
 
package/README.md CHANGED
@@ -8,6 +8,24 @@
8
8
 
9
9
  Enable Amazon Alexa to control your homebridge smart home devices and accessories. Please note, that this does **NOT** bring Alexa enabled devices into homebridge. Full support for all Amazon Alexa devices, including the echo 2nd Generation and software based solutions. Uses an Amazon smart home skill based approach for integration between HomeBridge and Amazon Alexa.
10
10
 
11
+ # Note to users of the service
12
+
13
+ Everyone, as your probably aware I have been running this for a number of years as a free service, and with the growth in users of the service and the volume of transactions flowing thru the cloud components I need to change to a subscription based service to continue to offer the service in a sustainable manner.
14
+
15
+ The ongoing costs to run and support the cloud services have grown to the point where it is larger than pocket change, and rather than reducing functionality I have made the hard decision to switch to a subscription based model to continue to offer the current high levels of service.
16
+
17
+ For the subscription model, I have set this up with PayPal to start with, and with a price cheaper than a cup of Starbucks coffee. I thought a coffee a month was a reasonable contribution for the continued delivery of service.
18
+
19
+ For the migration of users to the new model I’m doing this in two phases, first being new users of the service and the second being existing or legacy users of the service.
20
+
21
+ For new users of the service, they will receive a trial account, with 7 days of service to test out the service and work thru any issues prior to a subscription being required to continue service. During the trial period users can apply for a subscription at any time, and it will be dated to start on the trial period end date.
22
+
23
+ For existing ‘legacy’ users of the service, over the next few months I’m going to start the migration of users to being subscription required. I will post further messages when this migration starts. For the migration of your account you will have approximately 30 days to complete the subscription enrolment before service will be discontinued. During the migration period users can apply for a subscription at any time, and it will be dated to start on the migration period end date.
24
+
25
+ If you have any questions or concerns, please let me know.
26
+
27
+ # Availability
28
+
11
29
  Country availability - The plugin is available in these countries, English (AU), German (DE), English (CA), English (US), French (FR), English (UK), Italian (IT), English (IN), Spanish (ES), Japanese (JP), Spanish(US), Portuguese (BR) and Spanish (MX).
12
30
 
13
31
  # Features
@@ -23,6 +41,8 @@ Country availability - The plugin is available in these countries, English (AU),
23
41
 
24
42
  # Table of Contents
25
43
  <!--ts-->
44
+ * [Note to users of the service](#note-to-users-of-the-service)
45
+ * [Availability](#availability)
26
46
  * [Features](#features)
27
47
  * [Table of Contents](#table-of-contents)
28
48
  * [Supported devices](#supported-devices)
@@ -66,12 +66,6 @@
66
66
  "minimum": 1,
67
67
  "maximum": 59
68
68
  },
69
- "LegacyCloudTransport": {
70
- "title": "Legacy Cloud Server Connection",
71
- "type": "boolean",
72
- "default": false,
73
- "description": "Enable Legacy Transport ( mqtt ) to Cloud Servers ( This is from version 0.5.55 or older )."
74
- },
75
69
  "filter": {
76
70
  "title": "Instance Filter",
77
71
  "type": "string",
@@ -79,12 +73,14 @@
79
73
  "description": "Limits accessories shared with Alexa to a single homebridge instance.",
80
74
  "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$"
81
75
  },
76
+
82
77
  "deviceListHandling": {
83
78
  "title": "How to handle devices in the deviceList",
84
79
  "type": "string",
85
80
  "required": true,
86
81
  "default": "allow",
87
- "oneOf": [{
82
+ "oneOf": [
83
+ {
88
84
  "title": "Allow devices",
89
85
  "enum": [
90
86
  "allow"
@@ -187,8 +183,7 @@
187
183
  "expandable": true,
188
184
  "expanded": false,
189
185
  "items": [
190
- "keepalive",
191
- "LegacyCloudTransport"
186
+ "keepalive"
192
187
  ]
193
188
  },
194
189
  {
@@ -197,29 +192,34 @@
197
192
  "description": "Devices to configure as speakers as HomeKit currently does not have a Speaker service.",
198
193
  "expandable": true,
199
194
  "expanded": false,
200
- "items": [{
201
- "notitle": true,
202
- "key": "speakers",
203
- "type": "array",
204
- "items": [{
205
- "type": "div",
206
- "displayFlex": true,
207
- "flex-direction": "row",
208
- "items": [{
209
- "key": "speakers[].manufacturer",
210
- "flex": "1 1 50px",
211
- "notitle": true,
212
- "placeholder": "Manufacturer"
213
- },
195
+ "items": [
196
+ {
197
+ "notitle": true,
198
+ "key": "speakers",
199
+ "type": "array",
200
+ "items": [
214
201
  {
215
- "key": "speakers[].name",
216
- "flex": "4 4 200px",
217
- "notitle": true,
218
- "placeholder": "Name"
202
+ "type": "div",
203
+ "displayFlex": true,
204
+ "flex-direction": "row",
205
+ "items": [
206
+ {
207
+ "key": "speakers[].manufacturer",
208
+ "flex": "1 1 50px",
209
+ "notitle": true,
210
+ "placeholder": "Manufacturer"
211
+ },
212
+ {
213
+ "key": "speakers[].name",
214
+ "flex": "4 4 200px",
215
+ "notitle": true,
216
+ "placeholder": "Name"
217
+ }
218
+ ]
219
219
  }
220
220
  ]
221
- }]
222
- }]
221
+ }
222
+ ]
223
223
  },
224
224
  {
225
225
  "type": "fieldset",
@@ -227,30 +227,37 @@
227
227
  "description": "Combine disparate accessories into one common device.",
228
228
  "expandable": true,
229
229
  "expanded": false,
230
- "items": [{
231
- "notitle": true,
232
- "key": "combine",
233
- "type": "array",
234
- "items": [{
235
- "type": "div",
236
- "items": [{
237
- "key": "combine[].into",
238
- "title": "Into",
239
- "placeholder": "Target Accessory Name"
240
- },
230
+ "items": [
231
+ {
232
+ "notitle": true,
233
+ "key": "combine",
234
+ "type": "array",
235
+ "items": [
241
236
  {
242
- "key": "combine[].from",
243
- "notitle": true,
244
- "items": [{
245
- "title": "From",
246
- "key": "combine[].from[]",
237
+ "type": "div",
238
+ "items": [
239
+ {
240
+ "key": "combine[].into",
241
+ "title": "Into",
242
+ "placeholder": "Target Accessory Name"
243
+ },
244
+ {
245
+ "key": "combine[].from",
246
+ "notitle": true,
247
+ "items": [
248
+ {
249
+ "title": "From",
250
+ "key": "combine[].from[]",
247
251
 
248
- "placeholder": "Source Accessory Name"
249
- }]
252
+ "placeholder": "Source Accessory Name"
253
+ }
254
+ ]
255
+ }
256
+ ]
250
257
  }
251
258
  ]
252
- }]
253
- }]
259
+ }
260
+ ]
254
261
  }
255
262
  ]
256
263
  }
@@ -36,7 +36,7 @@ function hapDiscovery(options) {
36
36
  alexaDiscovery.call(options, null, function() {
37
37
  // debug("Events", options);
38
38
  if (options.events) {
39
- registerEvents.call(options, messages.checkEventDeviceList.call(options, hbDevices.toEvents()));
39
+ registerEvents(messages.checkEventDeviceList.call(options, hbDevices.toEvents()));
40
40
  }
41
41
  });
42
42
  });
@@ -49,7 +49,7 @@ function hapDiscovery(options) {
49
49
  }
50
50
 
51
51
  function registerEvents(message) {
52
- // debug("registerEvents", message);
52
+ debug("registerEvents", message);
53
53
 
54
54
  var HBMessage = [];
55
55
 
@@ -73,12 +73,10 @@ function registerEvents(message) {
73
73
  };
74
74
  }
75
75
  }
76
-
77
- this.log("registerEvents - registered %s event sources", Object.keys(HBMessage).length);
78
76
  for (var register in HBMessage) {
79
77
  // console.log("send", instance, HBMessage[instance]);
80
78
  var hbInstance = JSON.parse(register);
81
- // debug("Event Register %s ->", hbInstance.deviceID, HBMessage[register]);
79
+ debug("Event Register %s ->", hbInstance.deviceID, HBMessage[register]);
82
80
  homebridge.HAPeventByDeviceID(hbInstance.deviceID, JSON.stringify(HBMessage[register]), function(err, status) {
83
81
  if (!err) {
84
82
  // debug("Registered Event %s:%s ->", hbInstance.host, hbInstance.port, status);
@@ -110,7 +108,7 @@ function alexaDiscovery(message, callback) {
110
108
  for (var i = 0; i < response.event.payload.endpoints.length; i++) {
111
109
  var endpoint = response.event.payload.endpoints[i];
112
110
  if (deleteSeen[endpoint.friendlyName]) {
113
- this.log.warn("WARNING: Duplicate device name", endpoint.friendlyName);
111
+ this.log("WARNING: Duplicate device name", endpoint.friendlyName);
114
112
  // response.event.payload.endpoints.splice(i, 1);
115
113
  } else {
116
114
  deleteSeen[endpoint.friendlyName] = true;
@@ -118,7 +116,7 @@ function alexaDiscovery(message, callback) {
118
116
  }
119
117
 
120
118
  if (response && response.event.payload.endpoints.length < 1) {
121
- this.log.error("ERROR: HAP Discovery failed, please review config");
119
+ this.log("ERROR: HAP Discovery failed, please review config");
122
120
  } else {
123
121
  if (process.uptime() > 600) { // Only use console during startup
124
122
  debug("alexaDiscovery - returned %s devices", response.event.payload.endpoints.length);
@@ -126,7 +124,7 @@ function alexaDiscovery(message, callback) {
126
124
  this.log("alexaDiscovery - returned %s devices", response.event.payload.endpoints.length);
127
125
  }
128
126
  if (response.event.payload.endpoints.length > 300) {
129
- this.log.error("ERROR: Maximum devices/accessories of 300 exceeded.");
127
+ this.log("ERROR: Maximum devices/accessories of 300 exceeded.");
130
128
  }
131
129
  }
132
130
  // debug("Discovery Response", JSON.stringify(response, null, 2));
@@ -143,7 +141,7 @@ function alexaDiscovery(message, callback) {
143
141
  function removeLargeCookieEndpoints(endpoints) {
144
142
  var response = [];
145
143
  endpoints.forEach((endpoint) => {
146
- // debug("Cookie Object: ", JSON.stringify(endpoint.cookie).length);
144
+ debug("Cookie Object: ", JSON.stringify(endpoint.cookie).length);
147
145
  if (JSON.stringify(endpoint.cookie).length < 5000) {
148
146
  response.push(endpoint);
149
147
  } else {
@@ -161,7 +159,7 @@ function removeDuplicateEndpoints(endpoints) {
161
159
  var response = [];
162
160
  endpoints.forEach((endpoint) => {
163
161
  if (deleteSeen[endpoint.endpointId]) {
164
- this.log.error("ERROR: Parsing failed, removing duplicate endpointID =>", endpoint.friendlyName);
162
+ this.log("ERROR: Parsing failed, removing duplicate endpointID =>", endpoint.friendlyName);
165
163
  } else {
166
164
  response.push(endpoint);
167
165
  }
package/lib/alexaLocal.js CHANGED
@@ -16,7 +16,7 @@ var checkAlexaMessage = Validator(alexaSchema, {
16
16
  verbose: true
17
17
  });
18
18
 
19
- var connection;
19
+ var connection = {};
20
20
  var count = 0;
21
21
  var username;
22
22
  var limiter;
@@ -45,28 +45,24 @@ function alexaLocal(options) {
45
45
  }
46
46
 
47
47
  limiter.on("dropped", function(dropped) {
48
- options.log.warn("WARNING: ( homebridge-alexa) Dropped event message, message rate too high.");
48
+ options.log("WARNING: ( homebridge-alexa) Dropped event message, message rate too high.");
49
49
  });
50
50
 
51
- username = options.mqttOptions.username;
52
- connection = mqtt.connect(options.mqttURL, options.mqttOptions);
53
- connection.on('connect', function() {
54
- debug('connect', "command/" + username + "/#");
51
+ username = options.username;
52
+ connection.client = mqtt.connect(options);
53
+ // connection.client.setMaxListeners(0);
54
+ connection.client.on('connect', function() {
55
+ debug('connect', "command/" + options.username + "/#");
55
56
  if (options.alexaService) {
56
57
  options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_DETECTED);
57
58
  }
58
- connection.subscribe("command/" + username + "/#");
59
- connection.publish("presence/" + username + "/1", JSON.stringify({
59
+ connection.client.removeAllListeners('message'); // Clean up event handlers
60
+ connection.client.subscribe("command/" + options.username + "/#");
61
+ connection.client.publish("presence/" + options.username + "/1", JSON.stringify({
60
62
  Connected: options.username,
61
- version: packageConfig.version,
62
- transport: options.transport,
63
- keepalive: options.mqttOptions.keepalive,
64
- routines: options.events
63
+ version: packageConfig.version
65
64
  }));
66
- });
67
-
68
- connection.on('message', function(topic, message) {
69
- try {
65
+ connection.client.on('message', function(topic, message) {
70
66
  var msg = JSON.parse(message.toString());
71
67
 
72
68
  // debug("Count", this.listenerCount(msg.directive.header.namespace.toLowerCase()));
@@ -78,63 +74,55 @@ function alexaLocal(options) {
78
74
  response = _alexaErrorResponse(msg);
79
75
  }
80
76
  // debug("Response", JSON.stringify(response));
81
- connection.publish("response/" + username + "/1", JSON.stringify(response));
77
+ connection.client.publish("response/" + options.username + "/1", JSON.stringify(response));
82
78
  });
83
79
  } else {
84
- debug('ERROR: No alexa action listener for', msg);
80
+ debug('No listener for', msg.directive.header.namespace.toLowerCase());
85
81
  var response = _alexaErrorResponse(msg);
86
- connection.publish("response/" + username + "/1", JSON.stringify(response));
87
- // debug("Response", JSON.stringify(response, null, 2));
82
+ connection.client.publish("response/" + options.username + "/1", JSON.stringify(response));
83
+ debug("Response", JSON.stringify(response, null, 2));
88
84
  }
89
- } catch (err) {
90
- options.log.error("ERROR: MQTT Message on topic \"%s\" triggered an internal error\n", topic, err);
91
- }
85
+ });
92
86
  });
93
87
 
94
- connection.on('offline', function() {
88
+ connection.client.on('offline', function() {
95
89
  debug('offline');
96
90
  if (options.alexaService) {
97
91
  options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
98
92
  }
99
93
  });
100
94
 
101
- connection.on('reconnect', function() {
95
+ connection.client.on('reconnect', function() {
102
96
  count++;
103
97
  debug('reconnect');
104
98
  if (options.alexaService) {
105
99
  options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
106
100
  }
107
- if (count % 5 === 0) options.log.error("ERROR: ( homebridge-alexa) You have an issue with your installation, please review the README.");
101
+ if (count % 5 === 0) options.log("ERROR: ( homebridge-alexa) You have an issue with your installation, please review the README.");
108
102
  if (count > 1000) {
109
- connection.end({
103
+ connection.client.end({
110
104
  force: true
111
105
  });
112
106
  if (options.alexaService) {
113
107
  options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
114
108
  }
115
- options.log.error("ERROR: ( homebridge-alexa) Stopping Home Skill connection due to excessive reconnects, please review the README.");
109
+ options.log("ERROR: ( homebridge-alexa) Stopping Home Skill connection due to excessive reconnects, please review the README.");
116
110
  }
117
111
  });
118
112
 
119
- connection.on('error', function(err) {
113
+ connection.client.on('error', function(err) {
120
114
  if (options.alexaService) {
121
115
  options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
122
116
  }
123
- debug('ERROR: %s -> %s\n', err.message, err.code, err);
124
117
  switch (err.code) {
125
118
  case 5:
126
- if (process.uptime() < 20) { // If uptime is less than 20 seconds then error is a bad password and not a backend issue
127
- options.log.error("ERROR: ( homebridge-alexa) Login to homebridge.ca failed, please validate your credentials in config.json and restart homebridge.");
128
- connection.end({
129
- force: true
130
- });
131
- }
132
- break;
133
- case 'ECONNREFUSED':
134
- options.log.error("ERROR: Cloud service DDOS Protection tripped, please stop homebridge for 5 to 10 minutes and try again.");
119
+ options.log("ERROR: ( homebridge-alexa) Login to homebridge.ca failed, please validate your credentials in config.json and restart homebridge.");
120
+ connection.client.end({
121
+ force: true
122
+ });
135
123
  break;
136
124
  default:
137
- debug('ERROR: %s -> %d\n', err.message, err.code, err);
125
+ debug('ERROR: %s -> ', err.message, err.code);
138
126
  }
139
127
  });
140
128
  }
@@ -151,7 +139,7 @@ function alexaEvent(message) {
151
139
  var topic = "event/" + username + "/1";
152
140
  var publish = function(callback) {
153
141
  debug("Sending message", JSON.stringify(message));
154
- connection.publish(topic, JSON.stringify(message), {
142
+ connection.client.publish(topic, JSON.stringify(message), {
155
143
  retain: false
156
144
  }, callback);
157
145
  };
@@ -163,18 +151,16 @@ function alexaPriorityEvent(message) {
163
151
  var topic = "event/" + username + "/1";
164
152
  var publish = function(callback) {
165
153
  debug("Sending priority message", JSON.stringify(message));
166
- connection.publish(topic, JSON.stringify(message), {
154
+ connection.client.publish(topic, JSON.stringify(message), {
167
155
  retain: false
168
156
  }, callback);
169
157
  };
170
- limiter.submit({
171
- priority: 4
172
- }, publish);
158
+ limiter.submit({ priority: 4 }, publish);
173
159
 
174
160
  /*
175
161
  var topic = "event/" + username + "/1";
176
162
  debug("Sending priority message", JSON.stringify(message));
177
- connection.publish(topic, JSON.stringify(message));
163
+ connection.client.publish(topic, JSON.stringify(message));
178
164
  */
179
165
  }
180
166
 
@@ -116,8 +116,6 @@ Accessory.prototype.toAlexa = function(context) {
116
116
  var service = this.services[index];
117
117
  if ((this.television && service.service === "Speaker") || service.service === "Television" || service.service === "Input Source") {
118
118
  // Skip television accessories
119
- } else if (service.name === "Alexa" && service.service === "Contact Sensor" && service.info.Manufacturer === "homebridge-alexa") {
120
- // Skip the Alexa contact sensors made by the plugin
121
119
  } else {
122
120
  var alexa = service.toAlexa(context);
123
121
  if (alexa) {
@@ -91,16 +91,12 @@ Homebridges.prototype.toEvents = function(endpoint) {
91
91
  for (var index in accessory.services) {
92
92
  var service = accessory.services[index];
93
93
  // debug("characteristics", service.characteristics.length);
94
- if (service.name === "Alexa" && service.service === "Contact Sensor" && service.info.Manufacturer === "homebridge-alexa") {
95
- // Skip the Alexa contact sensors made by the plugin
96
- } else {
97
- for (var index in service.characteristics) {
98
- var hapEvents = service.characteristics[index].hapEvents;
99
- if (Object.keys(hapEvents).length > 0) {
100
- list = Object.assign(list, hapEvents);
101
- // debug("hapEvents", hapEvents, Object.keys(hapEvents).length);
102
- // debug("List", list);
103
- }
94
+ for (var index in service.characteristics) {
95
+ var hapEvents = service.characteristics[index].hapEvents;
96
+ if (Object.keys(hapEvents).length > 0) {
97
+ list = Object.assign(list, hapEvents);
98
+ // debug("hapEvents", hapEvents, Object.keys(hapEvents).length);
99
+ // debug("List", list);
104
100
  }
105
101
  }
106
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-alexa",
3
- "version": "0.5.60-beta.2",
3
+ "version": "0.5.60",
4
4
  "description": "Control your Homebridge devices with Amazon Alexa.",
5
5
  "main": "plugin.js",
6
6
  "scripts": {
@@ -39,9 +39,9 @@
39
39
  "dependencies": {
40
40
  "bottleneck": ">=2.19.5",
41
41
  "debug": ">=4.3.3",
42
- "hap-node-client": ">=0.1.16",
42
+ "hap-node-client": ">=0.1.21",
43
43
  "is-my-json-valid": ">=2.20.6",
44
- "mqtt": "^4.3.4"
44
+ "mqtt": "4.2.8"
45
45
  },
46
46
  "author": "NorthernMan54",
47
47
  "license": "Apache-2.0",
package/plugin.js CHANGED
@@ -40,14 +40,14 @@ function alexaHome(log, config, api) {
40
40
  this.deviceList = config['deviceList'] || []; // Use ea
41
41
  this.door = config['door'] || false; // Use mode controller for Garage Doors
42
42
  this.name = config['name'] || "homebridgeAlexa";
43
- this.LegacyCloudTransport = config['LegacyCloudTransport'] || false; // Default to new Transport
44
43
  var mqttKeepalive = config['keepalive'] || 20; // MQTT Connection Keepalive
45
44
 
46
- if (mqttKeepalive < 60) {
47
- this.keepalive = mqttKeepalive * 60;
48
- } else {
49
- this.keepalive = mqttKeepalive;
50
- }
45
+ if( mqttKeepalive < 60 )
46
+ {
47
+ this.keepalive = mqttKeepalive * 60;
48
+ } else {
49
+ this.keepalive = mqttKeepalive;
50
+ }
51
51
 
52
52
  // Enable config based DEBUG logging enable
53
53
  this.debug = config['debug'] || false;
@@ -94,26 +94,24 @@ alexaHome.prototype = {
94
94
  };
95
95
 
96
96
  alexaHome.prototype.didFinishLaunching = function() {
97
- var host = (this.LegacyCloudTransport ? 'alexa.homebridge.ca' : 'www.homebridge.ca');
98
- var reconnectPeriod = 65000; // Increased reconnect period to allow DDOS protection to reset
97
+ var host = 'alexa.homebridge.ca';
99
98
  if (this.beta) {
100
- host = 'clone.homebridge.ca';
101
- // reconnectPeriod = 10000;
99
+ host = 'alexabeta.homebridge.ca';
102
100
  }
103
-
104
101
  options = {
105
102
  // Shared Options
106
103
  log: this.log,
107
104
  debug: this.debug,
108
- mqttURL: (this.LegacyCloudTransport ? "mqtt://" + host + ":1883/" : "wss://" + host + "/ws"),
109
- transport: (this.LegacyCloudTransport ? "mqtt" : "wss"),
110
- mqttOptions: {
111
- username: this.username,
112
- password: this.password,
113
- reconnectPeriod: reconnectPeriod, // Increased reconnect period to allow DDOS protection to reset
114
- keepalive: (this.LegacyCloudTransport ? this.keepalive : 55), // Keep alive not required when using WSS Transport
115
- rejectUnauthorized: false
116
- },
105
+ // MQTT Options
106
+ username: this.username,
107
+ password: this.password,
108
+ servers: [{
109
+ protocol: 'mqtt',
110
+ host: host,
111
+ port: 1883
112
+ }],
113
+ reconnectPeriod: 65000,
114
+ keepalive: this.keepalive, // Reduce client timeout to 10 minutes
117
115
  // HAP Node Client options
118
116
  pin: this.pin,
119
117
  refresh: this.refresh,
@@ -147,13 +145,7 @@ alexaHome.prototype.didFinishLaunching = function() {
147
145
  // Alexa mesages
148
146
 
149
147
  this.eventBus.on('System', function(message) {
150
- this.log.error("ERROR:", message.directive.header.message);
151
- }.bind(this));
152
- this.eventBus.on('Warning', function(message) {
153
- this.log.warn("Warning:", message.directive.header.message);
154
- }.bind(this));
155
- this.eventBus.on('Information', function(message) {
156
- this.log("Info:", message.directive.header.message);
148
+ this.log.error("ERROR: ", message.directive.header.message);
157
149
  }.bind(this));
158
150
  this.eventBus.on('Alexa', alexaActions.alexaMessage.bind(this));
159
151
  this.eventBus.on('Alexa.Discovery', alexaActions.alexaDiscovery.bind(this));