Skip to content

Commit f747c4a

Browse files
committed
chore: clean up and better match status trait
1 parent f9c8e6d commit f747c4a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

roborock/devices/traits/v1/wash_towel_mode.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Trait for wash towel mode."""
22

33
from functools import cached_property
4+
from typing import Self
45

56
from roborock.data import WashTowelMode, WashTowelModes, get_wash_towel_modes
67
from roborock.device_features import is_wash_n_fill_dock
@@ -18,11 +19,17 @@ class WashTowelModeTrait(WashTowelMode, common.V1TraitMixin):
1819
def __init__(
1920
self,
2021
device_feature_trait: DeviceFeaturesTrait,
21-
wash_mode: WashTowelModes | None = None,
2222
) -> None:
2323
super().__init__()
2424
self.device_feature_trait = device_feature_trait
25-
self.wash_mode = wash_mode
25+
26+
def _parse_response(self, response: common.V1ResponseData) -> Self:
27+
"""Parse the response from the device into a WashTowelMode object."""
28+
if isinstance(response, list):
29+
response = response[0]
30+
if isinstance(response, dict):
31+
return WashTowelMode.from_dict(response)
32+
raise ValueError(f"Unexpected wash towel mode format: {response!r}")
2633

2734
@cached_property
2835
def wash_towel_mode_options(self) -> list[WashTowelModes]:

0 commit comments

Comments
 (0)