aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Moiseev <m0sia@m0sia.ru>2013-11-08 13:51:39 +0600
committerDmitry Moiseev <m0sia@m0sia.ru>2013-11-08 13:51:39 +0600
commitbdc53d8151dff4bf1d27df9cf21e78acdcc0b651 (patch)
tree741d2ec71b1932b495478700739194643729e592
parent42d60a9e684b37ea78262b0765347191a40e9f3a (diff)
downloadpyParrotZikTCP-bdc53d8151dff4bf1d27df9cf21e78acdcc0b651.tar.xz
pyParrotZikTCP-bdc53d8151dff4bf1d27df9cf21e78acdcc0b651.zip
Sometimes zik returns empty string instead of battery level
-rw-r--r--ParrotZik.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/ParrotZik.py b/ParrotZik.py
index 2746259..b7f5dd7 100644
--- a/ParrotZik.py
+++ b/ParrotZik.py
@@ -38,7 +38,8 @@ class ParrotZik(object):
def getBatteryLevel(self):
data = self.sendGetMessage("/api/system/battery/get")
try:
- self.BatteryLevel = data.answer.system.battery["level"]
+ if data.answer.system.battery["level"] <> '':
+ self.BatteryLevel = data.answer.system.battery["level"]
except:
pass