-
-
Notifications
You must be signed in to change notification settings - Fork 28.9k
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
Enhance MQTT cover platform #46059
Enhance MQTT cover platform #46059
Conversation
Allow combining of position and state of MQTT cover Add template and fix optimistic in set tilt position Add tests
Hey there @home-assistant/core, @emontnemery, mind taking a look at this pull request as its been labeled with an integration ( |
I think there should be tests verifying that:
Also, is there a need for some exception to set the state to closed/open when we get an update of the position to fully opened or fully closed? |
This is covered in few tests, for example: core/tests/components/mqtt/test_cover.py Line 189 in 08163a8
Added test for this
No, removed After discussion with community members we reached a conclusion that it would be clean to add an option for a cover to report a |
Maybe we should change the behavior when calculating the position to send to the device with the following change in + position = self.find_in_range_from_percent(position, COVER_PAYLOAD)
if set_position_template is not None:
position = set_position_template.async_render(parse_result=False, **kwargs)
- else:
- position = self.find_in_range_from_percent(position, COVER_PAYLOAD) Background here: #46104 (comment) |
Breaking change
MQTT cover
value_template
is deprecated to use for extracting position, support will be removed in Home Assistant 2021.6.Instead of using
value_template
,position_template
should be used.MQTT cover
tilt_invert_state
is deprecated, insteadtilt_min
andtilt_max
should be used. Support fortilt_invert_state
will be removed in Home Assistant 2021.6.Proposed change
Summary
Details
This change will allow combining
state_topic
andposition_topic
for covers which supports both state an position to allow setting cover position and showing the cover state which it is moving. In current implementation it is not possible to use both topics so if position is used it is not possible to show the cover state while it is moving.In addition this PR fixes missing options for tilt to allow templating using
tilt_status_template
and fixes set tilt position to followtilt_optimistic
option correclty.After discussion with community members we reached a conclusion that it would be clean to add an option for a cover to report a stopped state, Some covers only have 3 states [
opening
,closing
,stopped
] and not 4 states [opening
,closing
,closed
,opened
]I have added an option to use the payload
stopped
in state topic. When this payload is received if the cover is in optimistic mode or position topic is not set the coveropen
orclosed
state will be set according to last direction the cover was moving.If position topic is set the last position will be used to set the
open
orclosed
state.This will allow clean implantations with such devices, for example Shelly 2.x and many "dumb" gate controllers which only have 3 states. This also aligns the state status topics with command status topics so for a
stop
command there is also astopped
status.
Type of change
Example entry for
configuration.yaml
:Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: