From 1b2aeb4afc86c0b0b30d0d70f31d699c58d627f9 Mon Sep 17 00:00:00 2001 From: Dmitry Moiseev Date: Thu, 31 Oct 2013 16:19:29 +0600 Subject: Quickfix if Zik doesn't return battery level --- ParrotZik.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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"] -- cgit v1.2.1