mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Fix mqtt cover state is open after receiving stopped payload (#104726)
This commit is contained in:
parent
4628b03677
commit
82264a0d6b
@ -380,7 +380,11 @@ class MqttCover(MqttEntity, CoverEntity):
|
||||
else STATE_OPEN
|
||||
)
|
||||
else:
|
||||
state = STATE_CLOSED if self.state == STATE_CLOSING else STATE_OPEN
|
||||
state = (
|
||||
STATE_CLOSED
|
||||
if self.state in [STATE_CLOSED, STATE_CLOSING]
|
||||
else STATE_OPEN
|
||||
)
|
||||
elif payload == self._config[CONF_STATE_OPENING]:
|
||||
state = STATE_OPENING
|
||||
elif payload == self._config[CONF_STATE_CLOSING]:
|
||||
|
@ -3347,6 +3347,11 @@ async def test_set_state_via_stopped_state_no_position_topic(
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_CLOSED
|
||||
|
||||
async_fire_mqtt_message(hass, "state-topic", "STOPPED")
|
||||
|
||||
state = hass.states.get("cover.test")
|
||||
assert state.state == STATE_CLOSED
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"hass_config",
|
||||
|
Loading…
x
Reference in New Issue
Block a user