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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opening and closing states to MQTT covers #31259

Conversation

@rickvdl
Copy link
Contributor

rickvdl commented Jan 28, 2020

Proposed change

Home assistent has support for the opening and closing state for covers. However, the MQTT component does not expose a way to set this state from the state topic. This PR adds that functionality for devices that are able to proactively report whether they're opening or closing, perhaps from an analog input not connected to HA.

This change is purely additive, the existing features will keep working and the extra configuration options are optional.

Related feature request: https://community.home-assistant.io/t/garage-door-state-opening-closing-state-from-mqtt-sensor/71263

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

(Optional custom payload, inline with the existing options)

# Example configuration.yaml
cover:
  - platform: mqtt
    ...
    state_opening: "IS_OPENING" #The default value is `opening`
    state_closing: "IS_CLOSING" #The default value is `closing`

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

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

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

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 馃 Silver
  • 馃 Gold
  • 馃弳 Platinum
@rickvdl rickvdl requested a review from home-assistant/core as a code owner Jan 28, 2020
@homeassistant

This comment has been minimized.

Copy link
Contributor

homeassistant commented Jan 28, 2020

Hi @rickvdl,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@probot-home-assistant

This comment has been minimized.

Copy link

probot-home-assistant bot commented Jan 28, 2020

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (mqtt) you are listed as a codeowner for? Thanks!

@rickvdl rickvdl mentioned this pull request Jan 28, 2020
3 of 7 tasks complete
@rickvdl rickvdl force-pushed the rickvdl:feature/mqtt-cover-opening-closing-states branch from 24a7c1c to 2aa6926 Jan 28, 2020
@homeassistant

This comment has been minimized.

Copy link
Contributor

homeassistant commented Jan 28, 2020

Hi @rickvdl,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@homeassistant homeassistant added cla-signed and removed cla-needed labels Jan 28, 2020
@rickvdl rickvdl mentioned this pull request Jan 28, 2020
3 of 7 tasks complete
@rickvdl rickvdl force-pushed the rickvdl:feature/mqtt-cover-opening-closing-states branch from 2aa6926 to 9c343a4 Jan 28, 2020
@MartinHjelmare MartinHjelmare changed the title Added support for the opening and closing states to MQTT covers Add opening and closing states to MQTT covers Jan 28, 2020
Copy link
Member

MartinHjelmare left a comment

Please remove the use of STATE_UNKNOWN.

homeassistant/components/mqtt/cover.py Outdated Show resolved Hide resolved
homeassistant/components/mqtt/cover.py Outdated Show resolved Hide resolved
Dev automation moved this from Needs review to Review in progress Jan 28, 2020
@rickvdl rickvdl requested review from MartinHjelmare and removed request for home-assistant/core Jan 29, 2020
@rickvdl

This comment has been minimized.

Copy link
Contributor Author

rickvdl commented Jan 30, 2020

@MartinHjelmare Test added 馃憤

Copy link
Member

MartinHjelmare left a comment

Nice! Thanks!

Dev automation moved this from Review in progress to Reviewer approved Jan 30, 2020
@MartinHjelmare MartinHjelmare merged commit 3718b25 into home-assistant:dev Jan 30, 2020
10 checks passed
10 checks passed
CI Build #20200130.76 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch 100% of diff hit (target 94.4%)
Details
codecov/project 94.62% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Jan 30, 2020
@lock lock bot locked and limited conversation to collaborators Jan 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can鈥檛 perform that action at this time.