homebridge-smartsystem 7.2.1 → 7.2.3
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 +6 -0
- package/server/views/proxy.ejs +9 -4
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.3",
|
|
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
|
@@ -263,6 +263,10 @@ function SmartSocketInit(message){
|
|
|
263
263
|
// save username / password in config
|
|
264
264
|
this.config.username = user;
|
|
265
265
|
this.config.password = pw;
|
|
266
|
+
// remember the username as the login page's default, so it doesn't keep falling back
|
|
267
|
+
// to the hardcoded "duotecno" default for gateways whose actual account uses another name
|
|
268
|
+
this.config.user = user;
|
|
269
|
+
this.user = user;
|
|
266
270
|
this.writeConfig();
|
|
267
271
|
this.token = access_token;
|
|
268
272
|
(0, config_1.setToken)(this.token);
|
|
@@ -392,7 +396,9 @@ function SmartSocketInit(message){
|
|
|
392
396
|
config.cloudPort = context.getParam({ name: "cloudPort", type: "integer" });
|
|
393
397
|
config.masterAddress = context.getParam({ name: "masterAddress", type: "string" });
|
|
394
398
|
config.masterPort = context.getParam({ name: "masterPort", type: "integer" });
|
|
399
|
+
config.masterPortEnabled = !!context.getParam({ name: "masterPortEnabled", type: "string" });
|
|
395
400
|
config.masterConfigPort = context.getParam({ name: "masterConfigPort", type: "integer" });
|
|
401
|
+
config.masterConfigPortEnabled = !!context.getParam({ name: "masterConfigPortEnabled", type: "string" });
|
|
396
402
|
config.installationId = context.getParam({ name: "installationId", type: "string" });
|
|
397
403
|
config.nodeNumber = context.getParam({ name: "nodeNumber", type: "string" })
|
|
398
404
|
? parseInt(context.getParam({ name: "nodeNumber", type: "string" }), 16) : proxy_1.kEmptyProxy.nodeNumber;
|
package/server/views/proxy.ejs
CHANGED
|
@@ -116,11 +116,14 @@
|
|
|
116
116
|
<div class="row" style="margin-top: 0;">
|
|
117
117
|
<div class="input-field col s6">
|
|
118
118
|
<label for="dserverEmail">Duotecno Account Email</label>
|
|
119
|
-
<input id="dserverEmail" name="dserverEmail" type="email"
|
|
119
|
+
<input id="dserverEmail" name="dserverEmail" type="email" autocomplete="off"
|
|
120
|
+
value="<%= config.dserverEmail || '' %>">
|
|
120
121
|
</div>
|
|
121
122
|
<div class="input-field col s6">
|
|
122
123
|
<label for="dserverPassword">Duotecno Account Password</label>
|
|
123
|
-
<input id="dserverPassword" name="dserverPassword" type="
|
|
124
|
+
<input id="dserverPassword" name="dserverPassword" type="text" autocomplete="off"
|
|
125
|
+
style="-webkit-text-security: disc;"
|
|
126
|
+
value="<%= config.dserverPassword || '' %>">
|
|
124
127
|
</div>
|
|
125
128
|
</div>
|
|
126
129
|
|
|
@@ -144,7 +147,8 @@
|
|
|
144
147
|
<div class="col s6">
|
|
145
148
|
<p>
|
|
146
149
|
<label>
|
|
147
|
-
<input type="checkbox" class="filled-in"
|
|
150
|
+
<input type="checkbox" class="filled-in" id="masterPortEnabled" name="masterPortEnabled" value="Y"
|
|
151
|
+
<%= config.masterPortEnabled ? "checked" : "" %> />
|
|
148
152
|
<span><strong>Websocket</strong></span>
|
|
149
153
|
</label>
|
|
150
154
|
</p>
|
|
@@ -157,7 +161,8 @@
|
|
|
157
161
|
<div class="col s6">
|
|
158
162
|
<p>
|
|
159
163
|
<label>
|
|
160
|
-
<input type="checkbox" class="filled-in"
|
|
164
|
+
<input type="checkbox" class="filled-in" id="masterConfigPortEnabled" name="masterConfigPortEnabled" value="Y"
|
|
165
|
+
<%= config.masterConfigPortEnabled ? "checked" : "" %> />
|
|
161
166
|
<span><strong>Config port</strong></span>
|
|
162
167
|
</label>
|
|
163
168
|
</p>
|