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

Conversation

rytilahti
Copy link
Owner

Fixes #759

@coveralls
Copy link

coveralls commented Jul 14, 2020

Coverage Status

Coverage decreased (-0.1%) to 73.831% when pulling 35f9736 on fix/xiaowa_timezone into c9f238c on master.

Copy link

@lpfann lpfann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the PR and noticed that the dictionary is also encapsulated in a list.
The following code works for me now:

  @command()
    def timezone(self):
        """Get the timezone."""
        res_list = self.send("get_timezone")
        res = res_list[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

@rytilahti
Copy link
Owner Author

Thanks for testing, I pushed an update!

@lpfann
Copy link

lpfann commented Jul 14, 2020

Thanks, works now!
Hopefully this fixes the regression in HASS.

@rytilahti
Copy link
Owner Author

Thanks again for testing, it will be fixed then whenever new python-miio gets released and homeassistant gets a version bump!

@rytilahti rytilahti merged commit f478dc6 into master Jul 14, 2020
@rytilahti rytilahti deleted the fix/xiaowa_timezone branch July 14, 2020 14:01
xvlady pushed a commit to xvlady/python-miio that referenced this pull request May 9, 2021
* Allow alternative timezone format seen in Xioawa E25

* unwrap the response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken timezone call (dictionary instead of string) breaks HASS integration
3 participants