homebridge-lib 6.5.0 → 6.5.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.
@@ -101,6 +101,8 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
101
101
  * <br>Used by: homebridge-deconz, homebridge-hue2.
102
102
  * @property {Class} FireplaceEffect - Enabled/disable fireplace dynamic effect.
103
103
  * <br>Used by: homebridge-deconz, homebridge-hue2.
104
+ * @property {Class} GlistenEffect - Enabled/disable glisten dynamic effect.
105
+ * <br>Used by: homebridge-deconz, homebridge-hue2.
104
106
  * @property {Class} Heartrate - Refresh rate.
105
107
  * <br>Used by: homebridge-hue in HueBridge service,
106
108
  * by Homebridge-soma, by Homebridge-rpi, by Homebridge-ws.
@@ -122,6 +124,7 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
122
124
  * <br>Previously used by homebridge-hue for Thermostat sensor.
123
125
  * @property {Class} LogLevel - Level of logging.
124
126
  * @property {Class} LoopEffect - Enabled/disable loop dynamic effect.
127
+ * <br>Deprecated - use `PrismEffect`.
125
128
  * <br>Used by: homebridge-deconz, homebridge-hue2.
126
129
  * @property {Class} Loudness - Audio loudness.
127
130
  * <br>Used by: homebridge-zp in Speaker service.
@@ -138,10 +141,14 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
138
141
  * <br>Used by: homebridge-zp in Speaker service.
139
142
  * @property {Class} Offset - Temperature offset.
140
143
  * <br>Used by: homebridge-hue in Temperature service.
144
+ * @property {Class} OpalEffect - Enabled/disable opal dynamic effect.
145
+ * <br>Used by: homebridge-deconz, homebridge-hue2.
141
146
  * @property {Class} PartyEffect - Enabled/disable party dynamic effect.
142
147
  * <br>Used by: homebridge-deconz.
143
148
  * @property {Class} Period - Daylight period (e.g. Dawn).
144
149
  * <br>Used by: homebridge-hue for Daylight sensor.
150
+ * @property {Class} PrismEffect - Enabled/disable prism dynamic effect.
151
+ * <br>Used by: homebridge-deconz, homebridge-hue2.
145
152
  * @property {Class} PumpHours - Pump run time (in hours).
146
153
  * <br>Used by: homebridge-otgw.
147
154
  * @property {Class} PumpStarts - Number of pump starts.
@@ -807,7 +814,12 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
807
814
  this.createCharacteristicClass('LoopEffect', uuid('081'), {
808
815
  format: this.Formats.BOOL,
809
816
  perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
810
- }, 'Loop')
817
+ }, 'Prism')
818
+
819
+ this.createCharacteristicClass('PrismEffect', uuid('081'), {
820
+ format: this.Formats.BOOL,
821
+ perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
822
+ }, 'Prism')
811
823
 
