Skip to content

Commit

Permalink
Save battery status to VacBot
Browse files Browse the repository at this point in the history
Makes battery status available as a public property on VacBot
  • Loading branch information
OverloadUT committed Dec 8, 2017
1 parent 6450c31 commit 53fad26
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sucks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def __init__(self, user, domain, resource, secret, vacuum, continent):
self.ready_flag = Event()
self.clean_status = None
self.charge_status = None
self.battery_status = None

def wait_until_ready(self):
self.ready_flag.wait()
Expand Down Expand Up @@ -170,8 +171,8 @@ def handle_clean_report(self, iq):

def handle_battery_report(self, iq):
try:
battery_status = float(iq.find('{com:ctl}query/{com:ctl}ctl/{com:ctl}battery').get('power')) / 100
logging.debug("*** battery_status = {:.0%}".format(battery_status))
self.battery_status = float(iq.find('{com:ctl}query/{com:ctl}ctl/{com:ctl}battery').get('power')) / 100
logging.debug("*** battery_status = {:.0%}".format(self.battery_status))
except ValueError:
logging.warning("couldn't parse battery status " + ET.tostring(iq))

Expand Down

0 comments on commit 53fad26

Please sign in to comment.