Skip to content

Commit

Permalink
Fixes for HAP-NodeJS v1.0.0 (#1447)
Browse files Browse the repository at this point in the history
  • Loading branch information
donavanbecker authored and dgreif committed Jul 22, 2024
1 parent f82b6ad commit 60cb8ff
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-pants-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'homebridge-ring': patch
---

Fixes for HAP-NodeJS v1.0.0
5 changes: 1 addition & 4 deletions packages/homebridge-ring/base-accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,7 @@ export abstract class BaseAccessory<T extends { name: string }> {
}

pruneUnusedServices() {
const safeServiceUUIDs = [
hap.Service.CameraRTPStreamManagement.UUID,
hap.Service.CameraControl.UUID,
]
const safeServiceUUIDs = [hap.Service.CameraRTPStreamManagement.UUID]

this.accessory.services.forEach((service) => {
if (
Expand Down
6 changes: 3 additions & 3 deletions packages/homebridge-ring/base-device-accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ export abstract class BaseDeviceAccessory extends BaseDataAccessory<RingDevice>
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,
})
}
Expand Down
6 changes: 3 additions & 3 deletions packages/homebridge-ring/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class Camera extends BaseDataAccessory<RingCamera> {
if (device.hasBattery) {
this.registerCharacteristic({
characteristicType: Characteristic.StatusLowBattery,
serviceType: Service.BatteryService,
serviceType: Service.Battery,
getValue: () => {
return device.hasLowBattery
? StatusLowBattery.BATTERY_LEVEL_LOW
Expand All @@ -189,7 +189,7 @@ export class Camera extends BaseDataAccessory<RingCamera> {

this.registerCharacteristic({
characteristicType: Characteristic.ChargingState,
serviceType: Service.BatteryService,
serviceType: Service.Battery,
getValue: () => {
return device.isCharging
? ChargingState.CHARGING
Expand All @@ -199,7 +199,7 @@ export class Camera extends BaseDataAccessory<RingCamera> {

this.registerObservableCharacteristic({
characteristicType: Characteristic.BatteryLevel,
serviceType: Service.BatteryService,
serviceType: Service.Battery,
onValue: device.onBatteryLevel.pipe(
map((batteryLevel) => {
return batteryLevel === null ? 100 : batteryLevel
Expand Down
2 changes: 1 addition & 1 deletion packages/homebridge-ring/intercom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class Intercom extends BaseDataAccessory<RingIntercom> {
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
Expand Down

0 comments on commit 60cb8ff

Please sign in to comment.