homebridge-nb 1.2.6 → 1.2.7

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/cli/nb.js CHANGED
@@ -605,10 +605,10 @@ class Main extends homebridgeLib.CommandLineTool {
605
605
  .flag('n', 'noWhiteSpace', () => { noWhiteSpace = true })
606
606
  .flag('s', 'service', () => { mode = 'service' })
607
607
  .parse(...args)
608
- this.setOptions({ mode: mode })
608
+ this.setOptions({ mode })
609
609
  const jsonFormatter = new homebridgeLib.JsonFormatter({
610
610
  sortKeys: true,
611
- noWhiteSpace: noWhiteSpace
611
+ noWhiteSpace
612
612
  })
613
613
 
614
614
  this.listener = new NbListener()
@@ -238,7 +238,7 @@ class Bridge extends homebridgeLib.AccessoryDelegate {
238
238
  case NbClient.DeviceTypes.SMARTLOCK3:
239
239
  if (this.smartLocks[id] == null) {
240
240
  this.addSmartLock(id, {
241
- id: id,
241
+ id,
242
242
  name: device.name,
243
243
  firmware: device.firmwareVersion,
244
244
  deviceType: device.deviceType
@@ -246,6 +246,10 @@ class Bridge extends homebridgeLib.AccessoryDelegate {
246
246
  }
247
247
  this.smartLocks[id].values.firmware = device.firmwareVersion
248
248
  this.smartLocks[id].context.deviceType = device.deviceType
249
+ if (device.lastKnownState == null) {
250
+ this.smartLocks[id].warn('no last known state')
251
+ continue
252
+ }
249
253
  this.smartLocks[id].update(device.lastKnownState)
250
254
  if (
251
255
  device.lastKnownState.doorsensorState != null &&
@@ -270,7 +274,7 @@ class Bridge extends homebridgeLib.AccessoryDelegate {
270
274
  case NbClient.DeviceTypes.OPENER:
271
275
  if (this.openers[id] == null) {
272
276
  this.addOpener(id, {
273
- id: id,
277
+ id,
274
278
  name: device.name,
275
279
  firmware: device.firmwareVersion,
276
280
  deviceType: device.deviceType
@@ -278,6 +282,10 @@ class Bridge extends homebridgeLib.AccessoryDelegate {
278
282
  }
279
283
  this.openers[id].values.firmware = device.firmwareVersion
280
284
  this.openers[id].context.deviceType = device.deviceType
285
+ if (device.lastKnownState == null) {
286
+ this.openers[id].warn('no last known state')
287
+ continue
288
+ }
281
289
  this.openers[id].update(device.lastKnownState)
282
290
  break
283
291
  default:
@@ -296,7 +304,6 @@ class SmartLock extends NbAccessory {
296
304
  params.category = bridge.Accessory.Categories.DOOR_LOCK
297
305
  params.model = NbClient.modelName(params.deviceType, params.firmware)
298
306
  super(bridge, params)
299
- this.context.deviceType = params.firmware
300
307
  this.batteryService = new homebridgeLib.ServiceDelegate.Battery(this)
301
308
  this.service = new NbService.SmartLock(this)
302
309
  if (this.platform.config.latch) {
package/lib/NbClient.js CHANGED
@@ -142,20 +142,20 @@ class NbClient extends homebridgeLib.HttpClient {
142
142
  async fwupdate () { return this._get('/fwupdate') }
143
143
 
144
144
  async lockState (nukiId, deviceType) {
145
- return this._get('/lockState', { nukiId: nukiId, deviceType: deviceType })
145
+ return this._get('/lockState', { nukiId, deviceType })
146
146
  }
147
147
 
148
148
  async lock (nukiId, deviceType) {
149
- return this._get('/lock', { nukiId: nukiId, deviceType: deviceType })
149
+ return this._get('/lock', { nukiId, deviceType })
150
150
  }
151
151
 
152
152
  async unlock (nukiId, deviceType) {
153
- return this._get('/unlock', { nukiId: nukiId, deviceType: deviceType })
153
+ return this._get('/unlock', { nukiId, deviceType })
154
154
  }
155
155
 
156
156
  async lockAction (nukiId, deviceType, action) {
157
157
  return this._get(
158
- '/lockAction', { nukiId: nukiId, deviceType: deviceType, action: action }
158
+ '/lockAction', { nukiId, deviceType, action }
159
159
  )
160
160
  }
161
161
 
@@ -170,7 +170,7 @@ class NbClient extends homebridgeLib.HttpClient {
170
170
  }
171
171
 
172
172
  async callbackList () { return this._get('/callback/list') }
173
- async callbackRemove (id) { return this._get('/callback/remove', { id: id }) }
173
+ async callbackRemove (id) { return this._get('/callback/remove', { id }) }
174
174
 
175
175
  async _get (resource, params = {}) {
176
176
  // Append parameters
package/lib/NbPlatform.js CHANGED
@@ -138,7 +138,7 @@ class NbPlatform extends homebridgeLib.Platform {
138
138
  const name = 'Bridge_' + id
139
139
  this.debug('%s: found bridge %s at %s', name, id, host)
140
140
  const client = new NbClient({
141
- host: host,
141
+ host,
142
142
  timeout: 60
143
143
  })
144
144
  client
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName": "Homebridge NB",
5
5
  "author": "Erik Baauw",
6
6
  "license": "Apache-2.0",
7
- "version": "1.2.6",
7
+ "version": "1.2.7",
8
8
  "keywords": [
9
9
  "homebridge-plugin",
10
10
  "homekit",
@@ -18,11 +18,11 @@
18
18
  "nb": "cli/nb.js"
19
19
  },
20
20
  "engines": {
21
- "homebridge": "^1.4.0",
22
- "node": "^16.14.2"
21
+ "homebridge": "^1.4.1",
22
+ "node": "^16.15.0"
23
23
  },
24
24
  "dependencies": {
25
- "homebridge-lib": "~5.3.2"
25
+ "homebridge-lib": "~5.5.0"
26
26
  },
27
27
  "scripts": {
28
28
  "prepare": "standard",