Hi,
For some reason the FloleVac stopped showing me the map and I couldn’t get zone coordinates. The Mi app do show the map but there is no way that I know how to get the zone coordinates. So following this I wrote a rule for my vacuum. Improvements are more than welcome
I have a map file for the zones:
kitchen=-5,0.5,3.6,2.6,1
livingroom=0,0.5,4.2,5.2,1
diningroom=-1.6,5.9,2.9,2.7,1
The parameters are:
bottom (y) - meter from the docking point
left (x) - meter from the docking point
w - zone width in meters
h - zone height in meters
repeat - number of times to clean the zone
Note! I’ve chose to use bootom / left / width / height as for me it was simpler to set the coordinates. The vacuum needs bottom / left / top / right.
I defined a zone item:
String Vacuum_Action_Zone "Zone [%s]"
And the rule is:
rule "Vacuum zone cleanup"
when
Item Vacuum_Action_Zone received command
then
if (Vacuum_Status_Status.state == "Charging") {
// Get zone coordinates
val zone = transform("MAP", "zones.map", receivedCommand.toString)
// Make sure we have zone parameters
if (zone != "") {
// Zone parameters: bottom(y), left(x), width, height, repeats
var parameters = zone.split(',')
// Docking point start position
val double x = 25500.0;
val double y = 25500.0;
// Bottom (y) left (x)
val double b = Double::parseDouble(parameters.get(0)) * 1000.0 + x
val double l = Double::parseDouble(parameters.get(1)) * 1000.0 + y
// Top (y) right (x)
val double t = b + Double::parseDouble(parameters.get(2)) * 1000.0
val double r = l + Double::parseDouble(parameters.get(3)) * 1000.0
// Build zone coordinates (and number of times to scan)
val coordinates = String::format("[[%.0f,%.0f,%.0f,%.0f,%s]]", b, l, t, r, parameters.get(4));
logInfo(logName, "Clean {} zone coordinates {}", receivedCommand.toString, coordinates)
Vacuum_Action_Command.sendCommand('app_zoned_clean' + coordinates)
}
}
end
Here more information on the map. I am using the zone cleanup editing to get the coordinates.
The main issue with the zone clean - the map rotation - is not handled here and AFAIK there is no solution for that.