mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Fix initial tilt value of MQTT cover (#73308)
This commit is contained in:
parent
06ebc1fa14
commit
3d78240cee
@ -25,7 +25,6 @@ from homeassistant.const import (
|
|||||||
STATE_CLOSING,
|
STATE_CLOSING,
|
||||||
STATE_OPEN,
|
STATE_OPEN,
|
||||||
STATE_OPENING,
|
STATE_OPENING,
|
||||||
STATE_UNKNOWN,
|
|
||||||
)
|
)
|
||||||
from homeassistant.core import HomeAssistant, callback
|
from homeassistant.core import HomeAssistant, callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
@ -470,7 +469,6 @@ class MqttCover(MqttEntity, CoverEntity):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if self._config.get(CONF_TILT_STATUS_TOPIC) is not None:
|
if self._config.get(CONF_TILT_STATUS_TOPIC) is not None:
|
||||||
self._tilt_value = STATE_UNKNOWN
|
|
||||||
topics["tilt_status_topic"] = {
|
topics["tilt_status_topic"] = {
|
||||||
"topic": self._config.get(CONF_TILT_STATUS_TOPIC),
|
"topic": self._config.get(CONF_TILT_STATUS_TOPIC),
|
||||||
"msg_callback": tilt_message_received,
|
"msg_callback": tilt_message_received,
|
||||||
|
@ -1256,12 +1256,8 @@ async def test_tilt_defaults(hass, mqtt_mock_entry_with_yaml_config):
|
|||||||
await mqtt_mock_entry_with_yaml_config()
|
await mqtt_mock_entry_with_yaml_config()
|
||||||
|
|
||||||
state_attributes_dict = hass.states.get("cover.test").attributes
|
state_attributes_dict = hass.states.get("cover.test").attributes
|
||||||
assert ATTR_CURRENT_TILT_POSITION in state_attributes_dict
|
# Tilt position is not yet known
|
||||||
|
assert ATTR_CURRENT_TILT_POSITION not in state_attributes_dict
|
||||||
current_cover_position = hass.states.get("cover.test").attributes[
|
|
||||||
ATTR_CURRENT_TILT_POSITION
|
|
||||||
]
|
|
||||||
assert current_cover_position == STATE_UNKNOWN
|
|
||||||
|
|
||||||
|
|
||||||
async def test_tilt_via_invocation_defaults(hass, mqtt_mock_entry_with_yaml_config):
|
async def test_tilt_via_invocation_defaults(hass, mqtt_mock_entry_with_yaml_config):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user