Skip to content

Commit

Permalink
Fix battery detection for cameras
Browse files Browse the repository at this point in the history
Relates to #1109, #1107a
  • Loading branch information
dgreif committed Dec 12, 2022
1 parent 321c983 commit 503e34f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/beige-hairs-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'homebridge-ring': patch
'ring-client-api': patch
---

Fixed a typo which caused all cameras to be recognized as wired cameras. This lead to slower notifications for battery cameras and removed the battery level in HomeKit. Big thanks to @satrik for pointing me in the right direction to track down these issues!
4 changes: 2 additions & 2 deletions packages/ring-client-api/ring-camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export class RingCamera extends Subscribed {

this.onBatteryLevel = this.onData.pipe(
map((data) => {
if (!('battery_level' in data)) {
if (!('battery_life' in data)) {
return null
}
return getBatteryLevel(data)
Expand Down Expand Up @@ -219,7 +219,7 @@ export class RingCamera extends Subscribed {
}

get batteryLevel() {
if (!('battery_level' in this.data)) {
if (!('battery_life' in this.data)) {
return null
}
return getBatteryLevel(this.data)
Expand Down

0 comments on commit 503e34f

Please # to comment.