Positioning mode changed from 'yes' to 'position'; removed 'stop' command configuration
This commit is contained in:
@@ -21,7 +21,7 @@ CONF_POSITIONING_MODE = "positioning_mode"
|
|||||||
CONF_CURRPOS = "currpos_dps"
|
CONF_CURRPOS = "currpos_dps"
|
||||||
CONF_SETPOS = "setpos_dps"
|
CONF_SETPOS = "setpos_dps"
|
||||||
CONF_MODE_NONE = "none"
|
CONF_MODE_NONE = "none"
|
||||||
CONF_MODE_YES = "yes"
|
CONF_MODE_POSITION = "position"
|
||||||
CONF_MODE_FAKE = "fake"
|
CONF_MODE_FAKE = "fake"
|
||||||
CONF_SPAN_TIME = "span_time"
|
CONF_SPAN_TIME = "span_time"
|
||||||
|
|
||||||
|
@@ -23,7 +23,7 @@ from .const import (
|
|||||||
CONF_SETPOS,
|
CONF_SETPOS,
|
||||||
CONF_POSITIONING_MODE,
|
CONF_POSITIONING_MODE,
|
||||||
CONF_MODE_NONE,
|
CONF_MODE_NONE,
|
||||||
CONF_MODE_YES,
|
CONF_MODE_POSITION,
|
||||||
CONF_MODE_FAKE,
|
CONF_MODE_FAKE,
|
||||||
CONF_SPAN_TIME,
|
CONF_SPAN_TIME,
|
||||||
)
|
)
|
||||||
@@ -41,14 +41,12 @@ DEFAULT_SPAN_TIME = 25.0
|
|||||||
def flow_schema(dps):
|
def flow_schema(dps):
|
||||||
"""Return schema used in config flow."""
|
"""Return schema used in config flow."""
|
||||||
return {
|
return {
|
||||||
vol.Optional(CONF_OPEN_CMD, default=DEFAULT_OPEN_CMD): vol.In(
|
vol.Optional(CONF_OPEN_CMD, default=DEFAULT_OPEN_CMD): vol.In(["on", "open"]),
|
||||||
["on", "open"]
|
|
||||||
),
|
|
||||||
vol.Optional(CONF_CLOSE_CMD, default=DEFAULT_CLOSE_CMD): vol.In(
|
vol.Optional(CONF_CLOSE_CMD, default=DEFAULT_CLOSE_CMD): vol.In(
|
||||||
["off", "close"]
|
["off", "close"]
|
||||||
),
|
),
|
||||||
vol.Optional(CONF_POSITIONING_MODE, default=DEFAULT_POSITIONING_MODE): vol.In(
|
vol.Optional(CONF_POSITIONING_MODE, default=DEFAULT_POSITIONING_MODE): vol.In(
|
||||||
[CONF_MODE_NONE, CONF_MODE_YES, CONF_MODE_FAKE]
|
[CONF_MODE_NONE, CONF_MODE_POSITION, CONF_MODE_FAKE]
|
||||||
),
|
),
|
||||||
vol.Optional(CONF_CURRPOS): vol.In(dps),
|
vol.Optional(CONF_CURRPOS): vol.In(dps),
|
||||||
vol.Optional(CONF_SETPOS): vol.In(dps),
|
vol.Optional(CONF_SETPOS): vol.In(dps),
|
||||||
@@ -126,7 +124,7 @@ class LocaltuyaCover(LocalTuyaEntity, CoverEntity):
|
|||||||
@property
|
@property
|
||||||
def is_open(self):
|
def is_open(self):
|
||||||
"""Return if the cover is open or not."""
|
"""Return if the cover is open or not."""
|
||||||
if self._config[CONF_POSITIONING_MODE] != CONF_MODE_YES:
|
if self._config[CONF_POSITIONING_MODE] != CONF_MODE_POSITION:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return self._current_cover_position == 100
|
return self._current_cover_position == 100
|
||||||
@@ -134,7 +132,7 @@ class LocaltuyaCover(LocalTuyaEntity, CoverEntity):
|
|||||||
@property
|
@property
|
||||||
def is_closed(self):
|
def is_closed(self):
|
||||||
"""Return if the cover is closed or not."""
|
"""Return if the cover is closed or not."""
|
||||||
if self._config[CONF_POSITIONING_MODE] != CONF_MODE_YES:
|
if self._config[CONF_POSITIONING_MODE] != CONF_MODE_POSITION:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return self._current_cover_position == 0
|
return self._current_cover_position == 0
|
||||||
@@ -159,7 +157,7 @@ class LocaltuyaCover(LocalTuyaEntity, CoverEntity):
|
|||||||
self._current_cover_position = 50
|
self._current_cover_position = 50
|
||||||
_LOGGER.debug("Done")
|
_LOGGER.debug("Done")
|
||||||
|
|
||||||
elif self._config[CONF_POSITIONING_MODE] == CONF_MODE_YES:
|
elif self._config[CONF_POSITIONING_MODE] == CONF_MODE_POSITION:
|
||||||
converted_position = int(kwargs[ATTR_POSITION])
|
converted_position = int(kwargs[ATTR_POSITION])
|
||||||
if converted_position in range(0, 101) and self.has_config(CONF_SETPOS):
|
if converted_position in range(0, 101) and self.has_config(CONF_SETPOS):
|
||||||
self._device.set_dps(converted_position, self._config[CONF_SETPOS])
|
self._device.set_dps(converted_position, self._config[CONF_SETPOS])
|
||||||
|
@@ -49,8 +49,8 @@
|
|||||||
"open_cmd": "Open Command",
|
"open_cmd": "Open Command",
|
||||||
"close_cmd": "Close Command",
|
"close_cmd": "Close Command",
|
||||||
"positioning_mode": "Positioning mode",
|
"positioning_mode": "Positioning mode",
|
||||||
"currpos_dps": "Current Position dps (Required only if Positioning Mode is 'yes')",
|
"currpos_dps": "Current Position dps (Required only if Positioning Mode is 'position')",
|
||||||
"setpos_dps": "Set Position dps (Required only if Positioning Mode is 'yes')",
|
"setpos_dps": "Set Position dps (Required only if Positioning Mode is 'position')",
|
||||||
"span_time": "Time for full opening, in secs. (Optional, required only if Positioning Mode is 'fake')",
|
"span_time": "Time for full opening, in secs. (Optional, required only if Positioning Mode is 'fake')",
|
||||||
"unit_of_measurement": "Unit of Measurement",
|
"unit_of_measurement": "Unit of Measurement",
|
||||||
"device_class": "Device Class",
|
"device_class": "Device Class",
|
||||||
@@ -85,8 +85,8 @@
|
|||||||
"open_cmd": "Open Command",
|
"open_cmd": "Open Command",
|
||||||
"close_cmd": "Close Command",
|
"close_cmd": "Close Command",
|
||||||
"positioning_mode": "Positioning mode",
|
"positioning_mode": "Positioning mode",
|
||||||
"currpos_dps": "Current Position dps (Required only if Positioning Mode is 'yes')",
|
"currpos_dps": "Current Position dps (Required only if Positioning Mode is 'position')",
|
||||||
"setpos_dps": "Set Position dps (Required only if Positioning Mode is 'yes')",
|
"setpos_dps": "Set Position dps (Required only if Positioning Mode is 'position')",
|
||||||
"span_time": "Time for full opening, in secs. (Optional, required only if Positioning Mode is 'fake')",
|
"span_time": "Time for full opening, in secs. (Optional, required only if Positioning Mode is 'fake')",
|
||||||
"unit_of_measurement": "Unit of Measurement",
|
"unit_of_measurement": "Unit of Measurement",
|
||||||
"device_class": "Device Class",
|
"device_class": "Device Class",
|
||||||
|
Reference in New Issue
Block a user