Problem with miio Binding for Vacuum 1C STYTJ01ZHM (dreame.vacuum.mc1808)

Command

action[ {“did”: “startvac”, “siid”: 2, “aiid”: 1, “in”: }]

led to the same “No response from device”, and

action[ “did”: “startvac”, “siid”: 2, “aiid”: 1, “in”: ]

resulted in error:

12:14:43.902 [WARN ] [rnal.transport.MiIoAsyncCommunication] - Send command ‘action’ with parameters [ “did”: “startvac”, “siid”: 2, “aiid”: 1, “in”: ] → 192.168.1.107 (Device: 13D7B293) gave error com.google.gson.stream.MalformedJsonException: Unterminated array at line 1 column 9 path $[1].

I tried sending other commands (dock, stop, start-sweep, start-clean) but to the same result - “No response from device”.

Other queries are working:

get_properties [{“did”:“battery-level”,“siid”:2,“piid”:1,“in”:}]

12:46:46.014 [DEBUG] [rnal.transport.MiIoAsyncCommunication] - Command added to Queue {“id”:9578,“method”:“get_properties”,“params”:[{“did”:“battery-level”,“siid”:2,“piid”:1,“in”:}]} → 192.168.1.107 (Device: 13D7B293 token: 31533761XXXXXXXXXXXXXXXX3265474E Queue: 1)

12:46:46.092 [DEBUG] [.internal.handler.MiIoAbstractHandler] - Received response for 13D7B293 type: GET_PROPERTIES, result: [{“siid”:2,“did”:“battery-level”,“piid”:1,“value”:85,“code”:0}], fullresponse: {“result”:[{“siid”:2,“did”:“battery-level”,“piid”:1,“value”:85,“code”:0}],“id”:9578}

I was able to control Vacuum with dreame_miot_mc1808 branch of python-miio, all basic commands works.


My knowledge of software development does not allow me to transcribe this to openhab, unfortunately.

@ilya_lemeshev Can you see in the python-miio what is the command send to the device (using debug mode) to start vacuuming. Than we can send the same.
What python-miio is sending, miio binding should be able to send as well.

Debug line from python-miio

miiocli -d dreamevacuum --ip 192.168.1.211 --token xxxxxxxxxxxxxxxxxxxxxxxx start_sweep
INFO:miio.cli:Debug mode active
Running command start_sweep
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b’’
DEBUG:miio.miioprotocol:Got a response: Container:
data = Container:
data = b’’ (total 0)
value = b’’ (total 0)
offset1 = 32
offset2 = 32
length = 0
header = Container:
data = b’!1\x00 \x00\x00\x00\x00\x13\xd7\xb2\x93_\x98\x11\x85’ (total 16)
value = Container:
length = 32
unknown = 0
device_id = unhexlify(‘13d7b293’)
ts = 2020-10-27 12:24:37
offset1 = 0
offset2 = 16
length = 16
checksum = b’\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff’ (total 16)
DEBUG:miio.miioprotocol:Discovered 13d7b293 with ts: 2020-10-27 12:24:37, token: b’ffffffffffffffffffffffffffffffff’
DEBUG:miio.miioprotocol:192.168.1.211:54321 >>: {‘id’: 1, ‘method’: ‘action’, ‘params’: {‘did’: ‘call-3-1’, ‘siid’: 3, ‘aiid’: 1, ‘in’: }}
DEBUG:miio.miioprotocol:192.168.1.211:54321 (ts: 2020-10-27 12:24:37, id: 1) << {‘result’: {‘did’: ‘call-3-1’, ‘siid’: 3, ‘aiid’: 1, ‘code’: 0, ‘out’: }, ‘id’: 1}
{‘did’: ‘call-3-1’, ‘siid’: 3, ‘aiid’: 1, ‘code’: 0, ‘out’: }

I tried to use command in openhab, but to no avail

action [{“did”:“call-3-1”,“siid”:3,“aiid”:1,“code”:0,“out”:}]

15:35:35.158 [DEBUG] [rnal.transport.MiIoAsyncCommunication] - Command added to Queue {“id”:2577,“method”:“action”,“params”:[{“did”:“call-3-1”,“siid”:3,“aiid”:1,“code”:0,“out”:}]} → 192.168.1.211 (Device: 13D7B293 token: 31533761XXXXXXXXXXXXXXXX3265474E Queue: 1)
15:35:50.203 [DEBUG] [rnal.transport.MiIoAsyncCommunication] - Communication error for Mi device at 192.168.1.211: Receive timed out
15:35:50.204 [DEBUG] [rnal.transport.MiIoAsyncCommunication] - No response from device 13D7B293 at 192.168.1.211 for command {“id”:2577,“method”:“action”,“params”:[{“did”:“call-3-1”,“siid”:3,“aiid”:1,“code”:0,“out”:}]}.
15:35:50.205 [DEBUG] [.internal.handler.MiIoAbstractHandler] - Received response for 13D7B293 type: ACTION, result: {}, fullresponse: {“error”:“No Response”}
15:35:50.206 [DEBUG] [.internal.handler.MiIoAbstractHandler] - Error received: “No Response”

Thanks… Maybe the difference is that OH is sending a array, and miio-python a json object.
let me prepare a version that is able to send an object (I’m not sure the current version of the binding can do that)).

seems to be possible to send such a command afterall with the current binding

Can you try to send (so like the earlier one, but without the brackets)
action {"did": "startvac", "siid": 2, "aiid": 1, "in": [] }

When trying to send this command i recieve an error:

19:01:47.987 [WARN ] [rnal.transport.MiIoAsyncCommunication] - Send command ‘action {“did”: “startvac”, “siid”: 2, “aiid”: 1, “in”:’ with parameters } → 192.168.1.211 (Device: 13D7B293) gave error com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 5 path $

I found the issue why the error occurs.
I’ve fixed and can send the command here. Will share a version with that fix in the next days.

1 Like

Thank you!

The fix is in the regular snapshot build. Could you try to send command again

action {"did":"Start-sweep","siid":3,"aiid":1,"in":[]} this no longer should result in a json error.

If that works we can work on fixing the json file to send the right command

Using OH 3.0 and snapshot build of addon command works, as well as other basic commands (stop-sweeping and return_home)

1 Like

Thanks for the work you’ve done.
Will there be a plugin for the second version of OH?

@mr.miasnikov what do you mean? This is available in both 3.0 as well as in the 2.5.11-snapshot indeed.
So far I’ve backported all changes to 2.5 as well.

I recently started using OH so I apologize for the stupid questions. oh3 snapshot I saw but can’t find 2.5.11-snapshot. Could you give a link to it?