From 22e903f15887bff972ecd0f28c0ee485e918c3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20S=C3=A1nchez?= Date: Fri, 3 Jul 2015 13:33:26 +0200 Subject: Fixed cast when the value is an empty string --- parrot_zik/model/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parrot_zik/model/base.py b/parrot_zik/model/base.py index 0cd4652..d722788 100644 --- a/parrot_zik/model/base.py +++ b/parrot_zik/model/base.py @@ -16,7 +16,7 @@ class ParrotZikBase(object): def get_battery_level(self, field_name): answer = self.resource_manager.get("/api/system/battery") - return int(answer.system.battery[field_name]) + return int(answer.system.battery[field_name] or 0) @property def friendly_name(self): -- cgit v1.2.1