homebridge-lib 6.3.4 → 6.3.5

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.
@@ -34,6 +34,7 @@ class AccessoryDelegate extends homebridgeLib.Delegate {
34
34
  * @param {!string} params.firmware - The accessory firmware revision.
35
35
  * @param {?string} params.hardware - The accessory hardware revision.
36
36
  * @param {?string} params.software - The accessory software revision.
37
+ * @param {?integer} params.logLevel - The log level for the accessory
37
38
  */
38
39
  constructor (platform, params = {}) {
39
40
  if (params.name == null) {
@@ -46,6 +47,9 @@ class AccessoryDelegate extends homebridgeLib.Delegate {
46
47
  if (params.id === '') {
47
48
  throw new RangeError('params.id: invalid id')
48
49
  }
50
+ if (params.logLevel == null) {
51
+ params.logLevel = platform.logLevel
52
+ }
49
53
 
50
54
  // Link or create associated PlatformAccessory.
51
55
  this._accessory = this._platform._getAccessory(this, params)
@@ -59,10 +63,13 @@ class AccessoryDelegate extends homebridgeLib.Delegate {
59
63
  this.addPropertyDelegate({ key: 'version', silent: true })
60
64
  this.values.version = platform.packageJson.version
61
65
  this.addPropertyDelegate({ key: 'id', value: params.id, silent: true })
62
- this.addPropertyDelegate({ key: 'logLevel', value: platform.logLevel })
66
+ this.addPropertyDelegate({ key: 'logLevel', value: params.logLevel })
63
67
  this.addPropertyDelegate({ key: 'name', value: this.name, silent: true })
64
68
  .on('didSet', (name) => { this.name = name })
65
- this.addPropertyDelegate({ key: 'uiPort', silent: true })
69
+ if (platform._ui != null) {
70
+ this._context.uiPort = platform._ui.port
71
+ this.addPropertyDelegate({ key: 'uiPort', silent: true })
72
+ }
66
73
 
67
74
  // Create delegate for AccessoryInformation service.
68
75
  this._serviceDelegates = {}
@@ -416,20 +416,25 @@ class History extends ServiceDelegate {
416
416
  let i = 0
417
417
  for (const param of Object.keys(params)) {
418
418
  if (param.endsWith('Delegate')) {
419
+ if (params[param] == null) {
420
+ continue
421
+ }
419
422
  if (!(params[param] instanceof CharacteristicDelegate)) {
420
423
  throw new TypeError(`params.${param}: not a CharacteristicDelegate`)
421
424
  }
422
425
  const key = param.slice(0, -8)
423
426
  if (historyDerivedTypes[key] != null) {
424
427
  if (params[historyDerivedTypes[key] + 'Delegate'] == null) {
425
- throw new SyntaxError(`params.${param}: missing params.${key}Delegate`)
428
+ throw new SyntaxError(
429
+ `params.${param}: missing params.${historyDerivedTypes[key]}Delegate`
430
+ )
426
431
  }
427
432
  this[param] = params[param]
428
433
  continue
429
434
  }
430
435
  if (key === 'lightOn') {
431
436
  if (!(params.lastLightOnDelegate instanceof CharacteristicDelegate)) {
432
- throw new SyntaxError(`params.${param}: missing params.${key}Delegate`)
437
+ throw new SyntaxError(`params.${param}: missing params.lastLightOnDelegate`)
433
438
  }
434
439
  params[param].on('didSet', (value) => {
435
440
  const now = History.now()
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Library for homebridge plugins",
4
4
  "author": "Erik Baauw",
5
5
  "license": "Apache-2.0",
6
- "version": "6.3.4",
6
+ "version": "6.3.5",
7
7
  "keywords": [
8
8
  "homekit",
9
9
  "homebridge"
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "engines": {
24
24
  "homebridge": "^1.6.0",
25
- "node": "^18.13.0"
25
+ "node": "^18.14.0"
26
26
  },
27
27
  "dependencies": {
28
28
  "@homebridge/plugin-ui-utils": "~0.0.19",