Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow alternative timezone format seen in Xioawa E25 #760

Merged
merged 2 commits into from
Jul 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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