style fixes
This commit is contained in:
@@ -65,8 +65,9 @@ def flow_schema(dps):
|
|||||||
vol.Required(CONF_IDLE_STATUS_VALUE, default=DEFAULT_IDLE_STATUS): str,
|
vol.Required(CONF_IDLE_STATUS_VALUE, default=DEFAULT_IDLE_STATUS): str,
|
||||||
vol.Required(CONF_POWERGO_DP): vol.In(dps),
|
vol.Required(CONF_POWERGO_DP): vol.In(dps),
|
||||||
vol.Required(CONF_DOCKED_STATUS_VALUE, default=DEFAULT_DOCKED_STATUS): str,
|
vol.Required(CONF_DOCKED_STATUS_VALUE, default=DEFAULT_DOCKED_STATUS): str,
|
||||||
vol.Optional(CONF_RETURNING_STATUS_VALUE,
|
vol.Optional(
|
||||||
default=DEFAULT_RETURNING_STATUS): str,
|
CONF_RETURNING_STATUS_VALUE, default=DEFAULT_RETURNING_STATUS
|
||||||
|
): str,
|
||||||
vol.Optional(CONF_BATTERY_DP): vol.In(dps),
|
vol.Optional(CONF_BATTERY_DP): vol.In(dps),
|
||||||
vol.Optional(CONF_MODE_DP): vol.In(dps),
|
vol.Optional(CONF_MODE_DP): vol.In(dps),
|
||||||
vol.Optional(CONF_MODES, default=DEFAULT_MODES): str,
|
vol.Optional(CONF_MODES, default=DEFAULT_MODES): str,
|
||||||
@@ -116,8 +117,13 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
|||||||
@property
|
@property
|
||||||
def supported_features(self):
|
def supported_features(self):
|
||||||
"""Flag supported features."""
|
"""Flag supported features."""
|
||||||
supported_features = (SUPPORT_START | SUPPORT_PAUSE
|
supported_features = (
|
||||||
| SUPPORT_STOP | SUPPORT_STATUS | SUPPORT_STATE)
|
SUPPORT_START
|
||||||
|
| SUPPORT_PAUSE
|
||||||
|
| SUPPORT_STOP
|
||||||
|
| SUPPORT_STATUS
|
||||||
|
| SUPPORT_STATE
|
||||||
|
)
|
||||||
|
|
||||||
if self.has_config(CONF_RETURN_MODE):
|
if self.has_config(CONF_RETURN_MODE):
|
||||||
supported_features = supported_features | SUPPORT_RETURN_HOME
|
supported_features = supported_features | SUPPORT_RETURN_HOME
|
||||||
@@ -166,16 +172,18 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
|||||||
async def async_return_to_base(self, **kwargs):
|
async def async_return_to_base(self, **kwargs):
|
||||||
"""Set the vacuum cleaner to return to the dock."""
|
"""Set the vacuum cleaner to return to the dock."""
|
||||||
if self.has_config(CONF_RETURN_MODE):
|
if self.has_config(CONF_RETURN_MODE):
|
||||||
await self._device.set_dp(self._config[CONF_RETURN_MODE],
|
await self._device.set_dp(
|
||||||
self._config[CONF_MODE_DP])
|
self._config[CONF_RETURN_MODE], self._config[CONF_MODE_DP]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error("Missing command for return home in commands set.")
|
_LOGGER.error("Missing command for return home in commands set.")
|
||||||
|
|
||||||
async def async_stop(self, **kwargs):
|
async def async_stop(self, **kwargs):
|
||||||
"""Turn the vacuum off stopping the cleaning."""
|
"""Turn the vacuum off stopping the cleaning."""
|
||||||
if self.has_config(CONF_STOP_STATUS):
|
if self.has_config(CONF_STOP_STATUS):
|
||||||
await self._device.set_dp(self._config[CONF_STOP_STATUS],
|
await self._device.set_dp(
|
||||||
self._config[CONF_MODE_DP])
|
self._config[CONF_STOP_STATUS], self._config[CONF_MODE_DP]
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
_LOGGER.error("Missing command for stop in commands set.")
|
_LOGGER.error("Missing command for stop in commands set.")
|
||||||
|
|
||||||
@@ -186,7 +194,7 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
|||||||
async def async_locate(self, **kwargs):
|
async def async_locate(self, **kwargs):
|
||||||
"""Locate the vacuum cleaner."""
|
"""Locate the vacuum cleaner."""
|
||||||
if self.has_config(CONF_LOCATE_DP):
|
if self.has_config(CONF_LOCATE_DP):
|
||||||
await self._device.set_dp('', self._config[CONF_LOCATE_DP])
|
await self._device.set_dp("", self._config[CONF_LOCATE_DP])
|
||||||
|
|
||||||
async def async_set_fan_speed(self, fan_speed, **kwargs):
|
async def async_set_fan_speed(self, fan_speed, **kwargs):
|
||||||
"""Set the fan speed."""
|
"""Set the fan speed."""
|
||||||
@@ -194,8 +202,8 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
|||||||
|
|
||||||
async def async_send_command(self, command, params=None, **kwargs):
|
async def async_send_command(self, command, params=None, **kwargs):
|
||||||
"""Send a command to a vacuum cleaner."""
|
"""Send a command to a vacuum cleaner."""
|
||||||
if command == "set_mode" and 'mode' in params:
|
if command == "set_mode" and "mode" in params:
|
||||||
mode = params['mode']
|
mode = params["mode"]
|
||||||
await self._device.set_dp(mode, self._config[CONF_MODE_DP])
|
await self._device.set_dp(mode, self._config[CONF_MODE_DP])
|
||||||
|
|
||||||
def status_updated(self):
|
def status_updated(self):
|
||||||
|
Reference in New Issue
Block a user