Skip to content

Commit

Permalink
Fix mass auto configure doesn't retrieve data froum cloud. #158
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Mar 3, 2024
1 parent b14e254 commit 5b95877
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
2 changes: 2 additions & 0 deletions custom_components/localtuya/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Config flow for LocalTuya integration integration."""

import asyncio
import errno
import logging
Expand Down Expand Up @@ -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)

Expand Down
12 changes: 0 additions & 12 deletions custom_components/localtuya/core/ha_entities/vacuums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 6 additions & 3 deletions custom_components/localtuya/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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):
Expand Down

0 comments on commit 5b95877

Please sign in to comment.