homebridge-xiaomi-roborock-vacuum
homebridge-xiaomi-roborock-vacuum copied to clipboard
Feature request: forbidden zones definition in config.json
Hello, thank you for this awesome homebridge plugin! It would be nice to define forbidden zones: If our S50 is on the way for wet cleaning, it should not take a route over the carpets. So I would like to define the carpet areas as forbidden zones, like I could do in the xiaomi app. But for convenience in the config.json. Do you think, this feature is possible for the homebridge plugin?
Not sure how those are defined/saved to the device. Would require some digging. An easier solution is to define a mop zone and just not include those zones
The proposed work around does not hinder the robot from driving over the carpets to reach the mop zone or on its way back to the dock.
Your right, didn't think of that. All my rooms with carpet are not in a path to another zone without.
Okay for this would need to figure out how to configure no go remotely. If anyone knows the api calls from the app that would be great :)
@command( click.argument("start", type=bool) ) def edit_map(self, start): """Start map editing?""" if start: return self.send("start_edit_map")[0] == "ok" else: return self.send("end_edit_map")[0] == "ok"
@command(
click.option("--version", default=1)
)
def fresh_map(self, version):
"""Return fresh map?"""
if version == 1:
return self.send("get_fresh_map")
elif version == 2:
return self.send("get_fresh_map_v2")
else:
raise VacuumException("Unknown map version: %s" % version)
@command(
click.option("--version", default=1)
)
def persist_map(self, version):
"""Return fresh map?"""
if version == 1:
return self.send("get_persist_map")
elif version == 2:
return self.send("get_persist_map_v2")
else:
raise VacuumException("Unknown map version: %s" % version)
@command(
click.argument("x1", type=int),
click.argument("y1", type=int),
click.argument("x2", type=int),
click.argument("y2", type=int),
)
def create_software_barrier(self, x1, y1, x2, y2):
"""Create software barrier (gen2 only?).
NOTE: Multiple nogo zones and barriers could be added by passing
a list of them to save_map.
Requires new fw version.
3.3.9_001633+?
"""
# First parameter indicates the type, 1 = barrier
payload = [1, x1, y1, x2, y2]
return self.send("save_map", payload)[0] == "ok"
@command(
click.argument("x1", type=int),
click.argument("y1", type=int),
click.argument("x2", type=int),
click.argument("y2", type=int),
click.argument("x3", type=int),
click.argument("y3", type=int),
click.argument("x4", type=int),
click.argument("y4", type=int),
)
def create_nogo_zone(self, x1, y1, x2, y2, x3, y3, x4, y4):
"""Create a rectangular no-go zone (gen2 only?).
NOTE: Multiple nogo zones and barriers could be added by passing
a list of them to save_map.
Requires new fw version.
3.3.9_001633+?
"""
# First parameter indicates the type, 0 = zone
payload = [0, x1, y1, x2, y2, x3, y3, x4, y4]
return self.send("save_map", payload)[0] == "ok"
@command(
click.argument("enable", type=bool)
)
def enable_lab_mode(self, enable):
"""Enable persistent maps and software barriers.
This is required to use create_nogo_zone and create_software_barrier
commands."""
return self.send("set_lab_status", int(enable))['ok']
`
https://github.com/rytilahti/python-miio/blob/master/miio/vacuum.py