Xiaomi Robot Vacuum Binding

binding
vacuum
xiaomi
Tags: #<Tag:0x00007f01476c8050> #<Tag:0x00007f01476c97c0> #<Tag:0x00007f01476caa30>

(Alpoy) #55

is it possible to download the binding manually? AFAIK, market bindings must be installed each boot :tired_face:


(marcel) #56

You don’t need to reinstall with each reboot the market bindings. They will persist
Nevertheless if you want to download, go to the eclipse marketplace site and find the binding and click download button. It will give the hyperlink to the file.


(Alpoy) #57

Really? I have to install it every time I boot …:frowning:

Thank you!


(Schnicki) #58

Thanks for your efforts @marcel_verpaalen, great work.

Same here. After a reboot, the token is lost and the input field of the thing has gone in PapaerUI.
When I delete and reinstall the binding, I can enter the token and it works like a charm.
Is there a way to persist the token in a textual config?


(marcel) #59

Would be good to understand why that happens…
I have not tried myself, but I don’t think there is anything that prevents the usual oh text file config.

The crucial mandatory elements of the config are indeed the ip and tolken.


(marcel) #60

did short test. your .things file should look something like this

Thing miio:vacuum:mine "Xiaomi Robot Vaccum Cleaner" @ "Kitchen" [ host="192.168.10.119", token="4474746a6b784ZZZZZZZZZZZZZZZZ" ]


Binding for Xiaomi wifi plug and power strips - Xiaomi Mi IO Binding
Binding for Xiaomi wifi plug and power strips - Xiaomi Mi IO Binding
(Brian M. Pedersen) #61

Hi Marcel
I’m trying to get my xiaomi plug to work with your binding.
I think I need to add it manually, but I dont know which option to take in your grups:

image

Also I use ip adress a indentifier, but I see differnet device ID’s when I use the binding and when I try to get the token with the solution provided here https://github.com/aholstenson/miio/blob/master/docs/management.md

[12:23:17] openhabian@openHABianPi:~$ miio --discover
INFO Discovering devices. Press Ctrl+C to stop.

Device ID: 47404300
Model info: Unknown
Address: 192.168.1.101
Token: ???
Support: Unknown

Device ID: 64481910
Model info: Unknown
Address: 192.168.1.100
Token: ???
Support: Unknown

Device ID: 55232582
Model info: Unknown
Address: 192.168.1.103
Token: fd6d3f150b00f40e3b3b1a3d7ea6476c via auto-token
Support: Unknown

Im using the following version of the binding:

openhab> bundle:list | grep Xiaomi
244 | Active | 80 | 2.2.0.201708220829 | Xiaomi Mi Smart Home Binding


(marcel) #62

yes, he is showing the # in decimal, I’m showing it in hexidecimal
e.g. you can convert this number by opening the windows calculator, change to programmer mode
You can see that 64481910 is the decimal equivalent of 3D7EA76
or even simpler, in google, just google for 3D7EA76 to decimal / 64481910 to hexadecimal


(marcel) #63

So, for your plug to work, you can add it as a Xiaomi Mi IO device.
it will change itself to a unsupported device if the tolken was correct.

alternatively you can directly add it as unsupported device.
There you should have the power-on power off button. If I remeber right, the on/off command for the strip matches the command for lights/airpurifier

Is OH discovery not finding any device for you?


(Brian M. Pedersen) #64

Hi Marcel
I Tested it today, It will only find my robot not the wifi plug.
When I added the wifi plug with the correct token everything worked fine.

I did get some error, here they are if you like to see them in detail:
Thanks again for developing this! :slight_smile:

2017-08-29 22:36:49.808 [ItemChannelLinkAddedEvent ] - Link 'miio_generic_e335e8fa_actions_power-miio:generic:e335e8fa:actions#power' has been added.
2017-08-29 22:36:49.817 [ItemChannelLinkAddedEvent ] - Link 'miio_generic_e335e8fa_actions_testcommands-miio:generic:e335e8fa:actions#testcommands' has been added.
2017-08-29 22:36:49.835 [ThingAddedEvent           ] - Thing 'miio:generic:e335e8fa' has been added.
2017-08-29 22:36:49.861 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from UNINITIALIZED to INITIALIZING

