aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Moiseev <m0sia@m0sia.ru>2013-10-31 16:19:29 +0600
committerDmitry Moiseev <m0sia@m0sia.ru>2013-10-31 16:19:29 +0600
commit1b2aeb4afc86c0b0b30d0d70f31d699c58d627f9 (patch)
treefe32d0bc00cd0113757e1418afc738094eeb2e7e
parent627316a25d0990a1b6c2a0b2fd8aebbb97546c40 (diff)
downloadpyParrotZikTCP-1b2aeb4afc86c0b0b30d0d70f31d699c58d627f9.tar.xz
pyParrotZikTCP-1b2aeb4afc86c0b0b30d0d70f31d699c58d627f9.zip
Quickfix if Zik doesn't return battery level
Diffstat (limited to '')
-rw-r--r--ParrotZik.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ParrotZik.py b/ParrotZik.py
index bf2eb25..75680cc 100644
--- a/ParrotZik.py
+++ b/ParrotZik.py
@@ -35,7 +35,10 @@ class ParrotZik(object):
def getBatteryLevel(self):
data = self.sendGetMessage("/api/system/battery/get")
- return data.answer.system.battery["level"]
+ try:
+ return data.answer.system.battery["level"]
+ except:
+ return "0"
def getVersion(self):
data = self.sendGetMessage("/api/software/version/get")
@@ -49,6 +52,10 @@ class ParrotZik(object):
data = self.sendGetMessage("/api/system/auto_connection/enabled/get")
return data.answer.system.auto_connection["enabled"]
+ def setAutoConnection(self,arg):
+ data = self.sendSetMessage("/api/system/auto_connection/enabled/set",arg)
+ return data
+
def getAncPhoneMode(self):
data = self.sendGetMessage("/api/system/anc_phone_mode/enabled/get")
return data.answer.system.anc_phone_mode["enabled"]