mirror of
https://github.com/home-assistant/core.git
synced 2025-06-17 11:37:05 +00:00
Fix MQTT cover availability subscription (#12036)
This commit is contained in:
parent
105522f03f
commit
38fd9b65bf
@ -214,16 +214,6 @@ class MqttCover(MqttAvailability, CoverDevice):
|
|||||||
|
|
||||||
self.async_schedule_update_ha_state()
|
self.async_schedule_update_ha_state()
|
||||||
|
|
||||||
@callback
|
|
||||||
def availability_message_received(topic, payload, qos):
|
|
||||||
"""Handle new MQTT availability messages."""
|
|
||||||
if payload == self._payload_available:
|
|
||||||
self._available = True
|
|
||||||
elif payload == self._payload_not_available:
|
|
||||||
self._available = False
|
|
||||||
|
|
||||||
self.async_schedule_update_ha_state()
|
|
||||||
|
|
||||||
if self._state_topic is None:
|
if self._state_topic is None:
|
||||||
# Force into optimistic mode.
|
# Force into optimistic mode.
|
||||||
self._optimistic = True
|
self._optimistic = True
|
||||||
@ -232,11 +222,6 @@ class MqttCover(MqttAvailability, CoverDevice):
|
|||||||
self.hass, self._state_topic,
|
self.hass, self._state_topic,
|
||||||
state_message_received, self._qos)
|
state_message_received, self._qos)
|
||||||
|
|
||||||
if self._availability_topic is not None:
|
|
||||||
yield from mqtt.async_subscribe(
|
|
||||||
self.hass, self._availability_topic,
|
|
||||||
availability_message_received, self._qos)
|
|
||||||
|
|
||||||
if self._tilt_status_topic is None:
|
if self._tilt_status_topic is None:
|
||||||
self._tilt_optimistic = True
|
self._tilt_optimistic = True
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user