Xiaomi Robot Vacuum Binding

Hi Marcel
I get this error all the time and I think this is the reason why the commands also fails:

018-03-05 22:27:16.128 [WARN ] [nal.transport.MiIoAsyncCommunication] - Send command '{"id":3249,"method":"miIO.info","params":[]}'  -> 192.168.1.xxx (Device: 02D3550C) gave error Given final block not properly padded

Any suggestions?

He answered this already some posts up, so I’m quoting him here.

Hi

get_prop_fm, play_fm are working. Other don’t. Any advice ?

I also tried using miio :

# miio protocol call 57840089 play_specify_fm '[{"type": 0, "id": 0, "url": "http://streaming.radio.funradio.fr/rtl-1-44-96"}]'
 INFO  Attempting to call play_specify_fm on 57840089
 INFO  Device found, making call
 ERROR  Encountered an error while controlling device
Error was:
no id/url/type

EDIT :
Finally, the command is successfully sent without [] :

sendCommand(Xiaomi_Gateway_ActionsCommands, 'play_specify_fm {"type": 0, "id": 0, "url": "http://live.xmcdn.com/live/1005/64.m3u8"}')

But I am not able to set another m3u8 source (not working)

1 Like

Anyone faced no such table: devicerecord problem when retrieving Mi token? https://github.com/ultrara1n/MiToolkit/issues/16

You have to use old version of mihome app (5.0.19 work)

I downgraded to 5.0.19, but the issue remains :frowning:

Try to remove data first from mihome app. And if you are under linux you can try adb and python-miio to get the token.

@furax54, many thanks for the suggestion. I cleared up the app data and now I see the token being printed. Will go on with integration!

Update:
I’ve integrated my rockrobo into openhab. I am able to start/stop, see the status and battery level. Thank you, guys for bringing it life!

Good evening,
@marcel_verpaalen I have a important question.
i want to use this binding together with viocecommands via ifttt. But wich command did i need to send to start or stop or to find?
When i press start what command your service send?

Thanks for that

Well, I thought I could use the token that I use for the Xiaomi mi Smart home binding, but are you saying it’s not the same token for the two bindings?

Hi Albin
How did you go about this? I can’t get it to work, I think I have a token problem, but I’m using the same token as I do for the Mi home smart binding.I get the:

2018-03-16 13:26:46.685 [WARN ] [nal.transport.MiIoAsyncCommunication] - Send command '{"id":9,"method":"miIO.info","params":[]}'  -> 192.168.1.110 (Device: 02D3550C) gave error Given final block not properly padded

Error. Please could you share what you did?

Hi Brian,

I don’t exactly understand what you are trying and how.
Could you chare your rules, items, things ?

well, Im trying to send a command to the mi home gateway, making the radio play, I normal use the REST ui to test, I build my rules in Node-red. but before all this, I need to be able to send commands to the gateway, like your:

sendCommand(Xiaomi_Gateway_ActionsCommands, 'play_specify_fm {"type": 0, "id": 0, "url": "http://live.xmcdn.com/live/1005/64.m3u8"}')

If my item is not working, I can’t. So Im trying the configure my gateway item with the xioami IO binding. The error I get is most like due to problems with the token(due to gave error Given final block not properly padded error), but I use the same token for the mi smart home binding… so Im interested in how you did it.

I understand now.
The token is wrong.

In the MiHome binding, there is no “token”, only a serial number and the API key you got from the xiaomi app on your phone.
In the Mi IO binding, you need the key. You can extract it the same ways as for the vacuum (with the sqlite file from your phone for instance).

1 Like

Thanks alot! :smiley:
I looked in the /data/data/com.xiaomi.smarthome/databases/miio2.db with SQLliteManager on my android. I can’t seem to find the token for the gateway, the miio discover doesn’t work either on the gateway.
Did you get the token for your gateway recently? I think there was some changes to how you can get the token.

Brian,
look here: Version 5.0.19 or older required to retrive token.

1 Like

Marcel,
I am running openHAB 2.3.0 Build #1204 and just updated your binding to latest version (Mar 17)
Getting the following errors when openhab starts:

