Xiaomi Robot Vacuum Binding

Does anybody know the command you send to the robot vacuume to manually move it. I want it to move backwards about 1m and sit there, so i can empty the bin. The dock is under a bookcase out of the way. So id like to make a button to empty the dust bin in openhab

@Christopher_Hemmings

You find the commands here: https://github.com/marcelrv/XiaomiRobotVacuumProtocol (remote start, end & move) note there is specific seqnum for these move commands to take care of in your rule

Im trying to use the go to target command, as it would work best. But i cannot get it to work. OH sends the command, but the vacuum does nothing, Im probably doing something wrong.

actionCommand.sendCommand("app_goto_target[[26500,25500]]")

Edit, Nevermind, got it to work with

actionCommand.sendCommand("app_goto_target[26500,25500]")


hello everyone,

since 2 days ago i couldn’t change the color on my yeelight.
but the command ON/OFF and temperature works fine.

does anybody have similar problem?
It’s seem to me that the problem is related to the new bundle version

what i try so far:

  • delete the things, re scan and add new things
  • uninstall/reinstall Xiaomi Mi IO bindings from paper UI

Device model : yeelink.light.color2
firmware version: 1.4.2_0026
Xiaomi Mi IO: 2.4.0.201811062006

@m0oba there was a recent change that may have caused this, which was suppose to improve the support for some of the yeelight models.

Can you PM a debug log of the sending of the color change command and the responses of the yeelight.

Hi Marcel, sorry I guess I am bit slow :zipper_mouth_face:
I have problem with both :frowning:

Log in openhabian cmd say: log: command not found …

And no luck send command also over command channel
I tried basic power on/off like:

PhilipsZhiRuiBedsideLamp_Actions_ExecuteCommand.sendCommand(pow,[‘on’])
PhilipsZhiRuiBedsideLamp_Actions_ExecuteCommand.sendCommand([‘pow’],[‘on’])
PhilipsZhiRuiBedsideLamp_Actions_ExecuteCommand.sendCommand([pow],[on])

alway get script error …

Bit confused how to send properties and how to use methods.

get_prop is some standard command to get val of properties?

Thank you

I see your " ’ " har not correct, try the standard ’

Anybody about to help with this.
I recently had my roborock go offline, i had to remove the item and the binding and redo it all.

2018-11-12 18:08:58.286 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:09:38.325 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:10:28.373 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:11:18.427 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:11:18.430 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:12:28.506 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:12:58.537 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:13:28.557 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:13:58.593 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:14:28.624 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:14:28.627 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

2018-11-12 18:15:38.707 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler MiIoVacuumHandler tried updating the thing status although the handler was already disposed.

Seems as though that has stopped after a restart, But there is something else weird going on.

The last log

2018-11-12 18:22:38.570 [hingStatusInfoChangedEvent] - 'miio:vacuum:05C20305' changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): No Response from device

says that the unit is offline, But i still have control over it, the pause vacuum and dock buttons all work. But im not getting charge percentage or anything like that.

How can i remove and redo this binding properly, without it causing issues.

@marcel_verpaalen

Hi,

great binding, it is working fine for me, thanks :slight_smile:
But I see some exceptions in the log file when loading the binding.

The first one 5 times:

[DEBUG] [iio.internal.discovery.MiIoDiscovery] - Error submitting discovered Mi Io device at 192.168.178.58