2017-08-29 22:36:54.864 [WARN ] [ome.core.thing.internal.ThingManager] - Initializing handler for thing 'miio:generic:e335e8fa' takes more than 5000ms.
==> /var/log/openhab2/events.log <==
2017-08-29 22:36:54.871 [ThingUpdatedEvent         ] - Thing 'miio:generic:e335e8fa' has been updated.
2017-08-29 22:36:55.012 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from ONLINE to OFFLINE
2017-08-29 22:36:55.016 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from OFFLINE to UNINITIALIZED
2017-08-29 22:36:55.042 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from UNINITIALIZED to ONLINE
==> /var/log/openhab2/openhab.log <==
2017-08-29 22:36:59.937 [WARN ] [ore.internal.events.OSGiEventManager] - Dispatching event to subscriber 'org.eclipse.smarthome.core.thing.link.ThingLinkManager@101e6b5' takes more than 5000ms.
==> /var/log/openhab2/events.log <==
2017-08-29 22:36:59.938 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from INITIALIZING to ONLINE
2017-08-29 22:36:59.943 [ThingUpdatedEvent         ] - Thing 'miio:generic:e335e8fa' has been updated.
2017-08-29 22:36:59.946 [ThingUpdatedEvent         ] - Thing 'miio:generic:e335e8fa' has been updated.
==> /var/log/openhab2/openhab.log <==
2017-08-29 22:37:00.011 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing handler factory 'org.openhab.binding.miio.internal.MiIoHandlerFactory@1a4437b' 
java.util.concurrent.TimeoutException
	at java.util.concurrent.FutureTask.get(FutureTask.java:205)[:1.8.0_121]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:194)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.doUnregisterHandler(ThingManager.java:795)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.unregisterHandler(ThingManager.java:785)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.unregisterAndDisposeHandler(ThingManager.java:866)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.access$17(ThingManager.java:860)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$3.run(ThingManager.java:289)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

