Thanks everyone who’s contributed so far to the Weback integration. Works really well on HASS Core running Android 13 w/Termux.
I miss the map and rooms functionality. I would love to ask the vacuum to clean a specific room.
So, I’ve reversed the Weback APK, done some digging, and can finally report on the map format. I intend to fork @Jezza34000’s repo and add maps in time. Will submit a PR when ready. I’ve only spent a few hours on this so far.
My device is an ‘Electriq Helga’ - iQlean LR01. It uses LiDAR navigation. I noticed many different paths in the APK for different navigation / mapping systems. It’s possible that the following only applies to LiDAR machines.
Weback API - Maps
POST https://user.grit-cloud.com/prod/api
opt
can be set to: (pass sub_type
and thing_name
)
reuse_map_list_get
No extra params. Returns reusable (ie. live map) listings.
reuse_map_get
Pass map_id (int). Returns JSON response with map_data
property. Will get into how this is decoded shortly.
history_map_list_get
Return a list of historic maps - unsure why / what for at the moment.
history_map_get
Pass file_name
to retrieve map_data
.
map_data
Format
map_data
is base64 encoded, zlib compressed. You need to base64 decode, then run that through a zlib decompressor. You’ll get JSON.
This JSON includes:
- Map dimensions, resolution, origin
- Map data (base64, 2bit encoding, big endian)
- Room_id → Room name mapping
- Room bounding boxes
- Various paths
- Forbidden zones (interestingly, there’s a mop-specific forbidden zone which doesn’t appear in the app. It may be usable with in stock vacuum firmware.)
After much headscratching, I managed to parse the actual map bitmap. It’s base64 encoded too, but then also in 2-bit format. The pixel states are nothing, floor, wall as far as I can tell. I’ve only just reversed engineered this format so much more work to be done. Here’s a janky python script which will render a map image from the original map_data
JSON (ie. from reuse_map_get
). Save map_data
as map.b64
to process.
import base64
import zlib
import json
from PIL import Image
class VacMap:
def __init__(self, input):
self.data = json.loads(zlib.decompress(base64.b64decode(input)))
print(len(self.data['MapData']))
self.map_data = bytearray(base64.b64decode(self.data['MapData']))
map_data = VacMap(open("map.b64").read())
map = bytearray(b"")
h = map_data.data['MapHigh']
w = map_data.data['MapWidth']
h, w = h, w
for i in range(0, len(map_data.map_data)):
byte = map_data.map_data[i]
map.append(((byte & 192) >> 6) * 85)
map.append(((byte & 48) >> 4) * 85)
map.append(((byte & 12) >> 2) * 85)
map.append((byte & 3) * 85)
print("width " + str(w) + " height " + str(h))
img = Image.frombytes("L", (int(w), int(h)), bytes(map))
img.show()
Here’s an example of one of my map_data
s:
{
"ProtocolVersion":"1.0",
"map_id":"12",
"MapHigh":150,
"MapWidth":218,
"ChargerPoint":[
-0.509063720703125,
-20.13894653320313
],
"MapOrigin":[
109,
147
],
"MapResolution":0.05000000074505806,
"MapData":"//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////1VX//////////////////////////////////////////////////////////////////////QAf///////////////////1V////////////////////////////////////////////////9AB////////////////////QFVVVV////////////////////////////////////////////0AFVVVVVf/////////////9AAAAAH////////////////////////////////////////////QAAAAAAB/////////1VV//0AAAAAV///////////////////////////////////////////9AAAAAAAH/////////QAFVVQAAAAAH1V/////////////////////////////////////////0AAAAAAAf////////9AAAAAAAAAAAXQH/////////////////////////////////////////QAAAAAAB/////////0AAAAAAAAAAAdAf/////////////////////VVVV///////////////9AAAAAAAH/////////QAAAAAAAAAAB0B/////////////9VVVVVVVVAAAFf//////////////0AAAAAAAf////////9AAAAAAAAAAAFVX/////////////0AAAAAAAAAAABX//////////////QAAAAAAV/////////0AAAAAAAAAAAAf//////////////QAAAAAAAAAAAAVVVVf/////////9AAAAAAB//////////QAAAAAAAAAAAB//////////////9AAAAAAAAAAAAAAAAB////1VVVVVUAAAAAAH/////////9AAAAAAAAAAAAH//////////////0AAAAAAAAAAAAAAAAH////QAAAAAAAAAAAAf/////////0AAAAAAAAAAAAf//////////////QAAAAAAAAAAAAAAAAf///9AAAAAAAAAAAAB//////////QAAAAAAAAAAAB//////////////9AAAAAAAAAAAAAAAAB////0AAAAAAAAAAAAH/////////9AAAAAAAAAAAAFf/////////////0AAAAAAAAAAAAAAAAH////QAAAAAAAAAAAAf/////////0AAAAAAAAAAAAB//////////////QAAAAAAAAAAAAAAAAf///9AAAAAAAAAAAAB//////////QAAAAAAAAAAAAH/////////////9AAAAAAAAAAAAAAAAB////0AAAAAAAAAAAAH/////////9AAAAAAAAAAAAAf/////////////0AAAAAAAAAAAAAAAAH////QAAAAAAAAAAAAf/////////0AAAAAAAAAAAAB//////////////QAAAAAAAAAAAAAAAAf///9AAAAAAAAAAAAB//////////QAAAAAAAAAAAAX/////////////9AAAAAAAAAAAAAAAAB////0AAAAAAAAAAAAH/////////1VVVVVQAAAAAAF//////////////0AAAAAAAAAAAAAAAAH////QAAAAAAAAAAAAf/////////QAAAAVVQAAAAAf//////////////VAAAAQAAAAAAAAAAAf///9AAAAAAAAAAAAB/////////9AAAABABAAAAAB///////////////UAAABQAAAAAAAAAAB////0AAAAAAAAAAAAH/////////0AAAAEAEAAAAAH//////////////9AAFAAUAAAAAAAAAAH////QAAAAAAAAAAAAf/////////QAAAAQAQAAABVf//////////////0AAUABQAAAAAAAAAAf///9AAAAAAAAAAAAB/////////9AAAABABAAAAF///////////////9QABAAAAAAAAAAAAAB////0AAAEAAAAAAAAH/////////0AAQFUAEAAAAFf//////////////0AAAAAAAAAAAAAAAAH////QAQAAAAAAAAAAf/////////QAAAfQAQAAAAB///////////////QAAAAAAAAAAAAAAAAf///9AAAAAAAAAAAAB/////////9AAAB9ABAAAAAH//////////////9AAAAAAAAAAAAAAAAB////0AAAAAAAAAAAAH/////////0AAAH0AQAAAAAf//////////////0AAAAAEAAAAAAAAAAH////QAAAAAAAAAAAAf/////////QAAAVVVAAAAAB///////////////UAAEAAUAAAAAAAAAAf///9AAAAAAAAAAAAB/////////9AAAAFAEAAABVX///////////////QAFQAAAAAAAAAAAAB////0AAAAAAAAAAAAH/////////0AAAAUAQAAAX////////////////9AAVAAAAAAAAAAAAAH////QAAAAAAAAAAAAX/////////QAAABQBAAAB/////////////////0ABUAAAAAAAAAAAABf///9AAAAAAAAAAAAAf////////9AAAAFAEAAAH////////////////1QABQAFAAAAAAAAAAH////0AAAAAAAAAABAB/////////0AAAAVAQAAAf////////////////QAAAAAUAAAAAAAAAAf////QAAAAAAAAAAAAH///////9VVUBVVUAAAAB////////////////9AAAAAAAAAAAAAAAAB////9AAAAAAAAAAAAAf///////0B/QH/9AAAAAH9Vf/////////////0AAAAAAAAAAAAAAAAH////0AAAAAAAAAAAAB///////1QH9V//0AAAAAVUB//////////////QAAAAAAAAAAAAAAAAf////QAAAAAAAAAAAAH///////QAf////QAAAAAAAH/////////////9UAAAAAAAAAAAAAAAB////9AAAAAABQAAAFVVVf////9AV////9AAAAAAAAf/////////////1AAFAAEAAAAAAAAAAH////0AAAAAAFAAAAfUAUB////0B/////0AAAAAAAB//////////////QAAUAAQAAAAAAAAAAf////QAAAAAAUAAAF9ABQH////QH/////QAAAAAAAH/////////////9AABQAAAAAAAAAAAAB////9AAAAAABVVVVVUAFAf///9Vf////9AAAAAAAAf/////////////0BVVQAAAAAAAAAAAAH////0AAAAAAH///9AQBf9///////1VV/0AAAAAAAB//////////////VX/9AUAAAAAAAAAAAf////QAAAABVX///0BVX///VX////QAFVQAAAAAAAH/////////////////0BQAAAAAAAAAAB////1AAAAAFAf///QH////9Af///9AAAAAAAAAAAAf////////////////9QAAAAAAAAAAAAVf///QAAAAAAB///9Vf////0B//VV0AAAAAAAAAAAB/////////////////0AAAAAAAAAAAAAB///9AAAAAAAH//////////QFV9AFQAAAAAAAAAAAH/////////////////QAAAAAAAAAAAAAH///0AAAAAAAf/////////9VQH0AAAAAAAAAAAAAAf////////////////9AAAAAAAAAAAAAAf///QAAAAAAB//////////1UAfQAAAAAAAAAAAAAB/////////////////0AAAAAAAAAAAAAB///9AAAAAAAH//////////QAB9AAAAAAAAAAAAAAH/////////////////QAAAAAAAAAAAAAH///0AAAAAAAf/////////9AAV0AAAAAAAAAAAAAAf////////////////9UAAAAAAAAAAAAAf///QAAAAAAB//////////0AAFVAAAAAAAAAAAAAB//////////////////QAAAAAAAAAAAAB///9AAAAAAAH//////////VUAEAAAAAAAAAAAAAAH/////////////////9AAAAAAAAAAAAAFX//0AAAAAAAf///////////QAQAAAAAAAAAAAAAAf/////////////////0AAAAAAAAAAAAAAVV/QAAAAAAB///////////9ABAAAAAAAAAAAAAAB//////////////////QAAAAAAAAAAAAAAAH9AAAAAAAH/////////9VUAAAAAAAAAAAAAAAAH/////////////////9AAAAAAAAAAAAAAAAf0AAAAAAAf/////////0BQAAAAAAAAAAAAAAAAf/////////////////0AAAAAAAAAAAAAAAB/QAAAAAAB//////////QFAAAAAAAAAAAAFAABV//////////////////QAAAAAAAAAAAAAAAH9AAAAAAAH/////////9AAAAAAAAAAAAAAAAAFX/////////////////9AAAAAAAAAAAAAAAAf0AAAAABVf/////////0AAAAAAAAAAAAAAAAAAf/////////////////0AAQAAAAAAAAAAAAB/QAAAAAF///////////QAAAAAAAAAAAAAAAAAB//////////////////QAAAAAAAAAAAAAAAH9AAAAAAH//////////9AAAAAAAAAAAAAAAAAAH/////////////////9AAAAAAAQAAAAAAAAf0AAAAAAf//////////0AAAAABAAAAAAAAAAAAf/////////////////0AAAAAABAAFAAAAAB/QAAAAAB///////////QAAAAAFAAAAAAAAAAAB//////////////////QAAAAAAUAAUAAAAAH9AAAAAAX//////////9AAAFAAQAAAAAAAAUAAH/////////////////9AAAAAABQABQAAAAAf0AAAAAB///////////0AAAEABAAAAAAAABAAAf/////////////////1VVVVVAFAAFAAAAAB/QAAAAAH///////////QAAAQAEAAAAAABVUABV///////////////////////0AUAAUAAAAAH9AAAAAAf//////////9AAEAAAQAAAAAAB/QAX////////////////////////QBQABQAAAAAf0AAAAAF///////////0AAUAABVQAAAAAH9AF////////////////////////9VVVVVVQAAAB/QAAAAAf///////////QBUAAAVVAAAAAAfVVf//////////////////////////////9AAAAH9AAAAAB///////////9AAAAAB0AAAAAAB9AB///////////////////////////////0AAAAf0AAAAAH///////////1AAAAAXQAAAAAAX0AF///////////////////////////////QAAAB/QAAAAVf///////////UAAAAFVAAAAAAFfQAF//////////////////////////////9AAAAH9AAAAB////////////9AAAAAAEAAAAAAB9AAH//////////////////////////////0AAAAf0AAAAH////////////0AAAAAAAAAAAAAH0AAf//////////////////////////////QAAAB/QAAAAf////////////QAAAAAAAAAAAEAfVAB//////////////////////////////9AAAAH9AAAABVX//////////9AAAAAAAAAAAAQB/1VVf/////////////////////////////0AAAAf0AAAAFAf//////////0AAAAAAAAAAAFVV//UB//////////////////////////////QAAAB/QAAAAUAP//////////QAAAAAAAAAAAUAH/9AH////////////////////////////99AAAAH9AAAABQAP/////////9QFVUAAAAAAABQAf/8Af///////////////////////////wH0AAAAf0AAAAFAA//////////1V//UAAAAAAAFAB//wF///////////////////////////8AfQAAAB/QAAAAUAD//////////QH//QAAAAAAAVVX//Vf///////////////////////////AB9AAAAH9AAAABQAX/////////9Af/9AAAAAAAB/////////////////////////////////AAH0AAAAf0AAAAFAB//////////0B//UAAAAAAAX////////////////////////////////0AAfQAAAB/QAAAAUAH//////////VX/9AAAAAAAB////////////////////////////////VQAB9AAAAH9AAAABVAf/////////////0AAAAAAAH///////////////////////////////0AAAH0AAABf0AAAAH0B//////////////QAAAAAAAf////////////////////1VVVVVVVVVVQAABfQAAAH/UAAAAfVX/////////////9AAAAAAAB/////////////////////QAAAAAAAAAQAAAH9AAAAf/QAAABf///////////////0AAAAAAAH////////////////////9AAAAAAAAABAAAA/0AAAB/9AAAAB////////////////VVVQAAAAf////////////////////0AAAAAAAAAEAAAP/QAAAH/0AAAAH//////////////////9QAAAB/////////////////////QAAAAAAAAAVQAAP9AAAAVVQAAAAVVVVVVVVVVV/9VVVf//1AAAAF////////////////////9AAAAAAAAAABVAA/0AAAAAAAAAAAAAAAAAAAAAFVUAABVVVQAAAAH////////////////////0AAAAAAAAAAAFUD/QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVVVV/////////////////QAAAAAAAAAAAAVX1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFVVX/////////////9AAAAAAAAAAAAABVQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/////////////0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//////////////QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/////////////9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/////////////0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//////////////QAVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/////////////9AF0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf/////////////0AfQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB//////////////QB9AAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/////////////9AH0AAAAAAUAAAAAAAAAAAAAAVUAAAAAAVQAAAAAAAAAAAAAAAAAAAAAAAAf/////////////1VfVUAAAAFUAAAAAAAAAAAAAB/UAAAAAB9UAAAAAAAAAAAAAAAAAAAAAAAB//////////////////QAAAAfQAAAAAAAAAAAAAH9AAAAFAH/QAAAAAAAAAAAAAAAAAAAAAAAH/////////////////9AAAAF9AAAAAAAAAAAAAAf0AAAAUAf9VVVVVQAAAAAAAAAAAAAAAAAAf/////////////////1VVVVf0AAAAAAAAAAAAAB/QAAABQB//////9QAAAAAAAAAAAAAAAAAB////////////////////////QAAAAUAAAAAAAAH9AAAAFAH//////9AAAAAAAAAAAAAAAAAAH///////////////////////9VVVVVVVVVVVVVVf1VVVVVVf//////0AAAAAAAAAAAAAAAAAAf/////////////////////////////////////////////////////VVVVVVVVVQAAAAAAAAB//////////////////////////////////////////////////////////////9VVVVVVVVVX//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////",
"MapSize":10900,
"can_edit_zone_info":true,
"can_select_zone_clean":true,
"laser_goto_path_y":[
],
"goto_point":[
],
"forbidden_zone_point_num":0,
"forbidden_zone_y":[
],
"room_zone_info":[
{
"room_id":0,
"clean_times":1,
"clean_order":4294967295,
"room_point_x":[
-560,
-550,
-490,
-470,
-360,
-350,
-350,
-340,
-340,
-320,
-270,
-260,
-260,
-270,
-270,
-380,
-380,
-390,
-500,
-510,
-570,
-580,
-740,
-740,
-750,
-840,
-850,
-850,
-840,
-840,
-830,
-610
],
"room_point_y":[
-1220,
-1210,
-1210,
-1190,
-1190,
-1180,
-810,
-800,
-760,
-730,
-730,
-720,
-430,
-420,
-380,
-380,
-590,
-600,
-600,
-610,
-610,
-630,
-630,
-850,
-860,
-860,
-910,
-1030,
-1040,
-1200,
-1210,
-1210
],
"room_name":"Kitchen"
},
{
"room_id":3,
"clean_times":1,
"clean_order":4294967295,
"room_point_x":[
710,
890,
890,
880,
880,
860,
830,
760,
750,
750,
690,
680,
680,
540,
540,
530,
460,
450,
450,
440,
350,
340,
340,
360,
360,
450,
460,
460,
510,
510,
650,
670
],
"room_point_y":[
-1280,
-1280,
-990,
-980,
-630,
-630,
-600,
-600,
-590,
-470,
-470,
-460,
-350,
-350,
-390,
-400,
-400,
-410,
-480,
-490,
-490,
-500,
-710,
-730,
-790,
-790,
-800,
-840,
-850,
-1260,
-1260,
-1290
],
"room_name":"Lounge"
},
{
"room_id":4,
"clean_times":1,
"clean_order":4294967295,
"room_point_x":[
20,
40,
190,
200,
200,
190,
190,
180,
80,
70,
70,
-269,
-260,
-210,
-200,
-200,
-190,
-190,
-180,
-20,
-10,
-10
],
"room_point_y":[
-1300,
-1270,
-1270,
-1260,
-1230,
-1220,
-940,
-930,
-930,
-920,
-375,
-374,
-400,
-400,
-410,
-710,
-720,
-1170,
-1180,
-1180,
-1190,
-1300
],
"room_name":"Bedroom"
},
{
"room_id":7,
"clean_times":1,
"clean_order":4294967295,
"room_point_x":[
-380,
-270,
-269,
60,
80,
90,
430,
440,
530,
540,
790,
800,
870,
880,
880,
870,
550,
540,
340,
330,
90,
60,
60,
-419,
-409,
-390
],
"room_point_y":[
-370,
-370,
-374,
-375,
-380,
-360,
-360,
-350,
-350,
-340,
-340,
-330,
-330,
-320,
-180,
-170,
-170,
-180,
-180,
-190,
-190,
-180,
-190,
-190,
-400,
-400
],
"room_name":"Hallway"
},
{
"room_id":8,
"clean_times":1,
"clean_order":4294967295,
"room_point_x":[
-419,
-540,
-560,
-720,
-740,
-840,
-850,
-850,
-840,
-409
],
"room_point_y":[
-190,
-190,
-210,
-210,
-240,
-240,
-250,
-390,
-400,
-400
],
"room_name":"Bathroom"
}
],
"laser_wall_line_x":[
],
"laser_wall_line_y":[
],
"laser_wall_line_point_num":0,
"forbidden_zone_x":[
],
"laser_goto_path_x":[
],
"selected_zone":[
],
"map_type":"yw_ls",
"vendor_firmware_version":"4.00.26",
"map_name":"House",
"update_timestamp":"1672739662",
"create_timestamp":"1672613898",
"forbidden_zone_info":[
],
"forbidden_mop_zone_x":[
],
"forbidden_mop_zone_y":[
],
"room_info":{
"0":{
"room_name":"Kitchen"
},
"3":{
"room_name":"Lounge"
},
"4":{
"room_name":"Bedroom"
},
"7":{
"room_name":"Hallway"
},
"8":{
"room_name":"Bathroom"
}
}
}
And here’s the resulting image: