Skip to content

Commit

Permalink
Merge pull request #106 from evanjd/spotlight-battery-battery-bugfix
Browse files Browse the repository at this point in the history
Support for Spotlight Battery cameras with multiple battery bays
  • Loading branch information
tchellomello committed Oct 29, 2018
2 parents 99fa04d + 19b50b8 commit 1029a5b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ring_doorbell/doorbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ def family(self):
@property
def battery_life(self):
"""Return battery life."""
if 'battery_life_2' in self._attrs:
# Camera has two battery bays
value = 0
if self._attrs.get('battery_life') is not None:
# Bay 1
value += int(self._attrs.get('battery_life'))
if self._attrs.get('battery_life_2') is not None:
# Bay 2
value += int(self._attrs.get('battery_life_2'))
return value
# Camera has a single battery bay
value = int(self._attrs.get('battery_life'))
if value and value > 100:
value = 100
Expand Down

0 comments on commit 1029a5b

Please sign in to comment.