java.lang.NullPointerException: null

	at org.openhab.binding.miio.internal.discovery.MiIoDiscovery.discovered(MiIoDiscovery.java:129) ~[?:?]

	at org.openhab.binding.miio.internal.discovery.MiIoDiscovery.access$1(MiIoDiscovery.java:119) ~[?:?]

	at org.openhab.binding.miio.internal.discovery.MiIoDiscovery$ReceiverThread.lambda$0(MiIoDiscovery.java:286) ~[?:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

and the second one 6 times:

2018-11-13 23:04:06.579 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception

java.lang.NullPointerException: null

	at org.openhab.binding.miio.internal.Utils.hexStringToByteArray(Utils.java:40) ~[?:?]

	at org.openhab.binding.miio.handler.MiIoBasicHandler.initializeData(MiIoBasicHandler.java:224) ~[?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

System and Binding
Raspbian GNU/Linux 9 (stretch)
Kernel = Linux 4.14.71-v7+
Platform = Raspberry Pi 3 Model B Rev 1.2
OepnHAB = openhab 2.3.0-1
Binding = Xiaomi Mi IO Binding 2.4.0.201811111223

I have a full debug log of it, but I think it is to much to post it here. I’m using thing files also. If you need anything of it, let me know.

Greets Udo

Ok so the newest app version has the option to store the map, I don’t know if it was added over the air or via play store app update.
I can’t use it yet, as it requires a robot update as well which is not available yet for me.
But you manual update people could have a try!

@marcel_verpaalen
I have found a bug, but I don’t know how I could solve this. I have a Xiaomi Mi LED Desk Lamp.
The modelId is: yeelink.light.lamp1 (it was auto-configured).
Sometimes the binding fails turning ON/OFF the lamp. When I press the switch it immediately turns back to OFF/ON. Restarting the binding helps with this issue.

When trying to power it ON/OFF when this error happens, I get the following error (you can see when I turn on the lamp, and right after the error it turns off the switch… however sometimes the lamp turns on, sometimes don’t)

2018-11-14 13:49:16.176 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":6969,"method":"set_power","params":["on"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 1)

2018-11-14 13:49:16.196 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:49:16.202 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:49:16.207 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Periodic update for 'miio:generic:0443DBCD' (miio:basic)

==> /var/log/openhab2/events.log <==

2018-11-14 13:49:16.196 [GroupItemStateChangedEvent] - gAllLight changed from OFF to ON through miDeskLamp_Power

==> /var/log/openhab2/openhab.log <==

2018-11-14 13:49:16.216 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:49:16.219 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:49:16.222 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":6970,"method":"get_prop","params":["power","bright","delayoff","ct","color_mode"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 2)

2018-11-14 13:49:16.223 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:49:16.226 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:49:16.237 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":6971,"method":"get_prop","params":["name"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 3)

2018-11-14 13:49:16.246 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:49:16.257 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:49:16.272 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Received message is invalid JSON: 

2018-11-14 13:49:16.274 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: SET_POWER, result: null, fullresponse: {"error":"Received message is invalid JSON"}

2018-11-14 13:49:16.276 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Error received: "Received message is invalid JSON"

2018-11-14 13:49:16.301 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: ["ok"], fullresponse: {"result":["ok"],"id":6969}

2018-11-14 13:49:16.303 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Unexpected size different. Request size 5,  response size 1. (Req: ["power","bright","delayoff","ct","color_mode"], Resp:["ok"])

2018-11-14 13:49:16.309 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Error while handing message {"result":["ok"],"id":6969}

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1

	at java.util.ArrayList.rangeCheck(ArrayList.java:657) ~[?:?]

	at java.util.ArrayList.get(ArrayList.java:433) ~[?:?]

	at com.google.gson.JsonArray.get(JsonArray.java:183) ~[21:com.google.gson:2.7.0.v20170129-0911]

	at org.openhab.binding.miio.handler.MiIoBasicHandler.updateProperties(MiIoBasicHandler.java:378) ~[254:org.openhab.binding.miio:2.4.0.201810282000]

	at org.openhab.binding.miio.handler.MiIoBasicHandler.onMessageReceived(MiIoBasicHandler.java:429) [254:org.openhab.binding.miio:2.4.0.201810282000]

	at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication$MessageSenderThread.run(MiIoAsyncCommunication.java:211) [254:org.openhab.binding.miio:2.4.0.201810282000]

2018-11-14 13:49:16.326 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: ["on","6","0","2700","2"], fullresponse: {"result":["on","6","0","2700","2"],"id":6970}

2018-11-14 13:49:16.328 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Unexpected size different. Request size 1,  response size 5. (Req: ["name"], Resp:["on","6","0","2700","2"])

==> /var/log/openhab2/events.log <==

2018-11-14 13:49:16.326 [GroupItemStateChangedEvent] - gAllLight changed from ON to OFF through miDeskLamp_Power

Or the other error I found. This happens when pinging (polling?) the lamp’s state:

2018-11-14 13:52:58.104 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:52:58.109 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:52:58.113 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":6993,"method":"get_prop","params":["name"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 1)

2018-11-14 13:52:58.114 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Received message is invalid JSON: 

2018-11-14 13:52:58.115 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:52:58.117 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: null, fullresponse: {"error":"Received message is invalid JSON"}

2018-11-14 13:52:58.120 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Error received: "Received message is invalid JSON"

2018-11-14 13:52:58.120 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:52:58.128 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Received message is invalid JSON:

After refreshing the bundle, this is when it works as excepted:

2018-11-14 13:54:53.256 [ome.event.ItemCommandEvent] - Item 'miDeskLamp_Power' received command OFF

2018-11-14 13:54:53.276 [nt.ItemStatePredictedEvent] - miDeskLamp_Power predicted to become OFF

==> /var/log/openhab2/openhab.log <==

2018-11-14 13:54:53.293 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Locating action for channel power: OFF

2018-11-14 13:54:53.298 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Sending command set_power["off"]

2018-11-14 13:54:53.314 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":4,"method":"set_power","params":["off"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 1)

2018-11-14 13:54:53.317 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:54:53.328 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:54:53.337 [DEBUG] [inding.miio.handler.MiIoBasicHandler] - Periodic update for 'miio:generic:0443DBCD' (miio:basic)

2018-11-14 13:54:53.340 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:54:53.346 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:54:53.349 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":5,"method":"get_prop","params":["power","bright","delayoff","ct","color_mode"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 2)

2018-11-14 13:54:53.351 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:54:53.356 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:54:53.359 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":6,"method":"get_prop","params":["name"]} -> 10.0.0.148 (Device: 0443DBCD token: 8C91747B4A1CB9BB215A2788909BE0DA Queue: 3)

2018-11-14 13:54:53.361 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0443DBCD (10.0.0.148)

2018-11-14 13:54:53.370 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0443DBCD (10.0.0.148) success

2018-11-14 13:54:53.425 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: SET_POWER, result: ["ok"], fullresponse: {"result":["ok"],"id":4}

2018-11-14 13:54:53.435 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: ["off","6","0","2700","2"], fullresponse: {"result":["off","6","0","2700","2"],"id":5}

2018-11-14 13:54:53.458 [DEBUG] [ing.miio.handler.MiIoAbstractHandler] - Received response for 0443DBCD type: GET_PROPERTY, result: [""], fullresponse: {"result":[""],"id":6}

In which menu did you find this? I’m not really good at german…
However I didn’t get any updates for the app in the last week or so. (iOS)
As I can see you have the v2 vacuum, I have the v1 so I already have less features than you. Hope this feature will be added to both models.

1 Like

Sorry I didn’t realize nobody can read it except German people… It’s in the Robot Settings where you set the DND mode…
I also got a robot update now, I’ll install it in the evening:

Thanks! So it seems for me the option is not there in the app and I haven’t got any updates yet. However version numbers differs from yours, so I think the two models have different versions.

Right after the binding sends the command to execute the on/off, it is scheduling a refresh of the status.
In your case it seems the on/off did not execute on the light, and due to the directly following refresh, the switch goes immediately back,

Likewise, it appears the light is replying with empty messages.
You can run the binding with debuglevel set to trace to see the actual exchange of messages. This may give more indication of what is happening.

as some commands appear to be missing and messages content is sometimes off, can it be that there is some network connectivity issues with your light? (mine is also extremely poor in signal strength, less than 2 meter from the access-point and still sometimes looses wifi connection)

Yes, it might be, because it is far from the AP, however a Sonoff switch has around 60-70% RSSI.
The only weird thing is that I can still control it from the app when this happens. Also only a bundle refresh is needed to solve this issue, then it works again for days or even weeks without a single error.

If it happens again I’ll try it with trace, but it generates a lot of output, since I have some Xiaomi devices connected :slight_smile:

Ps.: I don’t know if this is an error or this happens because the state is polled from device, but when I turn on the lamp with the switch, it takes 5-10 seconds to update the state in openHab. Before that I didn’t have this experience with the vacuum or the air purifier. States uploaded instantly.

now with the “save map” feature is there a way to have the saved map in habpanel?

Hmm I don’t think the way the map is stored has changed, it is just matched again but no new API or the like…
Sadly, the robot behaves differently when using zoned cleanup. It becomes quite stupid to put it clearly. None of the admirable intelligence, that is seen with a full cleanup, is put to show in zoned cleanup. It just bumps into everything and sometimes even takes a pause to “think” or whatever it’s doing…
Maybe one must put up no go barriers instead of setting a go-to-zone to get the intelligent behaviour for distinct area cleaning :wink:

Did this happen?