2018-03-18 18:19:54.326 [ERROR] [org.openhab.binding.miio            ] - [org.openhab.binding.miio.internal.discovery.MiIoDiscovery(76)] The activate method has thrown an exception

java.lang.IncompatibleClassChangeError: Expected non-static field org.openhab.binding.miio.internal.discovery.MiIoDiscovery.scheduler

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

	at org.eclipse.smarthome.config.discovery.AbstractDiscoveryService.activate(AbstractDiscoveryService.java:403) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.apache.felix.scr.impl.inject.BaseMethod.invokeMethod(BaseMethod.java:229) ~[45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BaseMethod.access$500(BaseMethod.java:39) ~[45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BaseMethod$Resolved.invoke(BaseMethod.java:650) ~[45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BaseMethod.invoke(BaseMethod.java:506) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:307) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.ActivateMethod.invoke(ActivateMethod.java:299) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:298) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:109) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:906) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:879) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:823) [45:org.apache.felix.scr:2.0.12]

	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212) [?:?]

	at java.security.AccessController.doPrivileged(Native Method) ~[?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:496) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461) [?:?]

	at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:619) [?:?]

	at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(SingleRefPair.java:72) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.inject.BindMethod.getServiceObject(BindMethod.java:651) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2201) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.DependencyManager.doInvokeBindMethod(DependencyManager.java:1714) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.DependencyManager.invokeBindMethod(DependencyManager.java:1699) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeBindMethod(SingleComponentManager.java:372) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:320) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.DependencyManager$MultipleDynamicCustomizer.addedService(DependencyManager.java:291) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1215) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1136) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:945) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:881) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1167) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:127) [45:org.apache.felix.scr:2.0.12]

	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109) [?:?]

	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:915) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]

	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127) [?:?]

	at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225) [?:?]

	at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464) [?:?]

	at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:887) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.register(AbstractComponentManager.java:874) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:132) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.AbstractComponentManager.registerService(AbstractComponentManager.java:941) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:741) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:675) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:430) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:657) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:341) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:390) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.Activator.access$200(Activator.java:54) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:265) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:254) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:227) [45:org.apache.felix.scr:2.0.12]

	at org.apache.felix.utils.extender.AbstractExtender.addingBundle(AbstractExtender.java:187) [45:org.apache.felix.scr:2.0.12]

	at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469) [?:?]

	at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415) [?:?]

	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) [?:?]

	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) [?:?]

	at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) [?:?]

	at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:903) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]

	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112) [?:?]

	at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:156) [?:?]

	at org.eclipse.osgi.container.Module.publishEvent(Module.java:476) [?:?]

	at org.eclipse.osgi.container.Module.start(Module.java:467) [?:?]

	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:470) [?:?]

	at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:736) [?:?]

	at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:727) [?:?]

	at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:497) [?:?]

	at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:443) [?:?]

	at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:987) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1368) [?:?]

	at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]

	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]

Previous version do not had these errors.
Thanks for your support!

That is indeed very odd.
I remember reading something about significant change just happening which gave this error on several bindings

I’ll check it out on my instance

Hello @marcel_verpaalen

Could you add another brightness channel for the night mode of the jiayoue ceiling lights ?

To get the current brightness value when lamp is in night mode get_prop[“nl_br”]’ is needed.

Kind regards

I got my first xiaomi wifi device a few days ago and today i included it into openhab.

It is a xiaomi miio yeelink light strip 1 MW300 (this is shown in paper ui).

It is identified as Xiaomi Mi IO Basic device.

I installed mihoma app 5.0.19 on my second android device and i could see the token with rootexplorer internal viewer. With new mihome app on my main device, the value for token was empty, but on my old device i could see the token.

I installed the binding inside paper ui from the market and i got new things in my inbox. I entered the the token and i got the channels.

Now i can switch the light strip on and off. It is wokring. The other functions will be included soon.

Is this identification as “Xiaomi Mi IO Basic device” the right one?

Power is shown as switch the other channels as numbers (brightness, delayoff, color), name is a string item.


Can i use color picker item with the number channel from the lightstrip?