Add support for paused state
This commit is contained in:
@@ -53,6 +53,7 @@ CONF_FAN_SPEED_DP = "fan_speed_dp"
|
|||||||
CONF_FAN_SPEEDS = "fan_speeds"
|
CONF_FAN_SPEEDS = "fan_speeds"
|
||||||
CONF_CLEAN_TIME_DP = "clean_time_dp"
|
CONF_CLEAN_TIME_DP = "clean_time_dp"
|
||||||
CONF_CLEAN_AREA_DP = "clean_area_dp"
|
CONF_CLEAN_AREA_DP = "clean_area_dp"
|
||||||
|
CONF_PAUSED_STATE = "paused_state"
|
||||||
|
|
||||||
DATA_DISCOVERY = "discovery"
|
DATA_DISCOVERY = "discovery"
|
||||||
|
|
||||||
|
@@ -71,6 +71,7 @@
|
|||||||
"fan_speeds": "Fan speeds list (comma-separated)",
|
"fan_speeds": "Fan speeds list (comma-separated)",
|
||||||
"clean_time_dp": "Clean Time DP (Usually 33)",
|
"clean_time_dp": "Clean Time DP (Usually 33)",
|
||||||
"clean_area_dp": "Clean Area DP (Usually 32)",
|
"clean_area_dp": "Clean Area DP (Usually 32)",
|
||||||
|
"paused_state": "Pause state (pause, paused, etc)",
|
||||||
"brightness": "Brightness (only for white color)",
|
"brightness": "Brightness (only for white color)",
|
||||||
"brightness_lower": "Brightness Lower Value",
|
"brightness_lower": "Brightness Lower Value",
|
||||||
"brightness_upper": "Brightness Upper Value",
|
"brightness_upper": "Brightness Upper Value",
|
||||||
@@ -134,6 +135,7 @@
|
|||||||
"fan_speeds": "Fan speeds list (comma-separated)",
|
"fan_speeds": "Fan speeds list (comma-separated)",
|
||||||
"clean_time_dp": "Clean Time DP (Usually 33)",
|
"clean_time_dp": "Clean Time DP (Usually 33)",
|
||||||
"clean_area_dp": "Clean Area DP (Usually 32)",
|
"clean_area_dp": "Clean Area DP (Usually 32)",
|
||||||
|
"paused_state": "Pause state (pause, paused, etc)",
|
||||||
"brightness": "Brightness (only for white color)",
|
"brightness": "Brightness (only for white color)",
|
||||||
"brightness_lower": "Brightness Lower Value",
|
"brightness_lower": "Brightness Lower Value",
|
||||||
"brightness_upper": "Brightness Upper Value",
|
"brightness_upper": "Brightness Upper Value",
|
||||||
|
@@ -9,6 +9,7 @@ from homeassistant.components.vacuum import (
|
|||||||
STATE_DOCKED,
|
STATE_DOCKED,
|
||||||
STATE_IDLE,
|
STATE_IDLE,
|
||||||
STATE_RETURNING,
|
STATE_RETURNING,
|
||||||
|
STATE_PAUSED,
|
||||||
SUPPORT_BATTERY,
|
SUPPORT_BATTERY,
|
||||||
SUPPORT_FAN_SPEED,
|
SUPPORT_FAN_SPEED,
|
||||||
SUPPORT_PAUSE,
|
SUPPORT_PAUSE,
|
||||||
@@ -17,6 +18,7 @@ from homeassistant.components.vacuum import (
|
|||||||
SUPPORT_STATE,
|
SUPPORT_STATE,
|
||||||
SUPPORT_STATUS,
|
SUPPORT_STATUS,
|
||||||
SUPPORT_STOP,
|
SUPPORT_STOP,
|
||||||
|
SUPPORT_PAUSE,
|
||||||
StateVacuumEntity,
|
StateVacuumEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -33,7 +35,8 @@ from .const import (
|
|||||||
CONF_FAN_SPEED_DP,
|
CONF_FAN_SPEED_DP,
|
||||||
CONF_FAN_SPEEDS,
|
CONF_FAN_SPEEDS,
|
||||||
CONF_CLEAN_TIME_DP,
|
CONF_CLEAN_TIME_DP,
|
||||||
CONF_CLEAN_AREA_DP
|
CONF_CLEAN_AREA_DP,
|
||||||
|
CONF_PAUSED_STATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@@ -48,6 +51,7 @@ DEFAULT_RETURNING_STATUS = "docking"
|
|||||||
DEFAULT_DOCKED_STATUS = "charging,chargecompleted"
|
DEFAULT_DOCKED_STATUS = "charging,chargecompleted"
|
||||||
DEFAULT_MODES = "chargego,smart,standby,wall_follow,spiral,single"
|
DEFAULT_MODES = "chargego,smart,standby,wall_follow,spiral,single"
|
||||||
DEFAULT_FAN_SPEEDS = "low,normal,high"
|
DEFAULT_FAN_SPEEDS = "low,normal,high"
|
||||||
|
DEFAULT_PAUSED_STATE = "paused"
|
||||||
|
|
||||||
def flow_schema(dps):
|
def flow_schema(dps):
|
||||||
"""Return schema used in config flow."""
|
"""Return schema used in config flow."""
|
||||||
@@ -63,6 +67,7 @@ def flow_schema(dps):
|
|||||||
vol.Optional(CONF_FAN_SPEEDS, default=DEFAULT_FAN_SPEEDS): str,
|
vol.Optional(CONF_FAN_SPEEDS, default=DEFAULT_FAN_SPEEDS): str,
|
||||||
vol.Optional(CONF_CLEAN_TIME_DP): vol.In(dps),
|
vol.Optional(CONF_CLEAN_TIME_DP): vol.In(dps),
|
||||||
vol.Optional(CONF_CLEAN_AREA_DP): vol.In(dps),
|
vol.Optional(CONF_CLEAN_AREA_DP): vol.In(dps),
|
||||||
|
vol.Optional(CONF_PAUSED_STATE, default=DEFAULT_PAUSED_STATE): str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -193,6 +198,8 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
|||||||
self._state = STATE_DOCKED
|
self._state = STATE_DOCKED
|
||||||
elif state_value == self._config[CONF_RETURNING_STATUS_VALUE]:
|
elif state_value == self._config[CONF_RETURNING_STATUS_VALUE]:
|
||||||
self._state = STATE_RETURNING
|
self._state = STATE_RETURNING
|
||||||
|
elif state_value == self._config[CONF_PAUSED_STATE]:
|
||||||
|
self._state = STATE_PAUSED
|
||||||
else:
|
else:
|
||||||
self._state = STATE_CLEANING
|
self._state = STATE_CLEANING
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user