Skip to content

Commit 17a25b9

Browse files
committed
chore: move status
1 parent fbb6df9 commit 17a25b9

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

roborock/devices/traits/v1/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,6 @@ async def discover_features(self) -> None:
263263
await self.device_features.refresh()
264264
# Dock type also acts like a device feature for some traits.
265265
dock_type = await self._dock_type()
266-
if self.status.dss is None:
267-
await self.status.refresh()
268-
if self.status.dock_type is not None:
269-
dock_type = self.status.dock_type
270-
await self._set_cached_trait_data("dock_type", dock_type)
271266
dock_features = RoborockDockFeatures.from_dock_type(dock_type, has_am=self.status.has_am)
272267

273268
# Initialize traits with special arguments before the generic loop
@@ -314,9 +309,16 @@ async def _dock_type(self) -> RoborockDockTypeCode:
314309
if dock_type is not None:
315310
_LOGGER.debug("Using cached dock type: %s", dock_type)
316311
try:
317-
return RoborockDockTypeCode(dock_type)
312+
dock_type = RoborockDockTypeCode(dock_type)
318313
except ValueError:
319314
_LOGGER.debug("Cached dock type %s is invalid, refreshing", dock_type)
315+
else:
316+
if self.status.dss is None:
317+
await self.status.refresh()
318+
if self.status.dock_type is not None:
319+
dock_type = self.status.dock_type
320+
await self._set_cached_trait_data("dock_type", dock_type)
321+
return dock_type
320322

321323
_LOGGER.debug("Starting dock type discovery")
322324
await self.status.refresh()

0 commit comments

Comments
 (0)