2017-08-29 22:38:00.221 [ERROR] [ome.core.thing.internal.ThingManager] - Thing type migration failed for miio:generic:e335e8fa. The handler deregistration did not complete within 60,000ms.
==> /var/log/openhab2/events.log <==
2017-08-29 22:38:00.228 [ThingUpdatedEvent         ] - Thing 'miio:generic:e335e8fa' has been updated.
2017-08-29 22:38:00.235 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from ONLINE to UNINITIALIZED
2017-08-29 22:38:00.236 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from UNINITIALIZED to ONLINE
2017-08-29 22:38:00.258 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from ONLINE to UNINITIALIZED (HANDLER_MISSING_ERROR)
2017-08-29 22:38:00.259 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from ONLINE to UNINITIALIZED (HANDLER_MISSING_ERROR)
2017-08-29 22:38:00.329 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2017-08-29 22:38:00.342 [ThingUpdatedEvent         ] - Thing 'miio:generic:e335e8fa' has been updated.
2017-08-29 22:38:00.440 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from INITIALIZING to OFFLINE
2017-08-29 22:38:00.443 [hingStatusInfoChangedEvent] - 'miio:generic:e335e8fa' changed from OFFLINE to ONLINE
2017-08-29 22:38:44.517 [ItemCommandEvent          ] - Item 'miio_generic_e335e8fa_actions_power' received command ON
2017-08-29 22:38:44.527 [ItemStateChangedEvent     ] - miio_generic_e335e8fa_actions_power changed from NULL to ON
2017-08-29 22:38:49.568 [ItemCommandEvent          ] - Item 'miio_generic_e335e8fa_actions_testcommands' received command ON
==> /var/log/openhab2/openhab.log <==
2017-08-29 22:38:49.576 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling handler: java.lang.IllegalStateException: This is not a JSON Array.
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: This is not a JSON Array.
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:220)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:189)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:83)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:67)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager.receiveCommand(ThingManager.java:374)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.items.events.AbstractItemEventSubscriber.receive(AbstractItemEventSubscriber.java:47)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:192)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.internal.events.OSGiEventManager$1.call(OSGiEventManager.java:1)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[101:org.eclipse.smarthome.core:0.9.0.b5]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
Caused by: java.lang.IllegalStateException: This is not a JSON Array.
	at com.google.gson.JsonElement.getAsJsonArray(JsonElement.java:106)[13:com.google.gson:2.3.1]
	at org.openhab.binding.miio.internal.MiIoCommunication.sendCommand(MiIoCommunication.java:73)[255:org.openhab.binding.miio:2.2.0.SNAPSHOT]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.sendCommand(MiIoAbstractHandler.java:165)[255:org.openhab.binding.miio:2.2.0.SNAPSHOT]
	at org.openhab.binding.miio.handler.MiIoUnsupportedHandler.executeExperimentalCommands(MiIoUnsupportedHandler.java:96)[255:org.openhab.binding.miio:2.2.0.SNAPSHOT]
	at org.openhab.binding.miio.handler.MiIoUnsupportedHandler.handleCommand(MiIoUnsupportedHandler.java:54)[255:org.openhab.binding.miio:2.2.0.SNAPSHOT]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:377)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.thing.internal.ThingManager$4.call(ThingManager.java:1)[108:org.eclipse.smarthome.core.thing:0.9.0.b5]
	at org.eclipse.smarthome.core.common.SafeMethodCaller.executeDirectly(SafeMethodCaller.java:218)[101:org.eclipse.smarthome.core:0.9.0.b5]
	... 12 more
==> /var/log/openhab2/events.log <==
2017-08-29 22:38:49.584 [ItemStateChangedEvent     ] - miio_generic_e335e8fa_actions_testcommands changed from NULL to ON
2017-08-29 22:38:54.839 [ItemCommandEvent          ] - Item 'miio_generic_e335e8fa_actions_power' received command OFF
2017-08-29 22:38:54.851 [ItemStateChangedEvent     ] - miio_generic_e335e8fa_actions_power changed from ON to OFF


2017-08-29 22:38:58.363 [ItemCommandEvent          ] - Item 'miio_generic_e335e8fa_actions_power' received command ON
2017-08-29 22:38:58.374 [ItemStateChangedEvent     ] - miio_generic_e335e8fa_actions_power changed from OFF to ON

(Christian) #65

Hi,

i really like this binding. But everytime i update openHAB it’s not installed anymore.
How i define this in my addons.cfg?

I tried to add “market:binding-3499123” to the addons.cfg, but this is not working.


(Neil) #66

just ‘binding-3499123’ (without the quotes) will do it.

You also need ‘market’ (without the quotes) in the misc section of addons.cfg

Works for me, anyway. :slight_smile:


(Hallo Ween) #67

Is control for yeelight already implemented? Can i controll all things of yeelight or only on/off?

Or is this the wrong binding for it?


(marcel) #68

At the moment for most yeelights on/off will work.
For very few models there is experimental support for more channels.


(Rohnny Swennen) #69

Marcel,

I have the Eclipse IOT market installed through paper UI but afterwards I don’t see your binding showing up. I only see the Xiaomi Mi Smart Home Binding, not this one.

I do see other marketplace bindings showing up however (e.g.MySensors Binding market:binding-3328323 - 1.0 and WeatherUnderground Binding market:binding-3350575 - 1.0) which suggests the marketplace add-on installation was succesful.

Any idea why your binding is not showing up? I’m running openhabian and version is ( openHAB 2.1.0-1 (Build ))


(Stefan Rademacher) #70

Hi there,

