Skip to content

Commit

Permalink
Allow alternative timezone format seen in Xioawa E25 (#760)
Browse files Browse the repository at this point in the history
* Allow alternative timezone format seen in Xioawa E25

* unwrap the response
  • Loading branch information
rytilahti authored Jul 14, 2020
1 parent c9f238c commit f478dc6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion miio/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,17 @@ def locale(self):
@command()
def timezone(self):
"""Get the timezone."""
return self.send("get_timezone")[0]
res = self.send("get_timezone")[0]
if isinstance(res, dict):
# Xiaowa E25 example
# {'olson': 'Europe/Berlin', 'posix': 'CET-1CEST,M3.5.0,M10.5.0/3'}
if "olson" not in res:
raise VacuumException("Unsupported timezone format: %s" % res)

return res["olson"]

# Gen1 vacuum: ['Europe/Berlin']
return res

def set_timezone(self, new_zone):
"""Set the timezone."""
Expand Down

0 comments on commit f478dc6

Please sign in to comment.