Skip to content

Commit 20c59bc

Browse files
committed
feat: add support for detecting issues with the dock holders
1 parent b1ab4a6 commit 20c59bc

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

roborock/code_mappings.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,40 @@ class RoborockStartType(RoborockEnum):
768768
smart_watch = 821
769769

770770

771+
class RoborockDssCodes(RoborockEnum):
772+
@classmethod
773+
def _missing_(cls: type[RoborockEnum], key) -> RoborockEnum:
774+
# If the calculated value is not provided, then it should be viewed as okay.
775+
# As the math will sometimes result in you getting numbers that don't matter.
776+
return cls.okay # type: ignore
777+
778+
779+
class ClearWaterBoxStatus(RoborockDssCodes):
780+
"""Status of the clear water box."""
781+
782+
okay = 0
783+
out_of_water = 1
784+
out_of_water_2 = 38
785+
refill_error = 48
786+
787+
788+
class DirtyWaterBoxStatus(RoborockDssCodes):
789+
"""Status of the dirty water box."""
790+
791+
okay = 0
792+
full_not_installed = 1
793+
full_not_installed_2 = 39
794+
drain_error = 49
795+
796+
797+
class DustBagStatus(RoborockDssCodes):
798+
"""Status of the dust bag."""
799+
800+
okay = 0
801+
not_installed = 1
802+
full = 34
803+
804+
771805
class DyadSelfCleanMode(RoborockEnum):
772806
self_clean = 1
773807
self_clean_and_dry = 2

roborock/containers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
from .code_mappings import (
1414
SHORT_MODEL_TO_ENUM,
15+
ClearWaterBoxStatus,
16+
DirtyWaterBoxStatus,
17+
DustBagStatus,
1518
RoborockCategory,
1619
RoborockCleanType,
1720
RoborockDockDustCollectionModeCode,
@@ -480,21 +483,21 @@ def current_map(self) -> int | None:
480483
return None
481484

482485
@property
483-
def clear_water_box_status(self) -> int | None:
486+
def clear_water_box_status(self) -> ClearWaterBoxStatus | None:
484487
if self.dss:
485-
return (self.dss >> 2) & 3
488+
return ClearWaterBoxStatus((self.dss >> 2) & 3)
486489
return None
487490

488491
@property
489-
def dirty_water_box_status(self) -> int | None:
492+
def dirty_water_box_status(self) -> DirtyWaterBoxStatus | None:
490493
if self.dss:
491-
return (self.dss >> 4) & 3
494+
return DirtyWaterBoxStatus((self.dss >> 4) & 3)
492495
return None
493496

494497
@property
495-
def dust_bag_status(self) -> int | None:
498+
def dust_bag_status(self) -> DustBagStatus | None:
496499
if self.dss:
497-
return (self.dss >> 6) & 3
500+
return DustBagStatus((self.dss >> 6) & 3)
498501
return None
499502

500503
@property

0 commit comments

Comments
 (0)