diff --git a/custom_components/localtuya/config_flow.py b/custom_components/localtuya/config_flow.py index 3e3455e5d..20062f97a 100644 --- a/custom_components/localtuya/config_flow.py +++ b/custom_components/localtuya/config_flow.py @@ -1,4 +1,5 @@ """Config flow for LocalTuya integration integration.""" + import asyncio import errno import logging @@ -1219,6 +1220,7 @@ def update_fails(dev_id: str, reason: str, msg: str = None): # Configure entities. for dev_id, dev_data in devices.copy().items(): category = devices_cloud_data[dev_id].get("category") + dev_data["device_cloud_data"] = devices_cloud_data[dev_id] if category and (dps_strings := dev_data.get(CONF_DPS_STRINGS, False)): dev_entites = gen_localtuya_entities(dev_data, category) diff --git a/custom_components/localtuya/core/ha_entities/vacuums.py b/custom_components/localtuya/core/ha_entities/vacuums.py index 7f6cbd096..b9a1f762b 100644 --- a/custom_components/localtuya/core/ha_entities/vacuums.py +++ b/custom_components/localtuya/core/ha_entities/vacuums.py @@ -35,18 +35,6 @@ DEFAULT_STOP_STATUS = "standby" -DEFAULT_VALUES = { - CONF_IDLE_STATUS_VALUE: DEFAULT_IDLE_STATUS, - CONF_DOCKED_STATUS_VALUE: CONF_DOCKED_STATUS_VALUE, - CONF_RETURNING_STATUS_VALUE: DEFAULT_RETURNING_STATUS, - CONF_MODES: DEFAULT_MODES, - CONF_RETURN_MODE: DEFAULT_RETURN_MODE, - CONF_FAN_SPEEDS: DEFAULT_FAN_SPEEDS, - CONF_PAUSED_STATE: DEFAULT_PAUSED_STATE, - CONF_STOP_STATUS: DEFAULT_STOP_STATUS, -} - - def localtuya_vaccuums( modes: str = None, returning_status_value: str = None, diff --git a/custom_components/localtuya/vacuum.py b/custom_components/localtuya/vacuum.py index 058cd968d..3ad1f9699 100644 --- a/custom_components/localtuya/vacuum.py +++ b/custom_components/localtuya/vacuum.py @@ -174,7 +174,7 @@ async def async_pause(self, **kwargs): if self.has_config(CONF_PAUSE_DP): return await self._device.set_dp(True, self._config[CONF_PAUSE_DP]) - await self._device.set_dp(False, self._config[CONF_POWERGO_DP]) + await self.async_stop() async def async_return_to_base(self, **kwargs): """Set the vacuum cleaner to return to the dock.""" @@ -187,12 +187,15 @@ async def async_return_to_base(self, **kwargs): async def async_stop(self, **kwargs): """Turn the vacuum off stopping the cleaning.""" - if self.has_config(CONF_STOP_STATUS): + if ( + self.has_config(CONF_STOP_STATUS) + and self._config[CONF_STOP_STATUS] in self._modes_list + ): await self._device.set_dp( self._config[CONF_STOP_STATUS], self._config[CONF_MODE_DP] ) else: - await self.async_pause() + await self._device.set_dp(False, self._config[CONF_POWERGO_DP]) # _LOGGER.error("Missing command for stop in commands set.") async def async_clean_spot(self, **kwargs):