homebridge-smartsystem 7.2.1 → 7.2.2
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/duotecno/types.js +4 -0
- package/package.json +1 -1
- package/server/proxy.js +11 -5
- package/server/smartapp.js +2 -0
- package/server/views/proxy.ejs +4 -2
package/duotecno/types.js
CHANGED
|
@@ -20,7 +20,9 @@ exports.kEmptyProxy = {
|
|
|
20
20
|
cloudPort: 5097,
|
|
21
21
|
masterAddress: "",
|
|
22
22
|
masterPort: 5001,
|
|
23
|
+
masterPortEnabled: false,
|
|
23
24
|
masterConfigPort: 8080,
|
|
25
|
+
masterConfigPortEnabled: false,
|
|
24
26
|
installationId: "",
|
|
25
27
|
nodeNumber: 0xff,
|
|
26
28
|
httpEnabled: false,
|
|
@@ -441,7 +443,9 @@ exports.Sanitizers = {
|
|
|
441
443
|
c.cloudPort = (config === null || config === void 0 ? void 0 : config.cloudPort) || exports.kEmptyProxy.cloudPort;
|
|
442
444
|
c.masterAddress = (config === null || config === void 0 ? void 0 : config.masterAddress) || ((_a = system === null || system === void 0 ? void 0 : system.cmasters[0]) === null || _a === void 0 ? void 0 : _a.address) || "";
|
|
443
445
|
c.masterPort = (config === null || config === void 0 ? void 0 : config.masterPort) || ((_b = system === null || system === void 0 ? void 0 : system.cmasters[0]) === null || _b === void 0 ? void 0 : _b.port) || 5001;
|
|
446
|
+
c.masterPortEnabled = !!(config === null || config === void 0 ? void 0 : config.masterPortEnabled);
|
|
444
447
|
c.masterConfigPort = (config === null || config === void 0 ? void 0 : config.masterConfigPort) || exports.kEmptyProxy.masterConfigPort;
|
|
448
|
+
c.masterConfigPortEnabled = !!(config === null || config === void 0 ? void 0 : config.masterConfigPortEnabled);
|
|
445
449
|
c.installationId = (config === null || config === void 0 ? void 0 : config.installationId) || exports.kEmptyProxy.installationId;
|
|
446
450
|
c.nodeNumber = (typeof (config === null || config === void 0 ? void 0 : config.nodeNumber) === "number") ? config.nodeNumber : exports.kEmptyProxy.nodeNumber;
|
|
447
451
|
c.httpEnabled = !!(config === null || config === void 0 ? void 0 : config.httpEnabled);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-smartsystem",
|
|
3
3
|
"displayname": "Duotecno Bridge",
|
|
4
|
-
"version": "7.2.
|
|
4
|
+
"version": "7.2.2",
|
|
5
5
|
"description": "SmartServer (Proxy TCP sockets to the cloud, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "Johan Coppieters",
|
package/server/proxy.js
CHANGED
|
@@ -90,7 +90,9 @@ function setProxyConfig(c) {
|
|
|
90
90
|
config.cloudPort = c.cloudPort || types_1.kEmptyProxy.cloudPort;
|
|
91
91
|
config.masterAddress = c.masterAddress || types_1.kEmptyProxy.masterAddress;
|
|
92
92
|
config.masterPort = c.masterPort || types_1.kEmptyProxy.masterPort;
|
|
93
|
+
config.masterPortEnabled = !!c.masterPortEnabled;
|
|
93
94
|
config.masterConfigPort = c.masterConfigPort || types_1.kEmptyProxy.masterConfigPort;
|
|
95
|
+
config.masterConfigPortEnabled = !!c.masterConfigPortEnabled;
|
|
94
96
|
config.installationId = c.installationId || types_1.kEmptyProxy.installationId;
|
|
95
97
|
config.nodeNumber = (typeof c.nodeNumber === "number") ? c.nodeNumber : types_1.kEmptyProxy.nodeNumber;
|
|
96
98
|
config.httpEnabled = !!c.httpEnabled;
|
|
@@ -194,21 +196,25 @@ function cleanStart(restart = false) {
|
|
|
194
196
|
if (restart) {
|
|
195
197
|
log(`[PROXY] → [CLOUD] Restarting proxy...`);
|
|
196
198
|
let connectionsStarted = 0;
|
|
197
|
-
// Start connection for the master device's raw protocol port if an installation ID is configured
|
|
198
|
-
//
|
|
199
|
-
// gateway's own (configurable) nodeNumber.
|
|
200
|
-
if (config.installationId && config.masterAddress) {
|
|
199
|
+
// Start connection for the master device's raw protocol port if an installation ID is configured
|
|
200
|
+
// and this tunnel is explicitly enabled (off by default). Masters always register under the
|
|
201
|
+
// fixed master node number (kMasterNodeNumber), not the gateway's own (configurable) nodeNumber.
|
|
202
|
+
if (config.installationId && config.masterAddress && config.masterPortEnabled) {
|
|
201
203
|
const masterId = makeDeviceId(config, exports.kMasterNodeNumber, "tcp", config.masterPort);
|
|
202
204
|
log(`[PROXY] Starting proxy for master device: ${masterId}`);
|
|
203
205
|
makeNewCloudConnection(config.masterAddress, config.masterPort, config.cloudServer, config.cloudPort, masterId);
|
|
204
206
|
connectionsStarted++;
|
|
205
207
|
}
|
|
208
|
+
else if (config.installationId && config.masterAddress) {
|
|
209
|
+
log(`[PROXY] → [CLOUD] Master TCP tunnel disabled, skipping master connection.`);
|
|
210
|
+
}
|
|
206
211
|
else if (config.installationId) {
|
|
207
212
|
log(`[PROXY] → [CLOUD] Installation ID configured but no masterAddress, skipping master connection.`);
|
|
208
213
|
}
|
|
209
214
|
// Start a proxy for the master's Config API port -- this is an HTTP API, so it's tagged
|
|
210
215
|
// "http" rather than "tcp" even though the tunnel itself just relays raw bytes either way.
|
|
211
|
-
|
|
216
|
+
// Also off by default, only started when explicitly enabled.
|
|
217
|
+
if (config.installationId && config.masterAddress && config.masterConfigPort && config.masterConfigPortEnabled) {
|
|
212
218
|
const configId = makeDeviceId(config, exports.kMasterNodeNumber, "http", config.masterConfigPort);
|
|
213
219
|
log(`[PROXY] Starting proxy for Config API: ${configId} -> ${config.masterAddress}:${config.masterConfigPort}`);
|
|
214
220
|
// All connections use the same cloud port for WebSocket multiplexing
|
package/server/smartapp.js
CHANGED
|
@@ -392,7 +392,9 @@ function SmartSocketInit(message){
|
|
|
392
392
|
config.cloudPort = context.getParam({ name: "cloudPort", type: "integer" });
|
|
393
393
|
config.masterAddress = context.getParam({ name: "masterAddress", type: "string" });
|
|
394
394
|
config.masterPort = context.getParam({ name: "masterPort", type: "integer" });
|
|
395
|
+
config.masterPortEnabled = !!context.getParam({ name: "masterPortEnabled", type: "string" });
|
|
395
396
|
config.masterConfigPort = context.getParam({ name: "masterConfigPort", type: "integer" });
|
|
397
|
+
config.masterConfigPortEnabled = !!context.getParam({ name: "masterConfigPortEnabled", type: "string" });
|
|
396
398
|
config.installationId = context.getParam({ name: "installationId", type: "string" });
|
|
397
399
|
config.nodeNumber = context.getParam({ name: "nodeNumber", type: "string" })
|
|
398
400
|
? parseInt(context.getParam({ name: "nodeNumber", type: "string" }), 16) : proxy_1.kEmptyProxy.nodeNumber;
|
package/server/views/proxy.ejs
CHANGED
|
@@ -144,7 +144,8 @@
|
|
|
144
144
|
<div class="col s6">
|
|
145
145
|
<p>
|
|
146
146
|
<label>
|
|
147
|
-
<input type="checkbox" class="filled-in"
|
|
147
|
+
<input type="checkbox" class="filled-in" id="masterPortEnabled" name="masterPortEnabled" value="Y"
|
|
148
|
+
<%= config.masterPortEnabled ? "checked" : "" %> />
|
|
148
149
|
<span><strong>Websocket</strong></span>
|
|
149
150
|
</label>
|
|
150
151
|
</p>
|
|
@@ -157,7 +158,8 @@
|
|
|
157
158
|
<div class="col s6">
|
|
158
159
|
<p>
|
|
159
160
|
<label>
|
|
160
|
-
<input type="checkbox" class="filled-in"
|
|
161
|
+
<input type="checkbox" class="filled-in" id="masterConfigPortEnabled" name="masterConfigPortEnabled" value="Y"
|
|
162
|
+
<%= config.masterConfigPortEnabled ? "checked" : "" %> />
|
|
161
163
|
<span><strong>Config port</strong></span>
|
|
162
164
|
</label>
|
|
163
165
|
</p>
|