2121 resolve_cleaning_mode ,
2222)
2323from roborock .devices .traits .common import DpsDataConverter , TraitUpdateListener
24- from roborock .exceptions import RoborockUnsupportedFeature
24+ from roborock .exceptions import RoborockException , RoborockUnsupportedFeature
2525from roborock .roborock_message import RoborockDataProtocol
2626from roborock .roborock_typing import RoborockCommand
2727
@@ -145,8 +145,15 @@ def clean_then_mop(self) -> bool | None:
145145 This is a separate axis from ``current_cleaning_mode``. The cleaning
146146 mode is derived from ``fan_power``, ``water_box_mode`` and ``mop_mode``
147147 and describes *what* the robot does in a room (vacuum, mop, both). This
148- flag describes the *order* when it does both. Changing one leaves the
149- other untouched; set it with ``set_clean_then_mop``.
148+ flag describes the *order* when it does both. On the device the two are
149+ stored independently: writing one leaves the other untouched. Set it
150+ with ``set_clean_then_mop``.
151+
152+ The vendor app presents it as a fourth choice next to "vacuum and mop",
153+ "mop only" and "vacuum only", and clears it when one of those is picked.
154+ A consumer that wants the same experience should turn this off when it
155+ selects a cleaning mode other than vacuum and mop; this library does
156+ not do that implicitly.
150157
151158 ``None`` means the device does not support the feature.
152159 """
@@ -201,8 +208,10 @@ async def set_clean_then_mop(self, enabled: bool) -> None:
201208 """
202209 if not self ._device_features_trait .is_clean_then_mop_mode_supported :
203210 raise RoborockUnsupportedFeature ("Clean then mop is not supported" )
211+ if self .fan_power is None or self .water_box_mode is None :
212+ raise RoborockException ("Status is not loaded, call refresh() first" )
204213 seq_type = _SEQ_TYPE_CLEAN_THEN_MOP if enabled else 0
205- params : dict [str , int | None ] = {
214+ params : dict [str , int ] = {
206215 "type" : seq_type ,
207216 "fan_power" : self .fan_power ,
208217 "water_box_mode" : self .water_box_mode ,
@@ -213,6 +222,7 @@ async def set_clean_then_mop(self, enabled: bool) -> None:
213222 params ["repeat" ] = 1
214223 await self .rpc_channel .send_command (RoborockCommand .APP_SET_CLEAN_SEQUENCE_TYPE , params = params )
215224 self .seq_type = seq_type
225+ self ._notify_update ()
216226
217227 def update_from_dps (self , decoded_dps : dict [RoborockDataProtocol , Any ]) -> None :
218228 """Update the trait from data protocol push message data.
0 commit comments