Skip to content

Commit

Permalink
Fixes battery_life attribute because sometimes the JSON return an str…
Browse files Browse the repository at this point in the history
… instead of int
  • Loading branch information
tchellomello committed May 26, 2018
1 parent 599b4a5 commit 1536856
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ring_doorbell/chime.py
Expand Up @@ -23,7 +23,7 @@ def family(self):
@property
def battery_life(self):
"""Return battery life."""
return self._health_attrs.get('battery_percentage')
return int(self._health_attrs.get('battery_percentage'))

@property
def volume(self):
Expand Down
2 changes: 1 addition & 1 deletion ring_doorbell/doorbot.py
Expand Up @@ -30,7 +30,7 @@ def family(self):
@property
def battery_life(self):
"""Return battery life."""
value = self._attrs.get('battery_life')
value = int(self._attrs.get('battery_life'))
if value and value > 100:
value = 100
return value
Expand Down

0 comments on commit 1536856

Please sign in to comment.