Skip to content

Commit

Permalink
Fixes and new features for W10
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiğit Topcu committed Nov 5, 2022
1 parent a6c9cc6 commit 9a5e08d
Show file tree
Hide file tree
Showing 15 changed files with 418 additions and 95 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ All features completely reverse engineered from the official Mi Home app RN plug
- `dreame.vacuum.r2215` *(X10)*
- `dreame.vacuum.r2235` *(X10 Ultra)*
- **Mijia**
- `dreame.vacuum.p2036` *(Trouver LDS Finder)*
- `dreame.vacuum.p2150o` *(Vacuum-Mop)*
- `dreame.vacuum.p2150a` *(Vacuum-Mop 2 Ultra)*
- `dreame.vacuum.p2150b` *(Vacuum-Mop 2 Ultra Set)*
Expand Down
1 change: 1 addition & 0 deletions custom_components/dreame_vacuum/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"dreame.vacuum.r2211o",
"dreame.vacuum.r2254",
"dreame.vacuum.r2209",
"dreame.vacuum.p2036",

## Dreame Vslam Robots
#"dreame.vacuum.p2140q",
Expand Down
36 changes: 35 additions & 1 deletion custom_components/dreame_vacuum/dreame/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
ERROR_MOP_PAD: Final = "mop_pad"
ERROR_WET_MOP_PAD: Final = "wet_mop_pad"
ERROR_CLEAN_MOP_PAD: Final = "clean_mop_pad"
ERROR_CLEAN_TANK_LEVEL: Final = "clean_tank_level"
ERROR_DIRTY_TANK_LEVEL: Final = "dirty_tank_level"
ERROR_WASHBOARD_LEVEL: Final = "washboard_level"

ATTR_CHARGING: Final = "charging"
ATTR_STARTED: Final = "started"
Expand Down Expand Up @@ -658,6 +661,9 @@
DreameVacuumErrorCode.MOP_PAD: ERROR_MOP_PAD,
DreameVacuumErrorCode.WET_MOP_PAD: ERROR_WET_MOP_PAD,
DreameVacuumErrorCode.CLEAN_MOP_PAD: ERROR_CLEAN_MOP_PAD,
DreameVacuumErrorCode.CLEAN_TANK_LEVEL: ERROR_CLEAN_TANK_LEVEL,
DreameVacuumErrorCode.DIRTY_TANK_LEVEL: ERROR_DIRTY_TANK_LEVEL,
DreameVacuumErrorCode.WASHBOARD_LEVEL: ERROR_WASHBOARD_LEVEL,
}

DUST_COLLECTION_TO_NAME: Final = {
Expand Down Expand Up @@ -716,11 +722,13 @@
DreameVacuumErrorCode.CHARGE_FAULT: 12,
DreameVacuumErrorCode.CHARGE_NO_ELECTRIC: 16,
DreameVacuumErrorCode.BATTERY_FAULT: 29,
DreameVacuumErrorCode.INFRARED_FAULT: 39,
DreameVacuumErrorCode.LDS_ERROR: 48,
DreameVacuumErrorCode.LDS_BUMPER: 49,
DreameVacuumErrorCode.EDGE: 54,
DreameVacuumErrorCode.EDGE_2: 54,
DreameVacuumErrorCode.CARPET: 55,
DreameVacuumErrorCode.ULTRASONIC: 58,
DreameVacuumErrorCode.ROUTE: 61,
DreameVacuumErrorCode.ROUTE_2: 62,
DreameVacuumErrorCode.BLOCKED: 63,
Expand All @@ -729,11 +737,25 @@
DreameVacuumErrorCode.RESTRICTED: 65,
DreameVacuumErrorCode.RESTRICTED_2: 65,
DreameVacuumErrorCode.RESTRICTED_3: 65,
DreameVacuumErrorCode.MOP_REMOVED: 69,
DreameVacuumErrorCode.MOP_PAD_STOP_ROTATE: 69,
DreameVacuumErrorCode.MOP_PAD_STOP_ROTATE_2: 69,
DreameVacuumErrorCode.BIN_FULL: 101,
DreameVacuumErrorCode.BIN_FULL_2: 101,
DreameVacuumErrorCode.BIN_OPEN: 102,
DreameVacuumErrorCode.BIN_OPEN_2: 102,

DreameVacuumErrorCode.WATER_TANK: 105,
DreameVacuumErrorCode.CLEAN_TANK_LEVEL: 105,
DreameVacuumErrorCode.DIRTY_WATER_TANK: 106,
DreameVacuumErrorCode.DIRTY_WATER_TANK_2: 106,
DreameVacuumErrorCode.DIRTY_WATER_TANK_BLOCKED: 106,
DreameVacuumErrorCode.DIRTY_WATER_TANK_PUMP: 106,
DreameVacuumErrorCode.DIRTY_TANK_LEVEL: 106,
DreameVacuumErrorCode.WATER_TANK_DRY: 107,
DreameVacuumErrorCode.MOP_PAD: 111,
DreameVacuumErrorCode.WET_MOP_PAD: 111,
DreameVacuumErrorCode.WASHBOARD_LEVEL: 111,
DreameVacuumErrorCode.CLEAN_MOP_PAD: 114,
}

# Dreame Vacuum error descriptions
Expand Down Expand Up @@ -1057,4 +1079,16 @@
"The cleaning task is complete, please clean the mop pad washboard.",
"Please clean the mop pad washboard in time to avoid stains or odor.",
],
DreameVacuumErrorCode.CLEAN_TANK_LEVEL: [
"Please fill the clean water tank.",
"The water in the clean water tank is about to be used up. Check and fill the clean water tank promptly.",
],
DreameVacuumErrorCode.DIRTY_TANK_LEVEL: [
"The water level in the used water tank is too high.",
"Please check if the used water tank is full.",
],
DreameVacuumErrorCode.WASHBOARD_LEVEL: [
"Water level in the washboard is too high.",
"Please clean the used water tank and washboard in time.",
],
}
7 changes: 5 additions & 2 deletions custom_components/dreame_vacuum/dreame/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ def get_map_for_render(self, map_index: int) -> MapData | None:
if map_data.saved_map:
# App does not render robot position on saved map list
map_data.robot_position = None
map_data.obstacles = None

# App does not render restricted zones on saved map list
#map_data.walls = None
Expand Down Expand Up @@ -2987,15 +2988,17 @@ def custom_order(self) -> bool:
"""Returns true when custom cleaning sequence is set."""
segments = self.segments
if segments:
return bool(next(iter(segments.values())).order)
for v in segments.values():
if v.order:
return True
return False

@property
def cleaning_sequence(self) -> list[int] | None:
"""Returns custom cleaning sequence list."""
segments = self.segments
if segments:
return list(sorted(segments, key=lambda segment_id: segments[segment_id].order)) if self.custom_order else None
return list(sorted(segments, key=lambda segment_id: segments[segment_id].order if segments[segment_id].order else 99)) if self.custom_order else None
return [] if self.custom_order else None

@property
Expand Down
Loading

0 comments on commit 9a5e08d

Please sign in to comment.