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

Add support for discrete states to MyQ cover #16251

Merged
merged 2 commits into from
Aug 29, 2018

Conversation

schmittx
Copy link
Contributor

@schmittx schmittx commented Aug 28, 2018

Description:

  • Update dependency to latest release
  • Add discrete state support for closing and opening
  • Update supported_features to reflect actual condition (MyQ does not support stop_cover)

Related issue (if applicable): N/A

Pull request in home-assistant.github.io with documentation (if applicable): N/A

Example entry for configuration.yaml (if applicable):

N/A

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@ghost ghost added the in progress label Aug 28, 2018
@property
def is_closing(self):
"""Return if the cover is closing or not."""
return self._status == STATE_CLOSING
Copy link
Member

Choose a reason for hiding this comment

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

We should add a translation dict between the myq status and home assistant state constants. This will make sure we control the coupling, and avoid breakage if a constant changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I follow, something like this then?

MYQ_TO_HASS = {
    'closed': STATE_CLOSED,
    'closing': STATE_CLOSING,
    'opening': STATE_OPENING
}

    @property
    def is_closing(self):
        """Return if the cover is closing or not."""
        return MYQ_TO_HASS[self._status] == STATE_CLOSING

Copy link
Member

Choose a reason for hiding this comment

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

Exactly! 👍

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Great!

@MartinHjelmare MartinHjelmare merged commit aaa1ebe into home-assistant:dev Aug 29, 2018
@ghost ghost removed the in progress label Aug 29, 2018
@schmittx schmittx deleted the myq-cover-discrete-states branch August 31, 2018 11:40
@balloob balloob mentioned this pull request Sep 17, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed integration: myq small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants