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

MyQ cover return unknown state if not available #17207

Merged
merged 3 commits into from
Oct 8, 2018

Conversation

schmittx
Copy link
Contributor

@schmittx schmittx commented Oct 7, 2018

Description:

  • Change default state to None rather than assume STATE_CLOSED
  • Return STATE_UNKNOWN if unable to update status
  • Minor format update to sort alphabetically

Related issue (if applicable): related to, but doesn't directly fix #16885

Pull request in home-assistant.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 Oct 7, 2018
'opening': STATE_OPENING,
'stopped': STATE_STOPPED,
'transition': STATE_TRANSITION,
'unknown': STATE_UNKNOWN
Copy link
Member

@MartinHjelmare MartinHjelmare Oct 7, 2018

Choose a reason for hiding this comment

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

Don't use STATE_UNKNOWN. Use None to represent unknown state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, thanks for the help.

@@ -21,11 +21,16 @@

DEFAULT_NAME = 'myq'

STATE_STOPPED = 'stopped'
Copy link
Member

Choose a reason for hiding this comment

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

Only states defined in the base cover component are allowed.

@@ -128,4 +133,4 @@ def unique_id(self):

def update(self):
"""Update status of cover."""
self._status = self.myq.get_status(self.device_id)
self._status = MYQ_TO_HASS.get(self.myq.get_status(self.device_id))
Copy link
Member

Choose a reason for hiding this comment

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

self._status should represent the myq state not the home assistant state.

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.

Looks good!

@MartinHjelmare
Copy link
Member

MartinHjelmare commented Oct 7, 2018

Can be merged when PR description is updated to latest changes and build passes.

@schmittx schmittx changed the title MyQ cover additional states MyQ cover return unknown state if not available Oct 7, 2018
@schmittx
Copy link
Contributor Author

schmittx commented Oct 7, 2018

Updated title and description, thanks for the help on this!

@balloob balloob merged commit 27f0331 into home-assistant:dev Oct 8, 2018
@ghost ghost removed the in progress label Oct 8, 2018
@balloob balloob added this to the 0.80 milestone Oct 8, 2018
balloob pushed a commit that referenced this pull request Oct 8, 2018
* Add additional supported states

* Use get method for lookup

* Return None if unable to get status
@balloob balloob mentioned this pull request Oct 12, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
@schmittx schmittx deleted the myq-state-update branch June 10, 2020 12:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MyQ Task exception was never retrieved
4 participants