diff --git a/roborock/code_mappings.py b/roborock/code_mappings.py index ea64fe1..c78a22a 100644 --- a/roborock/code_mappings.py +++ b/roborock/code_mappings.py @@ -4,6 +4,7 @@ from enum import Enum, IntEnum _LOGGER = logging.getLogger(__name__) +completed_warnings = set() class RoborockEnum(IntEnum): @@ -16,10 +17,16 @@ def name(self) -> str: @classmethod def _missing_(cls: type[RoborockEnum], key) -> RoborockEnum: if hasattr(cls, "unknown"): - _LOGGER.warning(f"Missing {cls.__name__} code: {key} - defaulting to 'unknown'") + warning = f"Missing {cls.__name__} code: {key} - defaulting to 'unknown'" + if warning not in completed_warnings: + completed_warnings.add(warning) + _LOGGER.warning(warning) return cls.unknown # type: ignore default_value = next(item for item in cls) - _LOGGER.warning(f"Missing {cls.__name__} code: {key} - defaulting to {default_value}") + warning = f"Missing {cls.__name__} code: {key} - defaulting to {default_value}" + if warning not in completed_warnings: + completed_warnings.add(warning) + _LOGGER.warning(warning) return default_value @classmethod @@ -409,6 +416,93 @@ def __missing__(self, key): return RoborockCategory.UNKNOWN +class RoborockFinishReason(RoborockEnum): + manual_interrupt = 21 # Cleaning interrupted by user + cleanup_interrupted = 24 # Cleanup interrupted + manual_interrupt_2 = 21 + breakpoint = 32 # Could not continue cleaning + breakpoint_2 = 33 + cleanup_interrupted_2 = 34 + manual_interrupt_3 = 35 + manual_interrupt_4 = 36 + manual_interrupt_5 = 37 + manual_interrupt_6 = 43 + locate_fail = 45 # Positioning Failed + cleanup_interrupted_3 = 64 + locate_fail_2 = 65 + manual_interrupt_7 = 48 + manual_interrupt_8 = 49 + manual_interrupt_9 = 50 + cleanup_interrupted_4 = 51 + finished_cleaning = 52 # Finished cleaning + finished_cleaning_2 = 54 + finished_cleaning_3 = 55 + finished_cleaning_4 = 56 + finished_clenaing_5 = 57 + manual_interrupt_10 = 60 + area_unreachable = 61 # Area unreachable + area_unreachable_2 = 62 + washing_error = 67 # Washing error + back_to_wash_failure = 68 # Failed to return to the dock + cleanup_interrupted_5 = 101 + breakpoint_4 = 102 + manual_interrupt_11 = 103 + cleanup_interrupted_6 = 104 + cleanup_interrupted_7 = 105 + cleanup_interrupted_8 = 106 + cleanup_interrupted_9 = 107 + cleanup_interrupted_10 = 109 + cleanup_interrupted_11 = 110 + patrol_success = 114 # Cruise completed + patrol_fail = 115 # Cruise failed + pet_patrol_success = 116 # Pet found + pet_patrol_fail = 117 # Pet found failed + + +class RoborockInCleaning(RoborockEnum): + complete = 0 + global_clean_not_complete = 1 + zone_clean_not_complete = 2 + segment_clean_not_complete = 3 + + +class RoborockCleanType(RoborockEnum): + all_zone = 1 + draw_zone = 2 + select_zone = 3 + quick_build = 4 + video_patrol = 5 + pet_patrol = 6 + + +class RoborockStartType(RoborockEnum): + button = 1 + app = 2 + schedule = 3 + mi_home = 4 + quick_start = 5 + voice_control = 13 + routines = 101 + alexa = 801 + google = 802 + ifttt = 803 + yandex = 804 + homekit = 805 + xiaoai = 806 + tmall_genie = 807 + duer = 808 + dingdong = 809 + siri = 810 + clova = 811 + wechat = 901 + alipay = 902 + aqara = 903 + hisense = 904 + huawei = 905 + widget_launch = 820 + smart_watch = 821 + + class DyadSelfCleanMode(RoborockEnum): self_clean = 1 self_clean_and_dry = 2 diff --git a/roborock/const.py b/roborock/const.py index c3bfc11..4b6b34d 100644 --- a/roborock/const.py +++ b/roborock/const.py @@ -42,8 +42,11 @@ ROBOROCK_C1 = "roborock.vacuum.c1" ROBOROCK_S8_PRO_ULTRA = "roborock.vacuum.a70" ROBOROCK_S8 = "roborock.vacuum.a51" -ROBOROCK_P10 = "roborock.vacuum.a75" +ROBOROCK_P10 = "roborock.vacuum.a75" # also known as q_revo ROBOROCK_S8_MAXV_ULTRA = "roborock.vacuum.a97" +ROBOROCK_QREVO_S = "roborock.vacuum.a104" +ROBOROCK_QREVO_PRO = "roborock.vacuum.a101" +ROBOROCK_QREVO_MAXV = "roborock.vacuum.a87" ROBOROCK_DYAD_AIR = "roborock.wetdryvac.a107" ROBOROCK_DYAD_PRO_COMBO = "roborock.wetdryvac.a83" diff --git a/roborock/containers.py b/roborock/containers.py index 74a9630..65dac3b 100644 --- a/roborock/containers.py +++ b/roborock/containers.py @@ -13,6 +13,7 @@ from .code_mappings import ( RoborockCategory, + RoborockCleanType, RoborockDockDustCollectionModeCode, RoborockDockErrorCode, RoborockDockTypeCode, @@ -25,6 +26,8 @@ RoborockFanSpeedS7, RoborockFanSpeedS7MaxV, RoborockFanSpeedS8MaxVUltra, + RoborockFinishReason, + RoborockInCleaning, RoborockMopIntensityCode, RoborockMopIntensityP10, RoborockMopIntensityS5Max, @@ -36,6 +39,7 @@ RoborockMopModeS7, RoborockMopModeS8MaxVUltra, RoborockMopModeS8ProUltra, + RoborockStartType, RoborockStateCode, ) from .const import ( @@ -47,6 +51,9 @@ ROBOROCK_G10S_PRO, ROBOROCK_P10, ROBOROCK_Q7_MAX, + ROBOROCK_QREVO_MAXV, + ROBOROCK_QREVO_PRO, + ROBOROCK_QREVO_S, ROBOROCK_S4_MAX, ROBOROCK_S5_MAX, ROBOROCK_S6, @@ -408,7 +415,7 @@ class Status(RoborockBase): square_meter_clean_area: float | None = None error_code: RoborockErrorCode | None = None map_present: int | None = None - in_cleaning: int | None = None + in_cleaning: RoborockInCleaning | None = None in_returning: int | None = None in_fresh_state: int | None = None lab_status: int | None = None @@ -574,6 +581,12 @@ class S8MaxvUltraStatus(Status): ROBOROCK_S8_PRO_ULTRA: S8ProUltraStatus, ROBOROCK_G10S_PRO: S7MaxVStatus, ROBOROCK_P10: P10Status, + # These likely are not correct, + # but i am currently unable to do my typical reverse engineering/ get any data from users on this, + # so this will be here in the mean time. + ROBOROCK_QREVO_S: P10Status, + ROBOROCK_QREVO_MAXV: P10Status, + ROBOROCK_QREVO_PRO: P10Status, ROBOROCK_S8_MAXV_ULTRA: S8MaxvUltraStatus, } @@ -613,9 +626,9 @@ class CleanRecord(RoborockBase): square_meter_area: float | None = None error: int | None = None complete: int | None = None - start_type: int | None = None - clean_type: int | None = None - finish_reason: int | None = None + start_type: RoborockStartType | None = None + clean_type: RoborockCleanType | None = None + finish_reason: RoborockFinishReason | None = None dust_collection_status: int | None = None avoid_count: int | None = None wash_count: int | None = None