Big Thanks!!
With a bit tweak (and some error with my .py file) it works as expected now.
As a bonus, with vacuum_send_command_multiple_zones
script you can clean more than 5 zones with one call - set ignore_zones_limit
property to true in cards configuration
Will also wait for this tutorial
I edited my map with Gimp but it doesn’t update within the card, it shows still the old map!?
You have to clear browsers cache
That did the trick
Thank you, awesome work!
I read that this plugin won’t work with the gen1, is this true?
It will work with gen1, but it will require map calibration each time map in Xiaomi Home rotates itself.
To prevent it from happening you have to use zoned cleanup instead of normal full cleaning (like mentioned above Xiaomi Vacuum Interactive Map Card).
Ok thanks for information.
If the Roborock is rooted on Valetudo will this prevent from rotating each time itself?
I don’t use Valetudo, so I unfortunately can’t answer your question.
Is your card capable of defining no-go zones also without triggering a cleanup? So that I can have a scheduled cleanup every couple of days, but define zones where it should not go using your card?
I am trying to avoid using the xiaomi app as I don’t trust it (I’ve also blocked the vacuum from the internet).
You can only define the no go zones with the mihome app. It’s a one time thing to do.
@patrick_jane Right now I am focused on live maps, but after that I will take a look at wider support for vacuums features.
Is there any chance to get live map without rooting, like in the Flolevac?
I tried to decompile FloleVac to check how do they get map data, it appears that it goes through their servers, so unfortunately I can’t reproduce this feature. I have seen some guy managed to get map data (link), but he have posted it about year ago and stoped responding to comments. Anyway, I still try to find a solution, but I don’t think it is in my reach right now.
Just incase anyone in wondering this won’t work with valetudo out of the box unless there are some major changes
valetudo requires that you run a mapping clean then create zones, you clean the zones by calling the zones directly by name and not co-ordinates every attempt i tried using co-ordinates results in the robot doing a loop then return to base.
secondly valetudo uses a different y axis if you get the co-ordinates from /api/get_config you need to subtract y from 51200 (x stays the same) this is shown here
what you can do is draw the co-ordinates in the lovelace card call the python script, have the script match the params and call the zone.
alternatively you can make a picture element card and just call the zones on click on the icon
elements:
- icon: 'mdi:broom'
style:
'--iron-icon-fill-color': '#777'
left: 70%
top: 90%
tap_action:
action: call-service
service: vacuum.send_command
service_data:
command: zoned_cleanup
entity_id: vacuum.rockrobo
params:
zone_ids:
- Kitchen
type: icon
image: /local/img/vacuum_map.png
type: picture-elements
if 3_14 can make a valetudo mode where clicking on the zone on the map just calls the send command zone cleanup then that’s the only idea i have to get valetudo working in this card
As far as I know Valetudo supports 2 commands for zoned cleanup: zoned_cleanup
for named zones and app_zoned_clean
for zones defined by coordinates (implemented here), so you should be able to use this card just fine (after making sure you use right coordinates for calibration).
You can check out comments in this issue on my GitHub for more info about Valetudo compatibility.
thanks for that calibration was easy after working out you can dump the co-ordinates from the config and subtracting both y from 51200, but when i use your lovelace card it calls app_zoned_clean, the area gets drawn in valetudo but the vacuum doesn’t clean the zone it just makes a weird path and returns to the dock i’ll try get a screen shot tomorrow.
Please include coordinates and screenshot of both card and valetudo maps if possible
well i just ran the robot in the middle of the night hope this helps you out
this is a part of the card but should be the relevant area
the card
the debug co-ordinates
this is valetudo it maps the zone but the robot does weird pathing gets stuck and returns home. but if you ask it to clean the zone by name it would do its usual where it does the perimeter then portions up the room and does it in sections.
this is the zone in get_config
["Master",[[28895,20764,33856,26101,1],[33877,24793,37527,29401,1]]]
this is the mapping calibration
- map:
x: 405
'y': 338
vacuum:
x: 18651
'y': 20708
- map:
x: 470
'y': 338
vacuum:
x: 21597
'y': 20708
- map:
x: 469
'y': 273
vacuum:
x: 21597
'y': 23798
Running a vacuum at 3 AM is an essential part of developing this card
Do you use FloleVac? Do other modes work correctly?
Valetudo does some weird coordinates conversions, it is possible that coordinates from get_config do not match ones used in app_zoned_clean
and app_goto_target
.
i have it in nox but i dont use it much, trying to do everything in home-assistant. i can do everything in valetudo itself so that’s the stop gap measure
yes the co-ordinates dont match, i’ve been manually modifying them as valetudo changes it with this value
DIMENSION_MM: 50 * 1024,
in Tools.js
/* zones is an array of areas to clean: [[x1, y1, x2, y2, iterations],..] */
Vacuum.prototype.startCleaningZoneByCoords = function(zones, callback) {
if(Array.isArray(zones) && zones.length <= 5) {
const flippedZones = zones.map(zone => {
const yFlippedZone = [
zone[0],
Tools.DIMENSION_MM - zone[1],
zone[2],
Tools.DIMENSION_MM - zone[3],
zone[4]
];
// it seems as the vacuum only works with 'positive rectangles'! So flip the coordinates if the user entered them wrong.
// x1 has to be < x2 and y1 < y2
return [
yFlippedZone[0] > yFlippedZone[2] ? yFlippedZone[2] : yFlippedZone[0],
yFlippedZone[1] > yFlippedZone[3] ? yFlippedZone[3] : yFlippedZone[1],
yFlippedZone[0] > yFlippedZone[2] ? yFlippedZone[0] : yFlippedZone[2],
yFlippedZone[1] > yFlippedZone[3] ? yFlippedZone[1] : yFlippedZone[3],
yFlippedZone[4]
]
});
this.sendMessage("app_zoned_clean", flippedZones, {}, callback)
} else {
callback(new Error("Zones must be array of at most 5 zones."))
}
};
i havent had time to look through valetudo yet so it might be something funky in there.
since i only use zone cleaning after the initial discovery my map hasnt dissapeared. i never had to redo any co-ordinates on the S5