homebridge-nb 1.4.21 → 1.4.23

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.
@@ -23,6 +23,31 @@
23
23
  "type": "integer"
24
24
  }
25
25
  },
26
+ "encryption": {
27
+ "description": "Encryption for Nuki bridge token. Default: Encrypted.",
28
+ "type": "string",
29
+ "required": true,
30
+ "oneOf": [
31
+ {
32
+ "title": "None",
33
+ "enum": [
34
+ "none"
35
+ ]
36
+ },
37
+ {
38
+ "title": "Hashed Token",
39
+ "enum": [
40
+ "hashedToken"
41
+ ]
42
+ },
43
+ {
44
+ "title": "Encrypted Token",
45
+ "enum": [
46
+ "encryptedToken"
47
+ ]
48
+ }
49
+ ]
50
+ },
26
51
  "latch": {
27
52
  "description": "Expose a second <i>Lock Mechanism</i> service to unlatch a Smart Lock.",
28
53
  "type": "boolean"
@@ -83,6 +108,7 @@
83
108
  }
84
109
  ]
85
110
  },
111
+ "encryption",
86
112
  "openerResetTimeout",
87
113
  "port",
88
114
  "removeStaleAccessories",
@@ -43,6 +43,7 @@ class Bridge extends AccessoryDelegate {
43
43
  this.dummyService = new ServiceDelegate.Dummy(this)
44
44
 
45
45
  this.client = new NbClient({
46
+ encryption: platform.config.encryption,
46
47
  host: this.context.host,
47
48
  timeout: platform.config.timeout,
48
49
  token: this.context.token
@@ -146,13 +147,13 @@ class Bridge extends AccessoryDelegate {
146
147
  }
147
148
  }
148
149
  this.context.callbackUrl = await this.platform.addClient(this.client)
150
+ this.debug('initialised')
151
+ this.emit('initialised')
149
152
  this.initialBeat = beat
150
153
  try {
151
154
  await this.heartbeat(beat)
152
155
  } catch (error) {}
153
156
  this.on('heartbeat', this.heartbeat)
154
- this.debug('initialised')
155
- this.emit('initialised')
156
157
  }
157
158
 
158
159
  async checkSubscription () {
package/lib/NbPlatform.js CHANGED
@@ -24,6 +24,7 @@ class NbPlatform extends Platform {
24
24
  super(log, configJson, homebridge)
25
25
  this.config = {
26
26
  devices: [],
27
+ encryption: 'encryptedToken',
27
28
  openerResetTimeout: 500,
28
29
  timeout: 15
29
30
  }
@@ -32,6 +33,10 @@ class NbPlatform extends Platform {
32
33
  .stringKey('platform')
33
34
  .stringKey('name')
34
35
  .arrayKey('devices')
36
+ .enumKey('encryption')
37
+ .enumKeyValue('encryption', 'none')
38
+ .enumKeyValue('encryption', 'hashedToken')
39
+ .enumKeyValue('encryption', 'encryptedToken')
35
40
  .boolKey('latch')
36
41
  .intKey('port', 0, 65535)
37
42
  .intKey('openerResetTimeout', 0, 2000) // milliseconds
@@ -173,9 +178,10 @@ class NbPlatform extends Platform {
173
178
  }
174
179
  const host = bridge.ip + ':' + bridge.port
175
180
  if (this.bridges[id] == null) {
176
- const name = 'Nuki_Bridge_' + id
181
+ const name = 'Nuki Bridge ' + id
177
182
  this.debug('%s: found bridge %s at %s', name, id, host)
178
183
  const client = new NbClient({
184
+ encryption: this.config.encryption,
179
185
  host,
180
186
  timeout: 60
181
187
  })
@@ -242,9 +248,26 @@ class NbPlatform extends Platform {
242
248
  }
243
249
  switch (className) {
244
250
  case 'Bridge':
245
- context.id = id
246
- context.name = name
247
- this.bridges[id] = new NbAccessory.Bridge(this, context)
251
+ {
252
+ context.id = id
253
+ // Dirty hack en lieu of patching cachedAccessories
254
+ let needPatch = false
255
+ if (name.startsWith('Nuki_Bridge_')) {
256
+ name = name.replace(/_/g, ' ')
257
+ needPatch = true
258
+ }
259
+ // End hack
260
+ context.name = name
261
+ this.bridges[id] = new NbAccessory.Bridge(this, context)
262
+ // Dirty hack en lieu of patching cachedAccessories
263
+ if (needPatch) {
264
+ this.bridges[id]._accessory._associatedHAPAccessory.displayName = name
265
+ this.bridges[id]._context.name = name
266
+ this.bridges[id].service.values.configuredName = name
267
+ this.bridges[id].dummyService.values.configuredName = name
268
+ }
269
+ // End hack
270
+ }
248
271
  break
249
272
  case 'SmartLock':
250
273
  case 'DoorSensor':
package/package.json CHANGED
@@ -3,8 +3,11 @@
3
3
  "description": "Homebridge plugin for Nuki Bridge",
4
4
  "displayName": "Homebridge NB",
5
5
  "author": "Erik Baauw",
6
+ "maintainers": [
7
+ "ebaauw"
8
+ ],
6
9
  "license": "Apache-2.0",
7
- "version": "1.4.21",
10
+ "version": "1.4.23",
8
11
  "keywords": [
9
12
  "homebridge-plugin",
10
13
  "homekit",
@@ -19,13 +22,13 @@
19
22
  "nb": "cli/nb.js"
20
23
  },
21
24
  "engines": {
22
- "homebridge": "^1.8.3",
25
+ "homebridge": "^1.8.4||^2.0.0-beta",
23
26
  "node": "^20||^18",
24
27
  "nuki": "2.18.0"
25
28
  },
26
29
  "dependencies": {
27
- "homebridge-lib": "~7.0.4",
28
- "hb-nb-tools": "~2.0.3"
30
+ "homebridge-lib": "~7.0.5",
31
+ "hb-nb-tools": "~2.0.5"
29
32
  },
30
33
  "scripts": {
31
34
  "prepare": "standard",