homebridge-smartsystem 6.4.2 → 6.4.4
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 +1 -1
- package/config.json +4 -1
- package/duotecno/master.js +4 -6
- package/duotecno/master.ts +5 -5
- package/package.json +1 -1
- package/server/platform.js +2 -2
- package/server/platform.ts +2 -2
- package/server/powerbase.js +1 -1
- package/server/socapp.js +6 -6
- package/server/socapp.ts +6 -7
- package/server/somfy.js +3 -2
- package/server/somfy.ts +2 -2
- package/www/index.html +3 -0
package/README.md
CHANGED
|
@@ -285,7 +285,7 @@ Homebridge UI version
|
|
|
285
285
|
### v6.4.x - 28-11-2022 - Binding to registers
|
|
286
286
|
- 0: writing to registers
|
|
287
287
|
- 1: ask/show protocol version -> publish
|
|
288
|
-
- 2: test on
|
|
288
|
+
- 2 & 3: test on protocol version, not firmware for using registers, due to bug in master firmware pre v101.x
|
|
289
289
|
|
|
290
290
|
## Hardware
|
|
291
291
|
A Raspberry Pi that connects to a Duotecno IP Node
|
package/config.json
CHANGED
package/duotecno/master.js
CHANGED
|
@@ -434,16 +434,14 @@ class Master extends base_1.Base {
|
|
|
434
434
|
this.log("NodeMgtInfo - master " + this.getName() + " can be master: " + message[2]);
|
|
435
435
|
}
|
|
436
436
|
else if (message[1] === protocol_1.reqNodeAttributes.nodeVersion) {
|
|
437
|
-
console.log("*** -> " + message);
|
|
438
437
|
this.log("NodeMgtInfo - version " + this.getName() + ", version: " + message[2] + "." + message[3]);
|
|
439
438
|
this.version = message[2] * 100 + message[3];
|
|
440
|
-
|
|
441
|
-
this.protocol = message[2] * 100 + message[3];
|
|
439
|
+
console.log("*** version -> " + message + " -> " + this.version + " ***");
|
|
442
440
|
}
|
|
443
441
|
else if (message[1] === protocol_1.reqNodeAttributes.nodeProtocol) {
|
|
444
|
-
console.log("*** -> " + message);
|
|
445
442
|
this.log("NodeMgtInfo - protocol " + this.getName() + ", protocol: " + message[2] + "." + message[3]);
|
|
446
443
|
this.protocol = message[2] * 100 + message[3];
|
|
444
|
+
console.log("*** protocol -> " + message + " -> " + this.protocol + " ***");
|
|
447
445
|
}
|
|
448
446
|
else {
|
|
449
447
|
this.err("dropped NodeMgtInfo info message = " + message[1] + ", message: " + message);
|
|
@@ -753,7 +751,7 @@ class Master extends base_1.Base {
|
|
|
753
751
|
}
|
|
754
752
|
requestRegisterValue(register) {
|
|
755
753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
756
|
-
if (this.
|
|
754
|
+
if (this.protocol >= 209) {
|
|
757
755
|
yield this.send(protocol_1.Protocol.buildRegister(register));
|
|
758
756
|
this.info("request register: " + register);
|
|
759
757
|
}
|
|
@@ -775,7 +773,7 @@ class Master extends base_1.Base {
|
|
|
775
773
|
}
|
|
776
774
|
setRegisterValue(register, value) {
|
|
777
775
|
return __awaiter(this, void 0, void 0, function* () {
|
|
778
|
-
if (this.
|
|
776
|
+
if (this.protocol >= 209) {
|
|
779
777
|
yield this.send(protocol_1.Protocol.buildRegister(register, value));
|
|
780
778
|
this.info("set register: " + register + ", to: " + value);
|
|
781
779
|
}
|
package/duotecno/master.ts
CHANGED
|
@@ -459,7 +459,7 @@ export class Master extends Base {
|
|
|
459
459
|
|
|
460
460
|
// if logged in, ask protocol version
|
|
461
461
|
if (this.isLoggedIn) {
|
|
462
|
-
this.send(Protocol.buildRequestNodeMgt(reqNodeAttributes.
|
|
462
|
+
this.send(Protocol.buildRequestNodeMgt(reqNodeAttributes.nodeProtocol));
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
} else {
|
|
@@ -818,11 +818,11 @@ export class Master extends Base {
|
|
|
818
818
|
}
|
|
819
819
|
|
|
820
820
|
async requestRegisterValue(register: number) {
|
|
821
|
-
if (this.
|
|
821
|
+
if (this.protocol >= 209) {
|
|
822
822
|
await this.send(Protocol.buildRegister(register));
|
|
823
823
|
this.info("request register: " + register);
|
|
824
824
|
} else {
|
|
825
|
-
this.err("FC_REGISTERMAP not available before
|
|
825
|
+
this.err("FC_REGISTERMAP not available before protocol v2.09")
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
|
|
@@ -837,11 +837,11 @@ export class Master extends Base {
|
|
|
837
837
|
}
|
|
838
838
|
|
|
839
839
|
async setRegisterValue(register: number, value: number) {
|
|
840
|
-
if (this.
|
|
840
|
+
if (this.protocol >= 209) {
|
|
841
841
|
await this.send(Protocol.buildRegister(register, value));
|
|
842
842
|
this.info("set register: " + register + ", to: " + value);
|
|
843
843
|
} else {
|
|
844
|
-
this.err("FC_REGISTERMAP not available before
|
|
844
|
+
this.err("FC_REGISTERMAP not available before protocol v2.09")
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-smartsystem",
|
|
3
3
|
"displayname": "Duotecno Bridge",
|
|
4
|
-
"version": "6.4.
|
|
4
|
+
"version": "6.4.4",
|
|
5
5
|
"description": "SmartServer (Proxy Websockets to TCP sockets, Smappee MQTT, Duotecno IP Nodes, Homekit interface)",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": "Johan Coppieters",
|
package/server/platform.js
CHANGED
|
@@ -92,11 +92,11 @@ class Platform extends base_1.Base {
|
|
|
92
92
|
else {
|
|
93
93
|
(0, logger_1.log)("homebridge", "platform - No SmartApp configured.");
|
|
94
94
|
}
|
|
95
|
-
// startup a SocApp if configured -> for proxy (not needed)
|
|
95
|
+
// startup a SocApp if configured -> for proxy (not needed for normal operations)
|
|
96
96
|
if (this.config.socapp) {
|
|
97
97
|
try {
|
|
98
98
|
// reuse the config file from the smartapp
|
|
99
|
-
this.smartsoc = new socapp_1.SocApp(this.system, '
|
|
99
|
+
this.smartsoc = new socapp_1.SocApp(this.system, 'socapp');
|
|
100
100
|
this.smartsoc.serve();
|
|
101
101
|
}
|
|
102
102
|
catch (err) {
|
package/server/platform.ts
CHANGED
|
@@ -99,11 +99,11 @@ export class Platform extends Base {
|
|
|
99
99
|
log("homebridge", "platform - No SmartApp configured.");
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
// startup a SocApp if configured -> for proxy (not needed)
|
|
102
|
+
// startup a SocApp if configured -> for proxy (not needed for normal operations)
|
|
103
103
|
if (this.config.socapp) {
|
|
104
104
|
try {
|
|
105
105
|
// reuse the config file from the smartapp
|
|
106
|
-
this.smartsoc = new SocApp(this.system, '
|
|
106
|
+
this.smartsoc = new SocApp(this.system, 'socapp');
|
|
107
107
|
this.smartsoc.serve();
|
|
108
108
|
|
|
109
109
|
} catch(err) {
|
package/server/powerbase.js
CHANGED
|
@@ -249,7 +249,7 @@ class PowerBase extends base_1.Base {
|
|
|
249
249
|
//
|
|
250
250
|
updateBindings() {
|
|
251
251
|
// sort on channel.
|
|
252
|
-
this.bindings.sort((a, b) =>
|
|
252
|
+
this.bindings.sort((a, b) => a.register - b.register);
|
|
253
253
|
// sanitize and copy all rules into the config
|
|
254
254
|
this.config.bindings = this.bindings.map(b => types_1.Sanitizers.bindingConfig(b));
|
|
255
255
|
(0, logger_1.debug)("power", "config.bindings = " + JSON.stringify(this.config.bindings));
|
package/server/socapp.js
CHANGED
|
@@ -26,7 +26,7 @@ class SocApp extends webapp_1.WebApp {
|
|
|
26
26
|
// hashmap with all connected clients
|
|
27
27
|
this.clients = {};
|
|
28
28
|
if (this.config.debug)
|
|
29
|
-
logger_1.logSettings["
|
|
29
|
+
logger_1.logSettings["socapp"] = logger_1.LogLevel.debug;
|
|
30
30
|
this.port = port || this.config.port || this.port || 80;
|
|
31
31
|
this.system = system;
|
|
32
32
|
this.support = new support_1.Support(system);
|
|
@@ -53,7 +53,7 @@ class SocApp extends webapp_1.WebApp {
|
|
|
53
53
|
return this.serveFile(context, context.path);
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
|
-
(0, logger_1.err)("
|
|
56
|
+
(0, logger_1.err)("socapp", "Error serving URL: " + context.req.url);
|
|
57
57
|
return this.serveFile(context, "/index.html");
|
|
58
58
|
// return this.notFound(context.req.url);
|
|
59
59
|
}
|
|
@@ -61,7 +61,7 @@ class SocApp extends webapp_1.WebApp {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
serve() {
|
|
64
|
-
(0, logger_1.log)("
|
|
64
|
+
(0, logger_1.log)("socapp", "SocApp - Start http server on port " + this.port);
|
|
65
65
|
super.serve(() => {
|
|
66
66
|
const wsServer = new ws_1.Server({ server: this.server });
|
|
67
67
|
wsServer.on('connection', this.handleClient.bind(this));
|
|
@@ -71,7 +71,7 @@ class SocApp extends webapp_1.WebApp {
|
|
|
71
71
|
var _a, _b;
|
|
72
72
|
const data = fs.readFileSync("www" + fn);
|
|
73
73
|
const type = mime.lookup(fn) || "application/text";
|
|
74
|
-
(0, logger_1.log)("
|
|
74
|
+
(0, logger_1.log)("socapp", "Serve - " + (((_b = (_a = context.req) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress) || "no-remote") + ": " + fn + " - " + type);
|
|
75
75
|
return { status: 200, data, type };
|
|
76
76
|
}
|
|
77
77
|
renderLog() {
|
|
@@ -96,9 +96,9 @@ class SocApp extends webapp_1.WebApp {
|
|
|
96
96
|
handleClient(client, req) {
|
|
97
97
|
let target;
|
|
98
98
|
const clientAddr = client._socket.remoteAddress;
|
|
99
|
-
const logger = (msg) => (0, logger_1.log)('
|
|
99
|
+
const logger = (msg) => (0, logger_1.log)('socapp', clientAddr + ': ' + msg);
|
|
100
100
|
const info = (this.config.debug) ?
|
|
101
|
-
(msg) => logger('
|
|
101
|
+
(msg) => logger('socapp - ' + clientAddr + ': ' + msg) :
|
|
102
102
|
(msg) => null;
|
|
103
103
|
/////////////////////////////////////
|
|
104
104
|
// url parsing to find ip and port //
|
package/server/socapp.ts
CHANGED
|
@@ -3,7 +3,6 @@ import * as mime from 'mime-types';
|
|
|
3
3
|
import * as net from 'net';
|
|
4
4
|
import { Server as WSServer } from 'ws';
|
|
5
5
|
import { System } from '../duotecno/system';
|
|
6
|
-
import { LogFunction } from '../duotecno/types';
|
|
7
6
|
import { log, logSettings, LogLevel, err } from "../duotecno/logger";
|
|
8
7
|
import { Support } from './support';
|
|
9
8
|
import { Context, HttpResponse, WebApp } from "./webapp";
|
|
@@ -21,7 +20,7 @@ export class SocApp extends WebApp {
|
|
|
21
20
|
|
|
22
21
|
constructor(system: System, type: string, port?: number) {
|
|
23
22
|
super(type);
|
|
24
|
-
if (this.config.debug) logSettings["
|
|
23
|
+
if (this.config.debug) logSettings["socapp"] = LogLevel.debug;
|
|
25
24
|
|
|
26
25
|
this.port = port || this.config.port || this.port || 80;
|
|
27
26
|
|
|
@@ -50,7 +49,7 @@ export class SocApp extends WebApp {
|
|
|
50
49
|
return this.serveFile(context, context.path);
|
|
51
50
|
|
|
52
51
|
} catch(error) {
|
|
53
|
-
err("
|
|
52
|
+
err("socapp", "Error serving URL: " + context.req.url);
|
|
54
53
|
return this.serveFile(context, "/index.html");
|
|
55
54
|
// return this.notFound(context.req.url);
|
|
56
55
|
}
|
|
@@ -58,7 +57,7 @@ export class SocApp extends WebApp {
|
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
serve() {
|
|
61
|
-
log("
|
|
60
|
+
log("socapp", "SocApp - Start http server on port " + this.port);
|
|
62
61
|
super.serve(() => {
|
|
63
62
|
const wsServer = new WSServer({server: this.server});
|
|
64
63
|
wsServer.on('connection', this.handleClient.bind(this));
|
|
@@ -68,7 +67,7 @@ export class SocApp extends WebApp {
|
|
|
68
67
|
serveFile(context: Context, fn: string): HttpResponse {
|
|
69
68
|
const data = fs.readFileSync("www"+fn);
|
|
70
69
|
const type = mime.lookup(fn) || "application/text";
|
|
71
|
-
log("
|
|
70
|
+
log("socapp", "Serve - " + (context.req?.socket?.remoteAddress || "no-remote") + ": " + fn + " - " + type);
|
|
72
71
|
return { status: 200, data, type };
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -97,9 +96,9 @@ export class SocApp extends WebApp {
|
|
|
97
96
|
handleClient(client, req) {
|
|
98
97
|
let target: net.Socket;
|
|
99
98
|
const clientAddr = client._socket.remoteAddress;
|
|
100
|
-
const logger = (msg) => log('
|
|
99
|
+
const logger = (msg) => log('socapp', clientAddr + ': '+ msg);
|
|
101
100
|
const info = (this.config.debug) ?
|
|
102
|
-
(msg) => logger('
|
|
101
|
+
(msg) => logger('socapp - ' + clientAddr + ': '+ msg) :
|
|
103
102
|
(msg) => null;
|
|
104
103
|
|
|
105
104
|
/////////////////////////////////////
|
package/server/somfy.js
CHANGED
|
@@ -171,8 +171,9 @@ setup().then(() => {
|
|
|
171
171
|
init = true;
|
|
172
172
|
busy = false;
|
|
173
173
|
}).catch((e) => {
|
|
174
|
-
(0, logger_1.debug)("somfy", "
|
|
175
|
-
(
|
|
174
|
+
(0, logger_1.debug)("somfy", "gpio package not initialized");
|
|
175
|
+
if ((e.code != "EACCES") && (e.code != "ENOENT"))
|
|
176
|
+
(0, logger_1.debug)("somfy", e);
|
|
176
177
|
init = false;
|
|
177
178
|
busy = false;
|
|
178
179
|
});
|
package/server/somfy.ts
CHANGED
|
@@ -165,10 +165,10 @@ setup().then(() => {
|
|
|
165
165
|
debug("somfy", "gpio package initialized");
|
|
166
166
|
init = true;
|
|
167
167
|
busy = false;
|
|
168
|
-
|
|
168
|
+
|
|
169
169
|
}).catch((e) => {
|
|
170
170
|
debug("somfy", "gpio package not initialized");
|
|
171
|
-
if (e.code != "EACCES") debug("somfy", e);
|
|
171
|
+
if ((e.code != "EACCES") && (e.code != "ENOENT")) debug("somfy", e);
|
|
172
172
|
init = false;
|
|
173
173
|
busy = false;
|
|
174
174
|
});
|
package/www/index.html
ADDED