Xiaomi Robot Vacuum Binding

I don’t know. It was a suggestion I received in the telegram group based onthis issue. Seems the v2 has new sort of speeds (above 100) from which one is linked to mobbing. I think it is worth a try to set it.

@marcel_verpaalen

Is there a way to be notify when the yeelight (basic) switched on / offf (online / offline) - something like LIFX have with the thing status info?

For the vacuum?

e.g.:

rule "Lifx online"
when
  Thing "lifx:colorlight:D263D511AF92" changed or
  Thing "lifx:colorlight:D471D3235811" changed
then

Thx

@marcel_verpaalen

I have issues with yeelight color. Maybe logs below can help to identify the issue

2018-11-02 19:38:17.976 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'mi.things'

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

2018-11-02 19:38:18.083 [hingStatusInfoChangedEvent] - 'miio:vacuum:04EFCDCA' changed from ONLINE to OFFLINE

2018-11-02 19:38:18.105 [me.event.ThingUpdatedEvent] - Thing 'miio:vacuum:04EFCDCA' has been updated.

2018-11-02 19:38:18.111 [hingStatusInfoChangedEvent] - 'miio:basic:0371E913' changed from ONLINE to OFFLINE

2018-11-02 19:38:18.115 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:0371E913' has been updated.

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

2018-11-02 19:38:19.100 [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) [?:?]

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

2018-11-02 19:38:19.177 [me.event.ThingUpdatedEvent] - Thing 'miio:vacuum:04EFCDCA' has been updated.

2018-11-02 19:38:19.245 [me.event.ThingUpdatedEvent] - Thing 'miio:vacuum:04EFCDCA' has been updated.

2018-11-02 19:38:25.430 [vent.ItemStateChangedEvent] - Current_Date changed from 2018-11-02T19:37:25.392+0200 to 2018-11-02T19:38:25.406+0200

2018-11-02 19:38:25.435 [vent.ItemStateChangedEvent] - Current_Time changed from 2018-11-02T19:37:25.392+0200 to 2018-11-02T19:38:25.406+0200

2018-11-02 19:38:28.121 [hingStatusInfoChangedEvent] - 'miio:vacuum:04EFCDCA' changed from OFFLINE to ONLINE

2018-11-02 19:38:28.199 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:0371E913' has been updated.

2018-11-02 19:38:28.205 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:0371E913' has been updated.

2018-11-02 19:38:28.236 [hingStatusInfoChangedEvent] - 'miio:basic:0371E913' changed from OFFLINE to ONLINE

2018-11-02 19:38:28.297 [me.event.ThingUpdatedEvent] - Thing 'miio:vacuum:04EFCDCA' has been updated.

2018-11-02 19:38:28.334 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:0371E913' has been updated.

2018-11-02 19:38:28.342 [me.event.ThingUpdatedEvent] - Thing 'miio:basic:0371E913' has been updated.

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

2018-11-02 19:38:28.341 [INFO ] [ing.miio.handler.MiIoAbstractHandler] - Mi IO model yeelink.light.color1 identified as: Yeelight Color Bulb (yeelink.light.color1). Matches thingtype miio:basic

2018-11-02 19:38:28.346 [INFO ] [ing.miio.handler.MiIoAbstractHandler] - Mi IO model roborock.vacuum.s5 identified as: Mi Robot Vacuum v2 (roborock.vacuum.s5). Matches thingtype miio:vacuum

That’s funny :slight_smile: My version is 3.3.9_003416 and I don’t have any save option, or at least I don’t know about it.
Maybe someone can make it clear for me, if this save function is released, can we somehow include it in HabPanel or it will be just useful for SLAM? I have the same problem with repositioning, the map is always rotated in some way, basically there are 3 “versions” of the map.

So it was me who began the whole save function story. And for now it seems to remain just a story.
I read this article (it’s in german, sorry!): https://www.smarthomeassistent.de/update-fuer-den-mi-robot-2-roborock-s50-mit-no-go-lines/
And they state that there’s an update featuring no-go-lines or barrier tape, so you set up no-go-areas. This will also mean, that you’ll be able to store a map and it will be matched by SLAM if possible.

But until now, I have not seen any of those features - maybe we just need some patience.

can I configure the thing in a things file? what is the syntax?

cheers and thanks !

Hi,

If you want to use the vacuum with zones, you can see here rule that I am using for zone control

Enjoy

Good evening,

I would like to create my own rule for spot cleaning and struggle a bit with the coding. Maybee someone has an idea how I can fix it.

my item:

String XiaVac_action_Control     "Vacuum Control"     (gXiaomiVac)       {channel="miio:vacuum:046F78BA:actions#control" }
String XiaVac_Cleaning_Area  "Spot Cleaning"

my Map:

Schlafzimmer=[21007,22127,26007,26577,1]
..
Kueche=[[25919,35920,27669,37470,1],[26495,32855,28295,35905,1]]

sitemap:

Switch   item=XiaVac_Cleaning_Area  mappings=[Kueche="Küche", Arbtszmmer ="Arbtszmmer", .. Schlafzimmer ="Schlafzimmer", Alles ="Alles"]
Switch 	item=XiaVac_action_Control 	mappings=[vacuum="Saugen", pause="Pause",spot="Spot", dock="Dock"]

What I like to do is the following:

If item Cleaning area gets an update e.g. Küche, then go to the map, take the coordinates and start zone cleanup. In the meantime, set the action_control item to “Spot” and after finishing clear the status of the area cleaning.

my rule looks like this at the moment:

rule "Zone Cleanup"
when
  Item XiaVac_Cleaning_Area received update 
then
  // Only if the mi robot is currently on the dock
  if (XiaVac_status_State.state == "Charging") {
        val areaMap = transform("MAP", "vacuum_area.map", XiaVac_Cleaning_Area.state)

    if (areaMap != "")
      XiaVac_action_Command.sendCommand('app_zoned_clean[' + areaMap + ']')
  }
end

the status change at the end should like like this:

rule "change status"
    when
        Item XiaVac_status_State changed to Charging
    then 
        XiaVac_Cleaning_Area.postUpdate(0)
end

How can I merge these two rules and where is my logical bug at the moment? Thank you for helping me out here. At which point of my rule do I have to ad the Action_Control to Spot?

@shorty707
please look at the readme for things file and item file examples

For those who want to know how to use the mop function. This is part of my rule for zones, This is a mop zone.

case zoneCommand.state=="6": //zone 6, Holly Food Mop
	{
			actionFan.sendCommand(105)
          actionCommand.sendCommand("app_zoned_clean[[29298,23311,31048,27761,3]]")
		  zoneCommand.postUpdate("")
		  }

The actionFan.sendCommand(105) is the specific command for mop function
You then send a zone. or do whatever you want from there

2 Likes

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