Fix supported_features in mqtt cover (#28120)
* Correctly compute the supported_features in cover.mqtt * Update homeassistant/components/mqtt/cover.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * Correctly compute the supported_features in cover.mqtt * Format
This commit is contained in:
1 parent
b8d2c58c60
commit
85eefe41da
2 files changed
+28
-2
No files matched your search
@@ -90,7 +90,7 @@ DEFAULT_TILT_MIN = 0
|
||||
DEFAULT_TILT_OPEN_POSITION = 100
|
||||
DEFAULT_TILT_OPTIMISTIC = False
|
||||
|
||||
OPEN_CLOSE_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_STOP
|
||||
OPEN_CLOSE_FEATURES = SUPPORT_OPEN | SUPPORT_CLOSE
|
||||
TILT_FEATURES = (
|
||||
SUPPORT_OPEN_TILT
|
||||
| SUPPORT_CLOSE_TILT
|
||||
@@ -122,7 +122,9 @@ PLATFORM_SCHEMA = vol.All(
|
||||
vol.Optional(CONF_OPTIMISTIC, default=DEFAULT_OPTIMISTIC): cv.boolean,
|
||||
vol.Optional(CONF_PAYLOAD_CLOSE, default=DEFAULT_PAYLOAD_CLOSE): cv.string,
|
||||
vol.Optional(CONF_PAYLOAD_OPEN, default=DEFAULT_PAYLOAD_OPEN): cv.string,
|
||||
vol.Optional(CONF_PAYLOAD_STOP, default=DEFAULT_PAYLOAD_STOP): cv.string,
|
||||
vol.Optional(CONF_PAYLOAD_STOP, default=DEFAULT_PAYLOAD_STOP): vol.Any(
|
||||
cv.string, None
|
||||
),
|
||||
vol.Optional(CONF_POSITION_CLOSED, default=DEFAULT_POSITION_CLOSED): int,
|
||||
vol.Optional(CONF_POSITION_OPEN, default=DEFAULT_POSITION_OPEN): int,
|
||||
vol.Optional(CONF_RETAIN, default=DEFAULT_RETAIN): cv.boolean,
|
||||
@@ -396,6 +398,9 @@ class MqttCover(
|
||||
if self._config.get(CONF_COMMAND_TOPIC) is not None:
|
||||
supported_features = OPEN_CLOSE_FEATURES
|
||||
|
||||
if self._config.get(CONF_PAYLOAD_STOP) is not None:
|
||||
supported_features |= SUPPORT_STOP
|
||||
|
||||
if self._config.get(CONF_SET_POSITION_TOPIC) is not None:
|
||||
supported_features |= SUPPORT_SET_POSITION
|
||||
|
||||
|
||||
Reference in new issue
Block a user