Skip to content

Add opening and closing states to MQTT covers#31259

Merged
MartinHjelmare merged 5 commits into
home-assistant:devfrom
rickvdl:feature/mqtt-cover-opening-closing-states
Jan 30, 2020
Merged

Add opening and closing states to MQTT covers#31259
MartinHjelmare merged 5 commits into
home-assistant:devfrom
rickvdl:feature/mqtt-cover-opening-closing-states

Conversation

@rickvdl
Copy link
Copy Markdown
Contributor

@rickvdl 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 a team as a code owner January 28, 2020 21:39
@homeassistant
Copy link
Copy Markdown
Contributor

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
Copy link
Copy Markdown

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 force-pushed the feature/mqtt-cover-opening-closing-states branch from 24a7c1c to 2aa6926 Compare January 28, 2020 21:40
@homeassistant
Copy link
Copy Markdown
Contributor

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!

@rickvdl rickvdl force-pushed the feature/mqtt-cover-opening-closing-states branch from 2aa6926 to 9c343a4 Compare January 28, 2020 21:49
@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
Copy Markdown
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.

Please remove the use of STATE_UNKNOWN.

Comment thread homeassistant/components/mqtt/cover.py Outdated
Comment thread homeassistant/components/mqtt/cover.py Outdated
@rickvdl rickvdl requested review from MartinHjelmare and removed request for a team January 29, 2020 19:03
@MartinHjelmare
Copy link
Copy Markdown
Member

@rickvdl
Copy link
Copy Markdown
Contributor Author

rickvdl commented Jan 30, 2020

@MartinHjelmare Test added 👍

Copy link
Copy Markdown
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.

Nice! Thanks!

@MartinHjelmare MartinHjelmare merged commit 3718b25 into home-assistant:dev 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

None yet

Development

Successfully merging this pull request may close these issues.

3 participants