812
824
  this.createCharacteristicClass('SunriseEffect', uuid('082'), {
813
825
  format: this.Formats.BOOL,
@@ -851,6 +863,18 @@ class MyHomeKitTypes extends CustomHomeKitTypes {
851
863
  perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
852
864
  }, 'Night Light')
853
865
 
866
+ // More dynamic effects for Hue lights.
867
+
868
+ this.createCharacteristicClass('OpalEffect', uuid('08A'), {
869
+ format: this.Formats.BOOL,
870
+ perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
871
+ }, 'Opal')
872
+
873
+ this.createCharacteristicClass('GlistenEffect', uuid('08B'), {
874
+ format: this.Formats.BOOL,
875
+ perms: [this.Perms.PAIRED_READ, this.Perms.NOTIFY, this.Perms.PAIRED_WRITE]
876
+ }, 'Glisten')
877
+
854
878
  // Characteristic for Unique ID, used by homebridge-hue.
855
879
  // Source: as exposed by the Philips Hue bridge. This characteristic is
856
880
  // used by the Hue app to select the accessories when syncing Hue bridge
@@ -365,78 +365,78 @@ class History extends ServiceDelegate {
365
365
  * corresponding HomeKit accessory.
366
366
  * @param {!object} params - The parameters for the _History_ HomeKit service.
367
367
  * @param {?CharacteristicDelegate} params.contactDelegate - The
368
- * `hap.ContactSensorState` characteristic delegate
368
+ * `Characteristics.hap.ContactSensorState` characteristic delegate
369
369
  * for a `hap.ContactSensor` service.
370
370
  * @param {?CharacteristicDelegate} params.lastContactDelegate - The
371
- * `eve.LastActivation` characteristic delegate
371
+ * `Characteristics.eve.LastActivation` characteristic delegate
372
372
  * for a `hap.ContactSensor` service.
373
373
  * @param {?CharacteristicDelegate} params.timesOpenedDelegate - The
374
- * `eve.TimesOpened` characteristic delegate
374
+ * `Characteristics.eve.TimesOpened` characteristic delegate
375
375
  * for a `hap.ContactSensor` service.
376
376
  * @param {?CharacteristicDelegate} params.motionDelegate - The
377
- * `.hap.MotionDetected` characteristic delegate
377
+ * `Characteristics.hap.MotionDetected` characteristic delegate
378
378
  * for a `hap.MotionSensor` service.
379
379
  * @param {?CharacteristicDelegate} params.lastMotionDelegate - The
380
- * `.eve.LastActivation` characteristic delegate
380
+ * `Characteristics.eve.LastActivation` characteristic delegate
381
381
  * for a `hap.MotionSensor` service.
382
382
  * @param {?CharacteristicDelegate} params.lightLevelDelegate - The
383
- * `.hap.CurrentAmbientLightLevel` characteristic delegate
383
+ * `Characteristics.hap.CurrentAmbientLightLevel` characteristic delegate
384
384
  * for a `hap.LightLevelSensor` service.
385
385
  * @param {?CharacteristicDelegate} params.temperatureDelegate - The
386
- * `.hap.CurrentTemperature` characteristic delegate
386
+ * `Characteristics.hap.CurrentTemperature` characteristic delegate
387
387
  * for a `hap.TemperatureSensor`, `eve.Weather`, or `hap.Thermostat` service.
388
388
  * @param {?CharacteristicDelegate} params.humidityDelegate - The
389
- * `hap.CurrentRelativeHumidity` characteristic delegate
389
+ * `Characteristics.hap.CurrentRelativeHumidity` characteristic delegate
390
390
  * for a `hap.HumiditySensor` or `eve.Weather` service.
391
391
  * @param {?CharacteristicDelegate} params.airPressureDelegate - The
392
- * `.eve.AirPressure` characteristic delegate
392
+ * `Characteristics.eve.AirPressure` characteristic delegate
393
393
  * for an `eve.AirPressureSensor` or `eve.Weather` service.
394
394
  * @param {?CharacteristicDelegate} params.vocDensityDelegate - The
395
- * `hap.VOCDensity` characteristic delegate
395
+ * `Characteristics.hap.VOCDensity` characteristic delegate
396
396
  * for a `hap.AirQualilitySensor` service.
397
397
  * @param {?CharacteristicDelegate} params.targetTemperatureDelegate - The
398
- * `hap.TargetTemperature` characteristic delegate
398
+ * `Characteristics.hap.TargetTemperature` characteristic delegate
399
399
  * for a `hap.Thermostat` service.
400
400
  * @param {?CharacteristicDelegate} params.valvePositionDelegate - The
401
- * `.eve.ValvePosition` characteristic delegate
401
+ * `Characteristics.eve.ValvePosition` characteristic delegate
402
402
  * for a `hap.Thermostat` service.
403
403
  * @param {?CharacteristicDelegate} params.onDelegate - The
404
404
  * `Characteristics.hap.On` characteristic delegate
405
405
  * for a `hap.Outlet` service.
406
406
  * @param {?CharacteristicDelegate} params.lastOnDelegate - The
407
- * `.eve.LastActivation` characteristic delegate
407
+ * `Characteristics.eve.LastActivation` characteristic delegate
408
408
  * for a `hap.Outlet` service.
409
409
  * @param {?CharacteristicDelegate} params.consumptionDelegate - The
410
- * `.eve.Consumption` characteristic delegate
410
+ * `Characteristics.eve.Consumption` characteristic delegate
411
411
  * for a `hap.Outlet` or `eve.Consumption` service
412
412
  * for a device that reports power.
413
413
  * @param {?CharacteristicDelegate} params.computedTotalConsumptionDelegate - The
414
- * `eve.TotalConsumption` characteristic delegate
414
+ * `Characteristics.eve.TotalConsumption` characteristic delegate
415
415
  * for a `hap.Outlet` or `eve.Consumption` service
416
416
  * for a device that reports power, but not total consumption.
417
417
  * @param {?CharacteristicDelegate} params.totalConsumptionDelegate - The
418
- * `.eve.TotalConsumption` characteristic delegate
418
+ * `Characteristics.eve.TotalConsumption` characteristic delegate
419
419
  * for a `hap.Outlet` or `eve.Consumption` service
420
420
  * for a device that reports total consumption.
421
421
  * @param {?CharacteristicDelegate} params.computedConsumptionDelegate - The
422
- * `.eve.Consumption` characteristic delegate
422
+ * `Characteristics.eve.Consumption` characteristic delegate
423
423
  * for a `hap.Outlet` or `eve.Consumption` service
424
424
  * for a device that reports total consumption but not power.
425
425
  * @param {?CharacteristicDelegate} params.avarageConsumptionDelegate - The
426
- * `.eve.Consumption` characteristic delegate
426
+ * `Characteristics.eve.Consumption` characteristic delegate
427
427
  * for a `hap.Outlet` or `eve.Consumption` service
428
428
  * for a device that reports runing average for power.
429
429
  * @param {?CharacteristicDelegate} params.lightOnDelegate - The
430
430
  * `Characteristics.hap.On` characteristic delegate
431
431
  * for a `hap.Lightbulb` service.
432
432
  * @param {?CharacteristicDelegate} params.lastLightOnDelegate - A
433
- * `.eve.LastActivation` characteristic delegate
433
+ * `Characteristics.eve.LastActivation` characteristic delegate
434
434
  * for a `hap.Lightbulb` service.
435
435
  * @param {?CharacteristicDelegate} params.switchOnDelegate - The
436
436
  * `Characteristics.hap.On` characteristic delegate
437
437
  * for a `hap.Switch` service.
438
438
  * @param {?CharacteristicDelegate} params.lastSwitchOnDelegate - A
439
- * `.eve.LastActivation` characteristic delegate
439
+ * `Characteristics.eve.LastActivation` characteristic delegate
440
440
  * for a `hap.Switch` service.
441
441
  * @param {integer} [params.memorySize=4032] - The memory size, in number of
442
442
  * history entries. The default is 4 weeks of 1 entry per 10 minutes.
@@ -510,6 +510,10 @@ class History extends ServiceDelegate {
510
510
  key: 'history',
511
511
  silent: true
512
512
  })
513
+ if (this.values.history?.initialTime > History.now()) {
514
+ this.warn('resetting history after time travel from %s', dateToString(this.values.history.initialTime))
515
+ this.values.history = null
516
+ }
513
517
  this._h = this.values.history
514
518
  if (this._h == null) {
515
519
  this.values.history = {
@@ -616,6 +620,18 @@ class History extends ServiceDelegate {
616
620
  })
617
621
  }
618
622
 
623
+ addLastOnDelegate (onDelegate, lastOnDelegate) {
624
+ if (!(onDelegate instanceof CharacteristicDelegate)) {
625
+ throw new TypeError('onDelegate: not a CharacteristicDelegate')
626
+ }
627
+ if (!(lastOnDelegate instanceof CharacteristicDelegate)) {
628
+ throw new TypeError('lastOnDelegate: not a CharacteristicDelegate')
629
+ }
630
+ onDelegate.on('didSet', (value) => {
631
+ lastOnDelegate.value = this.lastActivationValue()
632
+ })
633
+ }
634
+
619
635
  /** Return current time as # seconds since NodeJS epoch.
620
636
  * @returns {integer} # seconds since NodeJS epoch.
621
637
  */
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.5.0",
6
+ "version": "6.5.1",
7
7
  "keywords": [
8
8
  "homekit",
9
9
  "homebridge"
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "engines": {
24
24
  "homebridge": "^1.6.1",
25
- "node": "18.17.1||^18||^16"
25
+ "node": "20.7.0||^20||^18"
26
26
  },
27
27
  "dependencies": {
28
28
  "@homebridge/plugin-ui-utils": "~0.0.19",
29
- "hb-lib-tools": "~1.1.0"
29
+ "hb-lib-tools": "~1.1.1"
30
30
  },
31
31
  "scripts": {
32
32
  "prepare": "standard && rm -rf out && jsdoc -c jsdoc.json",