Xiaomi Robot Vacuum Binding

Ok well it is this vacuum:

Xiaomi Robot Vacuum-Mop 2S (ijai.vacuum.v19)
and I use this channel:
String - Robot Cleaner - Actions:

Value mapping ["vacuum-start-sweep"="Start","vacuum-start-sweep-mop"="Start Sweep+Mop","vacuum-start-only-sweep"="Start Sweep","vacuum-start-only-mop"="Start Mop","vacuum-dock"="Dock","vacuum-stop-sweeping"="Pause","vacuum-start-room-sweep"="Start Room Sweep"]

I thought I have to add a parameter to vacuum-start-room-sweep?

for my Roborock S5 Max this works:

S5_Actions.sendCommand("app_segment_clean [16]")

That is a miot type I think. Those devices need all their commans with the right siid and aiid codes(, service id action Id) Your command is something like

Robot_Actions.sendCommand(action[ “siid”: 3,“aiid”: 1]

For the room cleaning it most likely require one more parameter like the room number

Thanks for your fast reply, may I ask for further help?

if I type in your code I get the following error in the logs:

.rules' has errors, therefore ignoring it: [17,47]: mismatched input ':' expecting ']'

then I tried putting the whole thing in ’ ’

Robot_Actions.sendCommand('action[ "siid": 7,"aiid": 3,"params": 10]')

But nothing happened…

Does the item I send the command to has to be linked to the actions-channel or the advanced action-channel?

yes, was typing the command on my phone… you need to get indeed the outer quotes right.

Here you get a hint of parameters to send Unsupported model ijai.vacuum.v19 · Issue #1394 · rytilahti/python-miio · GitHub
If you found the right way, do share it here on the forum for others with a little explaination.

You need to send it to the commands channel… so whatever item channel you like to the channel see screenshot for some pointer

Ok I found my first mistake I used the Action-Channel not the Command Channel… thanks for helping me there!

Know Commands like the following are working.

Robot_Command.sendCommand('action{"did":"vacuum-start-sweep","siid":2,"aiid":1,"in":[]}')

I used the siid and the aiid from this site: Xiaomi Robot Vacuum-Mop 2S

But I don’t get anything working like:

Robot_Command.sendCommand('action{"did":"vacuum-start-room-sweep","siid":2,"aiid":7,"in":[10.10]}')

As soon as I use a input parameter the code does not work and I do not get a result in the command channel.

For the map Id I received a result:

Robot_Command.sendCommand('action{"did":"vacuum-get-map-list","siid":10,"aiid":1,"in":[]}')

result was:

{"code":0,"exe_time":21,"id":8270,"message":"ok","net_cost":158,"ot_cost":0,"otlocalts":1672436897658788,"result":{"code":0,"out":[{"piid":4,"value":"[{\"name\":\"WZ\",\"id\":1672242617,\"cur\":true}]"}]}}

But I’m not able to receive the room id:

Robot_Command.sendCommand('action{"did":"vacuum-get-map-room-list","siid":10,"aiid":13,"in":[2. 1672242617]}')

Can you give me another hint how to use the parameter correct?

Btw. also tried:

Robot_Command.sendCommand('action{"siid":7,"aiid":3,"in":[24.10,25.0,26.1]}')

But only this result:

{"code":0,"exe_time":30,"id":8941,"message":"ok","net_cost":39,"ot_cost":0,"otlocalts":1672441179818472,"result":{"code":0}}

And the logs say:

2022-12-30 23:59:39.844 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Could not identify channel for action. Device miio:generic:3D977F0A has 53 commands in queue.

And I don’t know worth mentioning the robot makes a noise like “bling” whenever I send the last command (for param 24 I tried 10-21).

Happy new Year!

SIID/AIID

Following this site I would say that the correct command to clean a room is:

'action{"did":"set-room-clean","siid":7,"aiid":3,"in":[24,25,26],"out":[]}'

siid 7=sweep
aiid 3=set-room-clean
input-parameter is:
24=clean-room-ids (string)
25=clean-room-mode (unit8); 0 - Global, 1 - Edge
26=clean-room-oper (unit8); 0 - Stop, 1 - Start, 2 - Pause, 3 - Fake Pause

'action{"did":"set-room-clean","siid":7,"aiid":3,"in":[24.10,25.0,26.1],"out":[]}'

But it does not work for me…

Also this one does not work:

'action{"did":"start-room-sweep","siid":2,"aiid":7,"in":[10]}'

