homebridge-alexa 0.5.53 → 0.5.55
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 +6 -5
- package/config.schema.json +17 -0
- package/lib/alexaActions.js +1 -4
- package/lib/parse/Characteristic.js +6 -0
- package/lib/parse/Service.js +1 -0
- package/lib/parse/messages.js +36 -1
- package/package.json +2 -2
- package/plugin.js +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,15 +2,16 @@
|
|
|
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.
|
|
5
|
+
## 0.5.54 (2021-01-03)
|
|
6
6
|
|
|
7
|
-
## [Version 0.5.
|
|
7
|
+
## [Version 0.5.54](https://github.com/northernman54/homebridge-alexa/compare/v0.5.52...v0.5.54)
|
|
8
8
|
|
|
9
9
|
#### Changes
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
11
|
+
- Merge current beta into master
|
|
12
|
+
- Expose cloud connection keep alive tuning parameter #479
|
|
13
|
+
- Extend filtering to routines event registration - Resolve #458 #459 #461 #465
|
|
14
|
+
- Reduce amount of logging
|
|
14
15
|
|
|
15
16
|
## 0.5.37 (2021-06-15)
|
|
16
17
|
|
package/config.schema.json
CHANGED
|
@@ -58,6 +58,14 @@
|
|
|
58
58
|
"placeholder": "900",
|
|
59
59
|
"description": "Frequency of refreshes of the homebridge accessory cache, in seconds. Defaults to 15 minutes."
|
|
60
60
|
},
|
|
61
|
+
"keepalive": {
|
|
62
|
+
"title": "Cloud Server Connection Keepalive",
|
|
63
|
+
"type": "integer",
|
|
64
|
+
"placeholder": "20",
|
|
65
|
+
"description": "Frequency of keepalive messages to cloud server, in minutes. Defaults to 20 minutes. Do not change from default unless requested as part of problem investigation.",
|
|
66
|
+
"minimum": 1,
|
|
67
|
+
"maximum": 59
|
|
68
|
+
},
|
|
61
69
|
"filter": {
|
|
62
70
|
"title": "Instance Filter",
|
|
63
71
|
"type": "string",
|
|
@@ -169,6 +177,15 @@
|
|
|
169
177
|
}
|
|
170
178
|
]
|
|
171
179
|
},
|
|
180
|
+
{
|
|
181
|
+
"type": "fieldset",
|
|
182
|
+
"title": "Advanced Settings",
|
|
183
|
+
"expandable": true,
|
|
184
|
+
"expanded": false,
|
|
185
|
+
"items": [
|
|
186
|
+
"keepalive"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
172
189
|
{
|
|
173
190
|
"type": "fieldset",
|
|
174
191
|
"title": "Speakers",
|
package/lib/alexaActions.js
CHANGED
|
@@ -36,9 +36,7 @@ function hapDiscovery(options) {
|
|
|
36
36
|
alexaDiscovery.call(options, null, function() {
|
|
37
37
|
// debug("Events", options);
|
|
38
38
|
if (options.events) {
|
|
39
|
-
|
|
40
|
-
registerEvents(hbDevices.toEvents());
|
|
41
|
-
|
|
39
|
+
registerEvents(messages.checkEventDeviceList.call(options, hbDevices.toEvents()));
|
|
42
40
|
}
|
|
43
41
|
});
|
|
44
42
|
});
|
|
@@ -56,7 +54,6 @@ function registerEvents(message) {
|
|
|
56
54
|
var HBMessage = [];
|
|
57
55
|
|
|
58
56
|
for (var key in message) {
|
|
59
|
-
// console.log("Key", key, JSON.parse(key));
|
|
60
57
|
var endpoint = JSON.parse(key);
|
|
61
58
|
var device = {
|
|
62
59
|
"aid": endpoint.aid,
|
|
@@ -52,6 +52,7 @@ function _getActions(description, context, devices) {
|
|
|
52
52
|
var cookie = {};
|
|
53
53
|
var reportState = [];
|
|
54
54
|
var hapEvents = [];
|
|
55
|
+
// debug("_getActions", description, devices);
|
|
55
56
|
switch (description) {
|
|
56
57
|
case "Active": // Active on a Fan 2 aka Dyson or Valve
|
|
57
58
|
case "On": // Accessory On/Off
|
|
@@ -92,6 +93,7 @@ function _getActions(description, context, devices) {
|
|
|
92
93
|
"iid": context.liid
|
|
93
94
|
})] = {
|
|
94
95
|
"endpointID": context.endpointID,
|
|
96
|
+
"friendlyName": context.name,
|
|
95
97
|
"true": "DETECTED",
|
|
96
98
|
"false": "NOT_DETECTED",
|
|
97
99
|
"1": "DETECTED",
|
|
@@ -118,6 +120,7 @@ function _getActions(description, context, devices) {
|
|
|
118
120
|
"iid": context.liid
|
|
119
121
|
})] = {
|
|
120
122
|
"endpointID": context.endpointID,
|
|
123
|
+
"friendlyName": context.name,
|
|
121
124
|
"0": "DETECTED", // Aka open for Alexa
|
|
122
125
|
"1": "NOT_DETECTED",
|
|
123
126
|
// "2": "DETECTED",
|
|
@@ -157,6 +160,7 @@ function _getActions(description, context, devices) {
|
|
|
157
160
|
"iid": context.liid
|
|
158
161
|
})] = {
|
|
159
162
|
"endpointID": context.endpointID,
|
|
163
|
+
"friendlyName": context.name,
|
|
160
164
|
"1": "DETECTED", // Aka open for Alexa
|
|
161
165
|
"0": "NOT_DETECTED",
|
|
162
166
|
"template": "ContactSensor"
|
|
@@ -172,6 +176,7 @@ function _getActions(description, context, devices) {
|
|
|
172
176
|
"iid": context.liid
|
|
173
177
|
})] = {
|
|
174
178
|
"endpointID": context.endpointID,
|
|
179
|
+
"friendlyName": context.name,
|
|
175
180
|
"0": "DETECTED", // Aka open for Alexa
|
|
176
181
|
"1": "NOT_DETECTED",
|
|
177
182
|
"template": "DoorbellEventSource"
|
|
@@ -253,6 +258,7 @@ function _getActions(description, context, devices) {
|
|
|
253
258
|
cookie["targetSetpoint"] = messages.cookie(context);
|
|
254
259
|
}
|
|
255
260
|
break;
|
|
261
|
+
case "Target Heater-Cooler State":
|
|
256
262
|
case "Target Heater Cooler State":
|
|
257
263
|
case "Target Heating Cooling State":
|
|
258
264
|
reportState.push(messages.reportState("Alexa.ThermostatControllerthermostatMode", context));
|
package/lib/parse/Service.js
CHANGED
|
@@ -35,6 +35,7 @@ function Service(devices, context) {
|
|
|
35
35
|
this.info = context.info;
|
|
36
36
|
this.characteristics = [];
|
|
37
37
|
this.linked = devices.linked;
|
|
38
|
+
this.name = context.name;
|
|
38
39
|
var endpointReg = /[^\w|_|-|=|#|;|:|?|@|&]/g; // Invalid characters in endpointid
|
|
39
40
|
this.endpointID = Buffer.from(this.id + "-" + context.homebridge + "-" + context.info.Manufacturer + "-" + context.info.Name + "-" + this.serviceType).toString('base64').replace(endpointReg, '#');
|
|
40
41
|
// this.endpointID = new Buffer(this.id + "-" + context.homebridge + "-" + context.info.Manufacturer + "-" + context.info.Name + "-" + this.serviceType).toString('base64');
|
package/lib/parse/messages.js
CHANGED
|
@@ -19,7 +19,8 @@ module.exports = {
|
|
|
19
19
|
round: round,
|
|
20
20
|
combine: combine,
|
|
21
21
|
channel: channel,
|
|
22
|
-
inputs: inputs
|
|
22
|
+
inputs: inputs,
|
|
23
|
+
checkEventDeviceList: checkEventDeviceList
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
function createMessageId() {
|
|
@@ -1414,3 +1415,37 @@ function _getThermoMode(mode) {
|
|
|
1414
1415
|
return "AUTO";
|
|
1415
1416
|
}
|
|
1416
1417
|
}
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
function checkEventDeviceList(endpoints) {
|
|
1421
|
+
if (this.deviceList && this.deviceList.length > 0 && ['allow', 'deny'].includes(this.deviceListHandling)) {
|
|
1422
|
+
debug(`INFO: DeviceList - The following devices are ${this.deviceListHandling} =>`, this.deviceList);
|
|
1423
|
+
var response = [];
|
|
1424
|
+
for (var key in endpoints) {
|
|
1425
|
+
var endpoint = endpoints[key];
|
|
1426
|
+
if (this.deviceListHandling === "allow") {
|
|
1427
|
+
if (verifyDeviceInList(this.deviceList, endpoint.friendlyName)) {
|
|
1428
|
+
response[key] = endpoint;
|
|
1429
|
+
debug("INFO: DeviceList - allow =>", endpoint.friendlyName);
|
|
1430
|
+
}
|
|
1431
|
+
} else if (this.deviceListHandling === "deny") {
|
|
1432
|
+
if (verifyDeviceInList(this.deviceList, endpoint.friendlyName)) {
|
|
1433
|
+
debug("INFO: DeviceList - deny =>", endpoint.friendlyName);
|
|
1434
|
+
} else {
|
|
1435
|
+
response[key] = endpoint;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
return (response);
|
|
1440
|
+
} else {
|
|
1441
|
+
debug("INFO: DeviceList empty feature not enabled or config error in deviceListHandling");
|
|
1442
|
+
return endpoints;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
function verifyDeviceInList(deviceList, deviceName) {
|
|
1447
|
+
for (var i = 0, len = deviceList.length; i < len; i++) {
|
|
1448
|
+
if (deviceName === deviceList[i] || deviceName.match(new RegExp(deviceList[i]))) return true;
|
|
1449
|
+
}
|
|
1450
|
+
return false;
|
|
1451
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-alexa",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.55",
|
|
4
4
|
"description": "Control your Homebridge devices with Amazon Alexa.",
|
|
5
5
|
"main": "plugin.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"debug": ">=4.3.3",
|
|
42
42
|
"hap-node-client": ">=0.1.16",
|
|
43
43
|
"is-my-json-valid": ">=2.20.6",
|
|
44
|
-
"mqtt": "4.2.
|
|
44
|
+
"mqtt": "4.2.8"
|
|
45
45
|
},
|
|
46
46
|
"author": "NorthernMan54",
|
|
47
47
|
"license": "Apache-2.0",
|
package/plugin.js
CHANGED
|
@@ -40,6 +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
|
+
var mqttKeepalive = config['keepalive'] || 20; // MQTT Connection Keepalive
|
|
44
|
+
|
|
45
|
+
if( mqttKeepalive < 60 )
|
|
46
|
+
{
|
|
47
|
+
this.keepalive = mqttKeepalive * 60;
|
|
48
|
+
} else {
|
|
49
|
+
this.keepalive = mqttKeepalive;
|
|
50
|
+
}
|
|
43
51
|
|
|
44
52
|
// Enable config based DEBUG logging enable
|
|
45
53
|
this.debug = config['debug'] || false;
|
|
@@ -103,7 +111,7 @@ alexaHome.prototype.didFinishLaunching = function() {
|
|
|
103
111
|
port: 1883
|
|
104
112
|
}],
|
|
105
113
|
reconnectPeriod: 65000,
|
|
106
|
-
keepalive:
|
|
114
|
+
keepalive: this.keepalive, // Reduce client timeout to 10 minutes
|
|
107
115
|
// HAP Node Client options
|
|
108
116
|
pin: this.pin,
|
|
109
117
|
refresh: this.refresh,
|