mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 11:29:46 +00:00
Add MQTT cover stop tilt (#139912)
* Stop tilt move.
Stop tilt use same payload as cover - payload_stop
* Add test for STOP_TILT
* Tilt action
* Revert "Tilt action"
This reverts commit 7ce4fbb086.
* Update tests/components/mqtt/test_cover.py
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
* Update homeassistant/components/mqtt/cover.py
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
* Append CONF_PAYLOAD_STOP_TILT
* Update homeassistant/components/mqtt/cover.py
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
* Test for new payload
* Update tests/components/mqtt/test_cover.py
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
* Update tests/components/mqtt/test_cover.py
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
* Ruff format
* abbreviation
---------
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
This commit is contained in:
@@ -37,6 +37,7 @@ from homeassistant.const import (
|
||||
SERVICE_SET_COVER_POSITION,
|
||||
SERVICE_SET_COVER_TILT_POSITION,
|
||||
SERVICE_STOP_COVER,
|
||||
SERVICE_STOP_COVER_TILT,
|
||||
SERVICE_TOGGLE,
|
||||
SERVICE_TOGGLE_COVER_TILT,
|
||||
STATE_CLOSED,
|
||||
@@ -936,6 +937,63 @@ async def test_send_stop_cover_command(
|
||||
assert state.state == STATE_UNKNOWN
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("hass_config", "payload_stop"),
|
||||
[
|
||||
(
|
||||
{
|
||||
mqtt.DOMAIN: {
|
||||
cover.DOMAIN: {
|
||||
"name": "test",
|
||||
"state_topic": "state-topic",
|
||||
"tilt_command_topic": "tilt-command-topic",
|
||||
"payload_stop_tilt": "TILT_STOP",
|
||||
"qos": 2,
|
||||
}
|
||||
}
|
||||
},
|
||||
"TILT_STOP",
|
||||
),
|
||||
(
|
||||
{
|
||||
mqtt.DOMAIN: {
|
||||
cover.DOMAIN: {
|
||||
"name": "test",
|
||||
"state_topic": "state-topic",
|
||||
"tilt_command_topic": "tilt-command-topic",
|
||||
"qos": 2,
|
||||
}
|
||||
}
|
||||
},
|
||||
"STOP",
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_send_stop_tilt_command(
|
||||
hass: HomeAssistant,
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
payload_stop: str,
|
||||
) -> None:
|
||||
"""Test the sending of stop_cover_tilt."""
|
||||
mqtt_mock = await mqtt_mock_entry()
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
|
||||
await hass.services.async_call(
|
||||
cover.DOMAIN,
|
||||
SERVICE_STOP_COVER_TILT,
|
||||
{ATTR_ENTITY_ID: "cover.test"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
mqtt_mock.async_publish.assert_called_once_with(
|
||||
"tilt-command-topic", payload_stop, 2, False
|
||||
)
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_UNKNOWN
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hass_config",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user