node-red-contrib-homekit-bridged 1.6.0-dev.0 → 1.6.0-dev.1
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/build/lib/HAPHostNode.js
CHANGED
|
@@ -94,12 +94,17 @@ module.exports = (RED, hostType) => {
|
|
|
94
94
|
self.published = false;
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
|
+
let oldPinCode = self.config.pinCode;
|
|
98
|
+
if ((oldPinCode.match(/-/g) || []).length == 1) {
|
|
99
|
+
oldPinCode = oldPinCode.replace(/-/g, '');
|
|
100
|
+
oldPinCode = `${oldPinCode.slice(0, 3)}-${oldPinCode.slice(3, 5)}-${oldPinCode.slice(5, 8)}`;
|
|
101
|
+
}
|
|
97
102
|
self.host.publish({
|
|
98
103
|
username: self.bridgeUsername,
|
|
99
104
|
port: self.config.port && !isNaN(self.config.port)
|
|
100
105
|
? self.config.port
|
|
101
106
|
: 0,
|
|
102
|
-
pincode:
|
|
107
|
+
pincode: oldPinCode,
|
|
103
108
|
category: self.accessoryCategory,
|
|
104
109
|
mdns: self.mdnsConfig,
|
|
105
110
|
advertiser: (_c = self.config.advertiser) !== null && _c !== void 0 ? _c : "bonjour-hap",
|
package/build/nodes/bridge.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script data-template-name="homekit-bridge" type="text/x-red">
|
|
2
2
|
<div class="form-row">
|
|
3
3
|
<label for="node-config-input-pinCode"><i class="fa fa-lock"></i> Pin Code</label>
|
|
4
|
-
<input type="text" id="node-config-input-pinCode" placeholder="
|
|
4
|
+
<input type="text" id="node-config-input-pinCode" placeholder="xxxx-xxxx">
|
|
5
5
|
</div>
|
|
6
6
|
<div class="form-row">
|
|
7
7
|
<label for="node-config-input-port"><i class="fa fa-plug"></i> Port</label>
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
},
|
|
138
138
|
pinCode: {
|
|
139
139
|
required: true,
|
|
140
|
-
validate:
|
|
140
|
+
validate: pinCodeRegex,
|
|
141
141
|
},
|
|
142
142
|
port: {
|
|
143
143
|
required: false,
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
return this.bridgeName ? 'node_label_italic' : ''
|
|
230
230
|
},
|
|
231
231
|
oneditprepare: function () {
|
|
232
|
-
if (!
|
|
232
|
+
if (!pinCodeRegex(this.pinCode)) {
|
|
233
233
|
this.pinCode = generatePinCode()
|
|
234
234
|
$("#node-config-input-pinCode").val(this.pinCode)
|
|
235
235
|
}
|
package/build/nodes/nrchkb.html
CHANGED
|
@@ -416,8 +416,10 @@
|
|
|
416
416
|
|
|
417
417
|
const generatePinCode = function () {
|
|
418
418
|
const [a, b, c, d, e, f, g, h] = Array.from({length: 9}, () => getRandomIntInclusive(0, 9));
|
|
419
|
-
return `${a}${b}${c}
|
|
419
|
+
return `${a}${b}${c}${d}-${e}${f}${g}${h}`
|
|
420
420
|
}
|
|
421
|
+
|
|
422
|
+
const pinCodeRegex = RED.validators.regex(/([0-9]{3}-[0-9]{2}-[0-9]{3}|[0-9]{4}-[0-9]{4})/)
|
|
421
423
|
</script>
|
|
422
424
|
|
|
423
425
|
<script data-template-name="nrchkb" type="text/x-red">
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
<div class="form-row">
|
|
11
11
|
<label for="node-config-input-pinCode"><i class="fa fa-lock"></i> Pin Code</label>
|
|
12
|
-
<input type="text" id="node-config-input-pinCode" placeholder="
|
|
12
|
+
<input type="text" id="node-config-input-pinCode" placeholder="xxxx-xxxx">
|
|
13
13
|
</div>
|
|
14
14
|
<div class="form-row">
|
|
15
15
|
<label for="node-config-input-port"><i class="fa fa-plug"></i> Port</label>
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
},
|
|
147
147
|
pinCode: {
|
|
148
148
|
required: true,
|
|
149
|
-
validate:
|
|
149
|
+
validate: pinCodeRegex,
|
|
150
150
|
},
|
|
151
151
|
port: {
|
|
152
152
|
required: false,
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
oneditprepare: function () {
|
|
241
241
|
const node = this
|
|
242
242
|
|
|
243
|
-
if (!
|
|
243
|
+
if (!pinCodeRegex(node.pinCode)) {
|
|
244
244
|
node.pinCode = generatePinCode()
|
|
245
245
|
$("#node-config-input-pinCode").val(node.pinCode)
|
|
246
246
|
}
|
package/package.json
CHANGED
|
@@ -1,90 +1,88 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [
|
|
19
|
-
"homekit",
|
|
20
|
-
"node-red",
|
|
21
|
-
"NRCHKB",
|
|
22
|
-
"iot",
|
|
23
|
-
"home",
|
|
24
|
-
"hap-nodejs",
|
|
25
|
-
"homebridge"
|
|
26
|
-
],
|
|
27
|
-
"node-red": {
|
|
28
|
-
"nodes": {
|
|
29
|
-
"nrchkb": "build/nodes/nrchkb.js",
|
|
30
|
-
"bridge": "build/nodes/bridge.js",
|
|
31
|
-
"standalone": "build/nodes/standalone.js",
|
|
32
|
-
"service": "build/nodes/service.js",
|
|
33
|
-
"service2": "build/nodes/service2.js",
|
|
34
|
-
"status": "build/nodes/status.js"
|
|
2
|
+
"name": "node-red-contrib-homekit-bridged",
|
|
3
|
+
"version": "1.6.0-dev.1",
|
|
4
|
+
"description": "Node-RED nodes to simulate Apple HomeKit devices.",
|
|
5
|
+
"main": "build/nodes/nrchkb.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm run clean && tsc",
|
|
8
|
+
"clean": "rimraf build/lib build/**/*.js",
|
|
9
|
+
"test": "mocha -r ts-node/register './src/**/*.test.[tj]s' --exit --timeout 30000",
|
|
10
|
+
"prettier": "prettier --write \"**/*.{js,ts}\"",
|
|
11
|
+
"eslint": "eslint \"src/**/*.ts\"",
|
|
12
|
+
"prepare": "husky install"
|
|
35
13
|
},
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"homekit",
|
|
20
|
+
"node-red",
|
|
21
|
+
"NRCHKB",
|
|
22
|
+
"iot",
|
|
23
|
+
"home",
|
|
24
|
+
"hap-nodejs",
|
|
25
|
+
"homebridge"
|
|
26
|
+
],
|
|
27
|
+
"node-red": {
|
|
28
|
+
"nodes": {
|
|
29
|
+
"nrchkb": "build/nodes/nrchkb.js",
|
|
30
|
+
"bridge": "build/nodes/bridge.js",
|
|
31
|
+
"standalone": "build/nodes/standalone.js",
|
|
32
|
+
"service": "build/nodes/service.js",
|
|
33
|
+
"service2": "build/nodes/service2.js",
|
|
34
|
+
"status": "build/nodes/status.js"
|
|
35
|
+
},
|
|
36
|
+
"version": ">=1.3.7"
|
|
37
|
+
},
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Tadeusz Wyrzykowski",
|
|
40
|
+
"email": "shaquu@icloud.com",
|
|
41
|
+
"url": "https://github.com/Shaquu"
|
|
42
|
+
},
|
|
43
|
+
"license": "Apache-2.0",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged/issues"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/NRCHKB/node-red-contrib-homekit-bridged#readme",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@nrchkb/logger": "^2.0.0",
|
|
50
|
+
"hap-nodejs": "0.11.1",
|
|
51
|
+
"node-persist": "^3.1.3",
|
|
52
|
+
"semver": "^7.5.4",
|
|
53
|
+
"uuid": "^9.0.1"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@homebridge/ciao": "^1.1.8",
|
|
57
|
+
"@node-red/registry": "^3.1.3",
|
|
58
|
+
"@types/mocha": "^10.0.6",
|
|
59
|
+
"@types/node": "^12",
|
|
60
|
+
"@types/node-persist": "^3.1.8",
|
|
61
|
+
"@types/node-red": "^1.3.4",
|
|
62
|
+
"@types/node-red-node-test-helper": "^0.3.3",
|
|
63
|
+
"@types/semver": "^7.5.6",
|
|
64
|
+
"@types/uuid": "^9.0.7",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^6.18.0",
|
|
66
|
+
"@typescript-eslint/parser": "^6.18.0",
|
|
67
|
+
"babel-eslint": "^10.1.0",
|
|
68
|
+
"eslint": "^8.56.0",
|
|
69
|
+
"eslint-config-prettier": "^9.1.0",
|
|
70
|
+
"eslint-plugin-prettier": "^5.1.2",
|
|
71
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
72
|
+
"husky": "^8.0.3",
|
|
73
|
+
"mocha": "^10.2.0",
|
|
74
|
+
"node-red": "^3.1.3",
|
|
75
|
+
"node-red-node-test-helper": "^0.3.3",
|
|
76
|
+
"prettier": "^3.1.1",
|
|
77
|
+
"rimraf": "^5.0.5",
|
|
78
|
+
"ts-node": "^10.9.2",
|
|
79
|
+
"typescript": "^5.3.3"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=12"
|
|
83
|
+
},
|
|
84
|
+
"files": [
|
|
85
|
+
"/build",
|
|
86
|
+
"/examples"
|
|
87
|
+
]
|
|
90
88
|
}
|