siid 2=Robot Cleaner
aiid 7=start-room-sweep
input-parameter is: 10 - room-ids (string)

I guess I don’t get the last bracket right but I don’t know where my mistake is…

1 Like

try 'action["did":"set-room-clean","siid":7,"aiid":3,"in":[24.10,25.0,26.1],"out":[] ]'

the binding takes the first as what it sends as method and than looks for all between the square brackets. I 'm not 100% sure what it does with the curled brackets { .
If you look into the debug log you see what it is actually sending to the robot.
Also will suggest to try to switch off the cloud connectivity (unless your setup actually requires it)

‘action[“did”:“set-room-clean”,“siid”:7,“aiid”:3,“in”:[24.10,25.0,26.1],“out”:[]]’
Well without the curled brackets it gives me the following errors:

2023-01-03 20:54:23.148 [WARN ] [nal.transport.MiIoAsyncCommunication] - Send command 'action' with parameters ["did":"set-room-clean","siid":7,"aiid":3,"in":[24.10,25.0,26.1],"out":[]] -> 192.168.1.40 (Device: 1033338634) gave error com.google.gson.stream.MalformedJsonException: Unterminated array at line 1 column 8 path $[1]

‘action{“did”:“set-room-clean”,“siid”:7,“aiid”:3,“in”:[24.10,25.0,26.1]}’
When send with the curled brackets I receive the following:

2023-01-03 20:56:53.407 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":3443,"method":"action","params":{"did":"set-room-clean","siid":7,"aiid":3,"in":[24.10,25.0,26.1]}} -> 192.168.1.40 (Device: 1033338634 token: 32684967XXXXXXXXXXXXXXXX496E3067 Queue: 1).
2023-01-03 20:56:53.486 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for device 3D977F0A type: ACTION, result: {"code":0}, fullresponse: {"id":3443,"result":{"code":0},"exe_time":20}
2023-01-03 20:56:53.488 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Could not identify channel for action. Device miio:generic:3D977F0A has 7 commands in queue.

Can you help me if I provide further information from the logs?

And I did as you told me:

I only activated cloud at my other three robots (2x Roborock S5Max and 1x Xiaomi V1) because of the map-image. But as far as I can see there is no map available with this model?

okay, that (2nd one) worked indeed proper (in the sense that command was transformed well and the robot received it and did not return an error)
So you prob need to fiddle with the parameters in the "in": [] array until you get the right ones.
you could try with miio-python to see if you can get it to work with that and than it will be easy to ‘translate’ the command to openhab.

You don’t need the cloud, this is only for specific situations where your device is not accepting local commands or is outside of your regular network/subnet. For map receiving you don’t need to enable it (the map is anyway pulled from the cloud regardless of this setting).

but you are right for this model OH does not support map. maps are only available for rockrobo devices.

Thanks for the hint I deactivated cloud on my other robots as well.

Can you give me a bit more information on miio-python maybe a website where I find docs how to use it?

Yeah really a pity they didn’t stick to the roborock programming as they did with their first model…

I’m not sure if this is the right place to ask this, but has there been any progress in making the binding compatible with the roborock app as well??

No, there is no intention to do so. Little advantage, big effort.
It uses a different communication method.

1 Like

Hi there.

Im a new owner of Xiaomi Mi Vacuum Mop 2 Pro+ (ijai.vacuum.v3) and i want to control it by openHAB.

Surprisingly , lot of functions are working, e.g., start, stop sweep / mop, go to charge, mode change, suction level…but there is a one thing what i needed, and cant get it work. I want a possibility to choice,the exact room, with a want to clean.

So at first, i need to find out the room IDs
I tried execute command get_map, but it gives me back this:

{"code":0,"exe_time":31,"id":338,"message":"ok","net_cost":49,"ot_cost":0,"otlocalts":1672998139975932,"result":{"code":0,"out":[{"piid":4,"value":"[{\"name\":\"Map1\",\"id\":609,\"cur\":true}]"}]}}

I tried more commands: get_map_v1, get_map_v2, get_room_mapping, but without success, it not return anything

Can you give me a hint??
ijai.vacuum.v3-miot-experimental.json (50.5 KB)

Hi,
It is unclear how the rooms are coded.
get_map is to get the latest mapid from the cloud in order to download the (encoded) map.

Your best chance is to try the various numbers and see which room it goes. The room numbers start typically with 10 as first room

