Skip to content

Commit 9aedc53

Browse files
committed
roborock: auto empty dustbin support
addresses #1107
1 parent a577fe9 commit 9aedc53

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

miio/integrations/vacuum/roborock/vacuum.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ class CarpetCleaningMode(enum.Enum):
121121
Ignore = 2
122122

123123

124+
class DustCollectionMode(enum.Enum):
125+
"""Auto emptying mode (S7 only)"""
126+
127+
Smart = 0
128+
Quick = 1
129+
Daily = 2
130+
Strong = 3
131+
Max = 4
132+
133+
124134
ROCKROBO_V1 = "rockrobo.vacuum.v1"
125135
ROCKROBO_S5 = "roborock.vacuum.s5"
126136
ROCKROBO_S5_MAX = "roborock.vacuum.s5e"
@@ -746,6 +756,49 @@ def set_carpet_cleaning_mode(self, mode: CarpetCleaningMode):
746756
== "ok"
747757
)
748758

759+
@command()
760+
def enable_dust_collection(self):
761+
"""Enable automatic dust collection."""
762+
return (
763+
self.send("set_dust_collection_switch_status", {"status": 1})[0]
764+
== "ok"
765+
)
766+
767+
@command()
768+
def disable_dust_collection(self):
769+
"""Disable automatic dust collection."""
770+
return (
771+
self.send("set_dust_collection_switch_status", {"status": 0})[0]
772+
== "ok"
773+
)
774+
775+
@command()
776+
def dust_collection_mode(self) -> Optional[DustCollectionMode]:
777+
"""Get the dust collection mode setting."""
778+
try:
779+
return DustCollectionMode(self.send("get_dust_collection_mode")["mode"])
780+
except Exception as err:
781+
_LOGGER.warning("Error while requesting dust collection mode: %s", err)
782+
return None
783+
784+
@command(click.argument("mode", type=EnumType(DustCollectionMode)))
785+
def set_dust_collection_mode(self, mode: DustCollectionMode) -> bool:
786+
"""Set dust collection mode setting."""
787+
return (
788+
self.send("set_dust_collection_mode", {"mode": mode.value})[0]
789+
== "ok"
790+
)
791+
792+
@command()
793+
def start_dust_collection(self):
794+
"""Activate automatic dust collection."""
795+
return self.send("app_start_collect_dust")
796+
797+
@command()
798+
def stop_dust_collection(self):
799+
"""Abort in progress dust collection."""
800+
return self.send("app_stop_collect_dust")
801+
749802
@command()
750803
def stop_zoned_clean(self):
751804
"""Stop cleaning a zone."""

0 commit comments

Comments
 (0)