Xiaomi Robot Vacuum Binding

Hi Ben,
what do you do for forcing the robot quickly to response? I’ve placed my robot in a vlan, too. No internet access is available from this vlan. But it is not possible to connect from OH to this robot, it does not response. (But it is pingable from OH network to the vlan robot network). If I allow internet access for only 3 seconds, the robot can response to OH; :frowning:

The robot wants connection to the cloud. You can use the alternative, dustcloud, to fake cloud access if you don’t want the robot to have internet access.

Also it wants to be on the same subnet as oh I think

I had my vacuum configured using a thing file, but with the latest milestone update it doesn’t seem to want to work. If I delete the thing file the vacuum can be auto-detected and configured, and then works OK.

Has something changed with the thing file requirements?

Yes, something has changed…
The deviceId became a mandatory field. This as some undesired behaviour is happening if this is not available.

I built a very basic MQTT-Robot bridge using https://github.com/rytilahti/python-miio. This little bridge runs on the same VLAN/subnet as the robot and has no internet access. It sits there spinning around querying the vacuum every 10s and publishing the state to a series of MQTT topics that OH is subscribed to (on a different VLAN/subnet, but with firewall rules allowing 1833 traffic, i.e. MQTT, thru).

For commands it is the reverse. OH publishes to an MQTT topic and the bridge subscribes, forwarding the command to the robot using the miio library.

I find the robot is very responsive using this system. Perhaps once out of 25 times it will be unresponsive, but I can’t remember the last time that happened.

I haven’t updated the firmware since I got it a few years ago, as it seems to work pretty reliably and I don’t want to mess with things!

i have my vaccum under a low furniture so i want to give a command to my roborock to back up from the charging base 30 cm so i can check or empty the dust bin.What command can i use?

there you go:

rule "Staubbehälter leeren"
    when 
        Item   Staubbehaelter_leeren received command ON
    then
        actionCommand.sendCommand("app_goto_target[25500,26000]")
        Staubbehaelter_leeren.sendCommand(OFF)
end

Thx for this. But this is yet another server/module/service in my network. I keep searching a smaller solution.

Hm. I also want to have a low-maintenance solution. I think that in the separate VLAN/IOT network, I am going to open exactly the one UDP port that the robot needs. After that, the vac releases the ability to communicate with OH. I hope.

See below issue… Depending on the type of device, the setup via vlan may or may not work… will be trial & error per device.

@marcel_verpaalen, I recently got a Xiaomi Mi WiFi Smart Power Socket, extracted the token & successfully added it to my openhab via the binding. Everything works great except the device if manually turned on but its switch does not update OpenHab with its status. Any hints on how to get that working as we do need to turn it on via the device itself.

to confirm the update did resolve my issue of my lights resetting randomly! Thanks!

To trouble shoot that, can you send a debug log of the before & after responses from the device.
That may clarify why you are not seeing the update.

thanks. Could you please give an example of how it’s used in the thing file please?

Hi Marcel

I see the following as soon as I turned on debugging for miio. I tried overriding it to chuangmi.plug.m1 but it still did not work. Looks like this is a chuangmi.plug.m3 which is unsupported.

2019-02-02 19:26:49.714 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {“id”:11,“method”:“miIO.info”,“params”:} → 192.168.10.230 (Device: 07138991 token: 6CB9D0B08620B03F2D70BA2B9CD7637E Queue: 1)
2019-02-02 19:26:49.714 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 07138991 (192.168.10.230)
2019-02-02 19:26:49.802 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 07138991 (192.168.10.230) success
2019-02-02 19:26:49.872 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 07138991 type: MIIO_INFO, result: {“life”:85,“token”:“6cb9d0b08620b03f2d70ba2b9cd7637e”,“mac”:“40:31:3C:C5:74:45”,“fw_ver”:“1.3.0_0004”,“hw_ver”:“ESP8266”,“uid”:“1638337815”,“model”:“chuangmi.plug.m3”,“wifi_fw_ver”:“1.5.0-dev(7f7a714)”,“ap”:{“rssi”:-64,“ssid”:“Menzel”,“bssid”:“F2:9F:C2:F7:A9:DA”},“netif”:{“localIp”:“192.168.10.230”,“mask”:“255.255.255.0”,“gw”:“192.168.10.1”},“mmfree”:9912}, fullresponse: {“result”:{“life”:85,“token”:“6cb9d0b08620b03f2d70ba2b9cd7637e”,“mac”:“40:31:3C:C5:74:45”,“fw_ver”:“1.3.0_0004”,“hw_ver”:“ESP8266”,“uid”:“1638337815”,“model”:“chuangmi.plug.m3”,“wifi_fw_ver”:“1.5.0-dev(7f7a714)”,“ap”:{“rssi”:-64,“ssid”:“Menzel”,“bssid”:“F2:9F:C2:F7:A9:DA”},“netif”:{“localIp”:“192.168.10.230”,“mask”:“255.255.255.0”,“gw”:“192.168.10.1”},“mmfree”:9912},“id”:11}
2019-02-02 19:26:49.873 [INFO ] [ing.miio.handler.MiIoAbstractHandler] - Mi Device model chuangmi.plug.m3 has model config: chuangmi.plug.m1. Unexpected unless manual override
2019-02-02 19:26:49.873 [INFO ] [ing.miio.handler.MiIoAbstractHandler] - Mi Device model chuangmi.plug.m3 identified as: Unknown Mi IO Device (unknown). Matches thingtype miio:unsupported
2019-02-02 19:26:59.807 [DEBUG] [.miio.handler.MiIoUnsupportedHandler] - Periodic update for ‘miio:generic:07138991’ (miio:unsupported)
2019-02-02 19:27:09.811 [DEBUG] [.miio.handler.MiIoUnsupportedHandler] - Periodic update for ‘miio:generic:07138991’ (miio:unsupported)

Example thing file
Thing miio:basic:MyLight "My Light" [ host="192.168.x.x", token="put here your token", deviceId="your deviceId here" ]

To get the deviceId, let the regular discovery discover the device first, or get them from the token database

Pls update to the latest snapshot, it should see that model as supported device.

Is this the right place to download the latest snapshot?

https://ci.openhab.org/job/openHAB2-Bundles/lastBuild/org.openhab.binding$org.openhab.binding.miio/

Looks like that is an older one. the jenkins builds have been disabled believe for the last few days.

You can download it here https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.miio/2.5.0-SNAPSHOT/org.openhab.binding.miio-2.5.0-SNAPSHOT.jar

[edit: corrected link]

Maybe you meant this one? Not the max?

https://openhab.jfrog.io/openhab/libs-pullrequest-local/org/openhab/binding/org.openhab.binding.miio/2.5.0-SNAPSHOT/org.openhab.binding.miio-2.5.0-SNAPSHOT.jar

1 Like