I‘m curious, did you manage to get a command with an parameter (in) working? I‘m still struggling.
Are the siid and aiid of the mop 2 pro identical to the mop 2s?

Maybe this helps you, here is the list of aiid/siid for your robot:

Hi Marcel, Andreas, thanks for reply.

Andreas, I’ve read your posts from few days ago. We are trying to find out the same thing!
So i tried the commands as you descripted, and the outputs was the same… same behavior, same errors, same “bling”.
I think, the ssids and piids are identical. I am based on this page https://home.miot-spec.com/spec/ijai.vacuum.v3
So, my best result is, as yours:

xiaomi_robot_execute.sendCommand('action{"did":"set-room-clean","siid":7,"aiid":3,"in":[24.10,25.0,26.1]}')

It gaves me a one “bling” and:

{"id":1158,"result":{"code":0},"exe_time":51}

Im dont know the rooms IDs, also as you, so the “10” from [24.10,25.0,26.1] is only my estimate.
At the moment, i think, we need to try the python-miio to find the correct parameters to fill the part: “in”: [].

I did quick check for you in the mihome app code for the v19
which makes me think you need in the in array something like:
[ “10,11,12”, 1,1]

or in words: a string with the roomIds (separated with comma) the model which seems to be the sweeptype dunno exactly what that expects and the per which is I guess starting/stopping/pausing.

here some of the relevant parts of the source:

  function controlClean(status) {
    var rooIds = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
    var per = status == _SCPublic.SCControlParam.start ? _SCPublic.SCSetRoomCleanParam.start : _SCPublic.SCSetRoomCleanParam.pause;
    var model = _SCDevice.SCDevice.stateModel.S2P8_sweepType == _SCPublic.SCCleanModel.border ? _SCPublic.SCSetRoomModeParam.border : _SCPublic.SCSetRoomModeParam.auto;
    _WLLog.default.log('controlClean_s2p8:', _SCDevice.SCDevice.stateModel.S2P8_sweepType);
    return setRoomClean(rooIds, per, model);
  }


  function setRoomClean(ids, per, model) {
    var values = [ids.join(","), model, per];
    
var params = _encapDo(_SCNetEnum.default.NetServer.S7sweep, _SCNetEnum.default.S7SweepAction.S7A3_setRoomClean, values);
    
var matches = /function\s*(\w*)/i.exec(arguments.callee.toString());
    _WLLog.default.log(_WLDateUtils.default.nowText() + " \u9009\u623F\u95F4\u6E05\u626B:", matches[1], params);


 var SCSetRoomCleanParam = {
    stop: 0,
    start: 1,
    pause: 2,
    puaseFalse: 3
  };
  exports.SCSetRoomCleanParam = SCSetRoomCleanParam;
  var SCSetRoomModeParam = {
    auto: 0,
    border: 1
  };
  exports.SCSetRoomModeParam = SCSetRoomModeParam;
  var SCBuildParam = {
    noBuild: 0,
    onlyBuild: 1,
    buildSweep: 2
  };

Thanks for checking the code, but unfortunately I still did not manage to get it work.

'action{“siid”:7,“aiid”:3,“in”:[ “10,11,12,13”, 1,1]}‘

I’ll try out more variants next week.

Andreas, Marcel, the command doesn’t work for me either.

But, yesterday a spend lot of hours to search some more informations.
I found this thread:
https://community.openhab.org/t/miio-binding-execute-rpc-command-for-dreame-d9/132906

The syntax of the command is little different as we excepted. Regarding to ChrisM and anDuR posts, the syntax is:

xiaomi_robot_execute.sendCommand('action{"did":"set-room-clean","siid":7,"aiid":3,"in":[{"piid":24,"value":10},{"piid":25,"value":0},{"piid":26,"value":1}]}')

And it works!!! The vacuum start to clean.

But for me, i still don’t know the room IDs. I tried 10, 15, 20, 25, 30, but the vacuum still start to clean all rooms.

But, there is a another solution to get a right command direct from the Mi home app.
In the mentioned thread, there is a android version of Mi home by vevs, which make it possible to log and save the messages to file, so you can get the exact command, what you need.

I need some time to try it out, but christmas holidays ends, and there will be less time :confused:

1 Like

My first room starts at 16. So 16, 17 etc. I’ve also read about certain vaccums using A B C to identify rooms, maybe try that too?

Correct, that was how I figured out the commands for my roborock s6 max v.