From 94005132063879d68f4fb33af4acee6a7b77a494 Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Tue, 16 Jul 2024 09:24:53 -0500 Subject: [PATCH] Fixes for HAP-NodeJS v1.0.0 (#1447) --- packages/homebridge-ring/base-accessory.ts | 5 +---- packages/homebridge-ring/base-device-accessory.ts | 6 +++--- packages/homebridge-ring/camera.ts | 6 +++--- packages/homebridge-ring/intercom.ts | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/homebridge-ring/base-accessory.ts b/packages/homebridge-ring/base-accessory.ts index 67d8dffe..86f53a48 100644 --- a/packages/homebridge-ring/base-accessory.ts +++ b/packages/homebridge-ring/base-accessory.ts @@ -132,10 +132,7 @@ export abstract class BaseAccessory { } pruneUnusedServices() { - const safeServiceUUIDs = [ - hap.Service.CameraRTPStreamManagement.UUID, - hap.Service.CameraControl.UUID, - ] + const safeServiceUUIDs = [hap.Service.CameraRTPStreamManagement.UUID] this.accessory.services.forEach((service) => { if ( diff --git a/packages/homebridge-ring/base-device-accessory.ts b/packages/homebridge-ring/base-device-accessory.ts index 56025f0b..e15c8bf8 100644 --- a/packages/homebridge-ring/base-device-accessory.ts +++ b/packages/homebridge-ring/base-device-accessory.ts @@ -100,17 +100,17 @@ export abstract class BaseDeviceAccessory extends BaseDataAccessory if (hasBatteryStatus(initialData)) { this.registerCharacteristic({ characteristicType: Characteristic.BatteryLevel, - serviceType: Service.BatteryService, + serviceType: Service.Battery, getValue: getBatteryLevel, }) this.registerCharacteristic({ characteristicType: Characteristic.StatusLowBattery, - serviceType: Service.BatteryService, + serviceType: Service.Battery, getValue: getStatusLowBattery, }) this.registerCharacteristic({ characteristicType: Characteristic.ChargingState, - serviceType: Service.BatteryService, + serviceType: Service.Battery, getValue: getBatteryChargingState, }) } diff --git a/packages/homebridge-ring/camera.ts b/packages/homebridge-ring/camera.ts index 9b367321..f6eaf278 100644 --- a/packages/homebridge-ring/camera.ts +++ b/packages/homebridge-ring/camera.ts @@ -179,7 +179,7 @@ export class Camera extends BaseDataAccessory { if (device.hasBattery) { this.registerCharacteristic({ characteristicType: Characteristic.StatusLowBattery, - serviceType: Service.BatteryService, + serviceType: Service.Battery, getValue: () => { return device.hasLowBattery ? StatusLowBattery.BATTERY_LEVEL_LOW @@ -189,7 +189,7 @@ export class Camera extends BaseDataAccessory { this.registerCharacteristic({ characteristicType: Characteristic.ChargingState, - serviceType: Service.BatteryService, + serviceType: Service.Battery, getValue: () => { return device.isCharging ? ChargingState.CHARGING @@ -199,7 +199,7 @@ export class Camera extends BaseDataAccessory { this.registerObservableCharacteristic({ characteristicType: Characteristic.BatteryLevel, - serviceType: Service.BatteryService, + serviceType: Service.Battery, onValue: device.onBatteryLevel.pipe( map((batteryLevel) => { return batteryLevel === null ? 100 : batteryLevel diff --git a/packages/homebridge-ring/intercom.ts b/packages/homebridge-ring/intercom.ts index 5dc52bae..fa55e633 100644 --- a/packages/homebridge-ring/intercom.ts +++ b/packages/homebridge-ring/intercom.ts @@ -116,7 +116,7 @@ export class Intercom extends BaseDataAccessory { if (device.batteryLevel !== null) { this.registerObservableCharacteristic({ characteristicType: Characteristic.BatteryLevel, - serviceType: Service.BatteryService, + serviceType: Service.Battery, onValue: device.onBatteryLevel.pipe( map((batteryLevel) => { return batteryLevel === null ? 100 : batteryLevel