From acf4031d2eaaf33431d6c1cf4c3e1439bfdc2457 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Mon, 13 Feb 2017 11:54:59 -0500 Subject: [PATCH 1/2] Fix range for battery information --- ring_doorbell/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index 2faae516..9c6e3155 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -256,7 +256,10 @@ def is_doorbell_subscribed_motions(self, name): def doorbell_battery_life(self, name): """Return doorbell battery life.""" try: - return self.doorbell_attributes(name).get('battery_life') + value = int(self.doorbell_attributes(name).get('battery_life')) + if value > 100: + value = 100 + return value except AttributeError: return NOT_FOUND From fef46e270c18e29fd348f8d295be11ffb4c8d221 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira de Mello Date: Mon, 13 Feb 2017 11:56:40 -0500 Subject: [PATCH 2/2] fix lint --- ring_doorbell/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ring_doorbell/__init__.py b/ring_doorbell/__init__.py index 9c6e3155..db85fdab 100644 --- a/ring_doorbell/__init__.py +++ b/ring_doorbell/__init__.py @@ -257,7 +257,7 @@ def doorbell_battery_life(self, name): """Return doorbell battery life.""" try: value = int(self.doorbell_attributes(name).get('battery_life')) - if value > 100: + if value > 100: value = 100 return value except AttributeError: