Adding support for roborock Q7 Max

Hi all, especially @marcel_verpaalen :slight_smile:

So I’ve got a Roborock Q7 Max and would of course like to use the miio binding to control it.
Sadly, it’s not directly supported but at least basic information is available as miot device :+1:

Appearently, the device is sending a shorter status message than usual. Here’s a snippet from the log:

20:14:27.453 [DEBUG] [.internal.handler.MiIoAbstractHandler] - Received response for device 06b17095a9 type: MIIO_INFO, result: {"life":15010,"uid":1673648190,"model":"roborock.vacuum.a38","token":"6e6a416c75485870663432785337315a","ipflag":1,"miio_ver":"0.0.9","mac":"B0:4A:39:49:35:F2","fw_ver":"4.1.5_0688","hw_ver":"Linux","miio_client_ver":"4.1.5","VmPeak":9916,"VmRSS":1616,"MemFree":14924,"ap":{"ssid":"HLW31","bssid":"e0:28:6d:69:3d:02","rssi":"0","freq":0},"netif":{"localIp":"10.0.0.132","mask":"255.255.255.0","gw":"10.0.0.1"},"miio_times":[15010,14,0,14995]}, fullresponse: {"id":3627,"result":{"life":15010,"uid":1673648190,"model":"roborock.vacuum.a38","token":"**REDACTED**","ipflag":1,"miio_ver":"0.0.9","mac":"**REDACTED*","fw_ver":"4.1.5_0688","hw_ver":"Linux","miio_client_ver":"4.1.5","VmPeak":9916,"VmRSS":1616,"MemFree":14924,"ap":{"ssid":"MYWIFI","bssid":"**REDACTED**","rssi":"0","freq":0},"netif":{"localIp":"**REDACTED**","mask":"255.255.255.0","gw":"**REDACTED**"},"miio_times":[15010,14,0,14995]},"exe_time":1}
20:14:27.455 [DEBUG] [.internal.handler.MiIoAbstractHandler] - No RSSI info in response

The channel for the generation of the json config file worked and I’ve got all miot-channels available (https://home.miot-spec.com/spec/roborock.vacuum.a38).

However, I’ve noticed the json is not fully valid:

$ jq roborock.vacuum.a38-miot-experimental.json 
jq: error: roborock/0 is not defined at <top-level>, line 1:
roborock.vacuum.a38-miot-experimental.json
jq: error: miot/0 is not defined at <top-level>, line 1:
roborock.vacuum.a38-miot-experimental.json                    
jq: error: experimental/0 is not defined at <top-level>, line 1:
roborock.vacuum.a38-miot-experimental.json                         
jq: 3 compile errors

Simulating a S6, the binding struggles and fails:

20:12:50.389 [DEBUG] [io.internal.handler.MiIoVacuumHandler] - Periodic update for 'miio:vacuum:f38d290654' (miio:vacuum)
20:12:50.392 [DEBUG] [rnal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":30,"method":"get_dnd_timer","params":[]} -> 10.0.0.132 (Device: rockrobo.vacuum.s6 token: 6E6A416CXXXXXXXXXXXXXXXX5337315A Queue: 1).
20:12:50.395 [DEBUG] [rnal.transport.MiIoAsyncCommunication] - Sending Ping to device 'rockrobo.vacuum.s6' (**REDACTED**)
20:12:50.411 [WARN ] [rnal.transport.MiIoAsyncCommunication] - Error while polling/sending message for rockrobo.vacuum.s6
java.nio.BufferOverflowException: null
	at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:221) ~[?:?]
	at java.nio.ByteBuffer.put(ByteBuffer.java:914) ~[?:?]
	at org.openhab.binding.miio.internal.Message.createMsgData(Message.java:70) ~[bundleFile:?]
	at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication.sendCommand(MiIoAsyncCommunication.java:308) ~[bundleFile:?]
	at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication.sendMiIoSendCommand(MiIoAsyncCommunication.java:176) ~[bundleFile:?]
	at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication$MessageSenderThread.run(MiIoAsyncCommunication.java:278) [bundleFile:?]

I’d really like to use room feature and (would be really nice!) pin-and-go which seems only be available to miio:vacuum things.

My json file is attached. What else can I do to “improve” this (great) binding?
roborock.vacuum.a38-miot-experimental.json (7.7 KB)

Best,
Sascha

Hi.
I downloaded the attached json-file. It’s missing a termination of the json structure.
Is this complete as from the binding?
Fix with
echo '}' >> roborock.vacuum.a38-miot-experimental.json
To dump the json using jq:

jq -C < roborock.vacuum.a38-miot-experimental.json

{
  "deviceMapping": {
    "id": [
      "roborock.vacuum.a38"
    ],
    "propertyMethod": "get_properties",
    "maxProperties": 1,
    "channels": [
      {
        "property": "",
...

I do not yet have the roborock, but I'm planning to buy one. So I'm not of much help but was curious to see the json.