I used your steps to get the token from my iPhone. Weirdly, my token has a length of 96 characters:

That token is not accepted in the Thing Configuration (PaperUI).
When I use only the first 32 characters of the token, the Robot is shown as “Online”, but still, the communication doesn’t work:
16:01:36.849 [DEBUG] [ding.miio.internal.MiIoCommunication] - Send command:{"id":385,"method":"get_status","params":[]} -> 192.168.178.124 (Device: 03D9BF2A token: C0514AFE97AB4C7E639CF893B7325C67) 16:01:36.855 [TRACE] [ding.miio.internal.MiIoCommunication] - Connection 192.168.178.124:46833 16:01:40.863 [DEBUG] [ding.miio.internal.MiIoCommunication] - Communication error for Mi IO device at 192.168.178.124: Receive timed out 16:01:40.865 [DEBUG] [ding.miio.internal.MiIoCommunication] - Reponse length <32 : 0 16:01:40.868 [TRACE] [ding.miio.internal.MiIoCommunication] - No response from device 03D9BF2A at 192.168.178.124 for command {"id":385,"method":"get_status","params":[]}. Message: Header : 21 31 00 50 00 00 00 00 03 D9 BF 2A 59 B2 A2 C0 checksum: 71 45 63 C2 8A 83 42 FC 94 CD 45 64 92 19 75 88 content : 88 DA D9 02 86 C7 16 8A 47 9B AA FF CD CB 5E 0C BF A5 CD C8 AE 64 93 BC EB 5B 48 52 6B 09 51 3D 02 87 7D 2B 6D A2 23 3E 9A E6 8E FA FA F3 F6 63 Header Details: Magic:21 31 Length: 80 Serial: 03 D9 BF 2A TS:2017-09-08 16:01:36 16:01:40.870 [TRACE] [ing.miio.handler.MiIoAbstractHandler] - Empty response received. 16:01:40.873 [DEBUG] [nding.miio.handler.MiIoVacuumHandler] - Error while updating 'miio:vacuum:3D9BF2A': java.lang.NullPointerException at org.openhab.binding.miio.handler.MiIoVacuumHandler.updateVacuumStatus(MiIoVacuumHandler.java:110)[205:org.openhab.binding.miio:2.2.0.SNAPSHOT] at org.openhab.binding.miio.handler.MiIoVacuumHandler.getStatusData(MiIoVacuumHandler.java:106)[205:org.openhab.binding.miio:2.2.0.SNAPSHOT] at org.openhab.binding.miio.handler.MiIoVacuumHandler.updateData(MiIoVacuumHandler.java:237)[205:org.openhab.binding.miio:2.2.0.SNAPSHOT] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_144] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_144] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_144] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_144] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_144] at java.lang.Thread.run(Thread.java:748)[:1.8.0_144]

Do you know, what’s wrong with my token?

Thanks!!!


(Rohnny Swennen) #71

Is there any other requirement for this binding? I really don’t see it showing up in the binding list after installing marketplace. Tried installing market place through Paper UI and via config file.

Also tried installing this binding through config file but don’t see any trace of it in the log files neither in paper UI. But it is included in the /var/lib/openhab2/etc/org.openhab.addons.cfg file and in addons.config under /srv/openhab2-userdata/config/org/openhab

Do you maybe need an unstable Openhab version to install this ?


(Stefan Rademacher) #72

I used an Android device now, to get the token. The token is different from the one, I found via iOS/local backup.
I am facing other problems now, but wanted to let you know, that for an unknown reason, the token retrieval for iOS might end up with a token in an invalid format…


(marcel) #73

I don’t know why it is not visible. I uninstalled mine and reinstalled it. I did not experience it.

I’ll try to do a fresh install to see if that makes any difference.
As far as I know you need a released OH 2.1 or later.

image


(marcel) #74

If the internal market place does not work for you, the fallback is to use the download link from the eclipse market place and place the jar file in your addons folder.