Xiaomi Mi Infrared Remote Control

I just bought the Mi Infrared Remote control pictured above. It can be setup via the MI Home app (Same as Yeelights and Xiaomi Camera). Does anyone know if there is a binding available for it. The app is only in Chinese for this section of the setup but using Google Translate I could easily setup my media player, TV and blue-ray. It works well and is very cheap. I only paid $20 on gearbest for it.

This looks to be a cheap alternative to the Harmony remote.

Any help with this will be appreciated.

4 Likes

I wonder if Miio binding would allow an inegration here.
@marcel_verpaalen wdyt?

Is this the Xiaomi Chuangmi IR Remote control?
If yes, I believe it uses the same communication protocol.

Phython-miio had some basic support for it I believe.

Anyway, if it is controlled by wifi through the mihome app and it does not need the gateway there is a high chance that it can be controlled with the miio binding.

You can extract the token from the mi home app and let the binding discover.

This is the title on gearbest.com “Original Xiaomi Universal IR Remote Controller - BLACK”

As stated it can work with the gateway but does not need it to function.

Original Xiaomi Universal IR Remote Controller - BLACK

DO I need to turn developer mode on. Any idea how to do it on the MI Home app? Any idea how to get the token and how to get it discoverable for Openhab?

Thanks in advance for your help

You can obtain the binding through the buildin store, select the "Openhab Xiaomi Mi IO Binding"
With the binding installed, if you are lucky it will discover your device.

Once discovered, you may need to enter the token, or the token is provided during discovery (I can’t tell… depending per device if it is provided automatically)

Please look for how to obtain the token in this topic


Also google may be of assistance here…

Once installed, and if compatible, I expect it to be identified as 'miio:unsupported" as no build in support is available.
Than enable the (advanced) cmd channel

You can than use the cmd channel to execute commands. From what I saw there are 2 commands:
miIO.ir_learn["key" : 1] -> to learn codes. replace the number with the id you want to learn
miIO.ir_read["key" : 1 ] -> to read the key. dunno what that actually means
miIO.ir_play["freq": 38400, "code": command ] -> I guess the commands can be obtained with the read cmd. the frequency is the default one… you probably can have different ones as well.

Anyway… once you have the communication working fine, set the log level to debug and share the output of the binding (see also the vacuum topic). I may be able to add support for it in due time.

OK. I managed to get the binding installed and it discovered my IR device.I will start playing with it now.

1 Like

Hi,

Any findings for this? I just got the device recently and I had yet to install it and test.

Will appreciate very much to hear how’s the integration of Xiaomi IR blaster with Openhab. :blush:

Hi,

Sorry for the very basic question, but I’m not able to find the Xiaomi Mi IO binding in https://docs.openhab.org/addons/bindings.html. Do I need to install it from somewhere else?

I really want to start working with the IR emitter!

Thanks for all the work!
Pedro

@txano

Hi, is this still possible, I cannot find Mi IO binding not in openhab not in documentation here https://docs.openhab.org/addons/bindings.html
Or has the name changed perhaps?

The binding is not yet merged in the regular oh distribution. Hence the documentation also is bit merged.

To see the documentation, go to the eclipse market website, follow the link to the github repository.

However better read the topic from xiaomi robot vacuum add it has more details than the docu

1 Like

Thanks, will do :slight_smile:

I’m trying the miIO.ir_read[“key” : 1 ] command and I get the following error.

09:39:32.085 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'ChuangmiIrV2_miio66047370_Actions_ExecuteCommand' received command miIO.ir_read["key" : 1 ]
09:39:32.088 [WARN ] [rnal.transport.MiIoAsyncCommunication] - Send command 'miIO.ir_read' with parameters ["key" : 1 ] -> 192.168.1.119 (Device: 03EFCD8A) gave error com.google.gson.stream.MalformedJsonException: Unterminated array at line 1 column 9 path $[1]
09:39:32.090 [INFO ] [smarthome.event.ItemStateChangedEvent] - ChuangmiIrV2_miio66047370_Actions_ExecuteCommand changed from miIO.ir_read[1] to miIO.ir_read["key" : 1 ]
09:39:32.090 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.handleCommand()' on 'org.openhab.binding.miio.handler.MiIoUnsupportedHandler@300f062e': com.google.gson.stream.MalformedJsonException: Unterminated array at line 1 column 9 path $[1]
com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated array at line 1 column 9 path $[1]
	at com.google.gson.internal.Streams.parse(Streams.java:60) [22:com.google.gson:2.7.0]
	at com.google.gson.JsonParser.parse(JsonParser.java:84) [22:com.google.gson:2.7.0]
	at com.google.gson.JsonParser.parse(JsonParser.java:59) [22:com.google.gson:2.7.0]
	at com.google.gson.JsonParser.parse(JsonParser.java:45) [22:com.google.gson:2.7.0]
	at org.openhab.binding.miio.internal.transport.MiIoAsyncCommunication.queueCommand(MiIoAsyncCommunication.java:133) [237:org.openhab.binding.miio:2.3.0.201803092003]
	at org.openhab.binding.miio.handler.MiIoAbstractHandler.sendCommand(MiIoAbstractHandler.java:190) [237:org.openhab.binding.miio:2.3.0.201803092003]
	at org.openhab.binding.miio.handler.MiIoUnsupportedHandler.handleCommand(MiIoUnsupportedHandler.java:51) [237:org.openhab.binding.miio:2.3.0.201803092003]
	at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at com.sun.proxy.$Proxy189.handleCommand(Unknown Source) [237:org.openhab.binding.miio:2.3.0.201803092003]
	at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
	at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
	at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

I tried a few different json command but no sucess… Is there souce code for this somewhere?

OK got it to work :slight_smile:

First add to the Execute Command action

miIO.ir_learn {"key": "1"}

The command is automaticaly executed, check the logs. Use Karaf

openhab> log:tail org.openhab.binding.miio

then enter

miIO.ir_read {"key": "1"}

and read the token

then enter

miIO.ir_play {"freq": 38400, "code": "Z6VHADUCAACbBgAAuggAAIIRAABmIwAAQJwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAAAEAAAAAAQEBAAEBAQEAAAAAAQAAAAEBAQEAAQEBBQJAA="} 

The IR signal should be sent :slight_smile:

Some help here -> https://github.com/rytilahti/python-miio/issues/175

2 Likes

Nice you figured it out.
You can add that final command to a rule for easy execution

Hi,

at first thanks for sharing your progress. I’m stuck at the very first step: i don’t know how to add the execute command action

so if i run the openhab console and type

miIO.ir_read {"key": "1"}

the response is

Command not found: miIO.ir_read

Could you please explain how to add this custom command?

If you are trying to get the token I would advice you follow this guide:

I followed these commands I got my token.

$ npm install -g miio
$ miio discover

thank you. i alread got the token, i just don’t know how to achieve this:

i installed the binding, found the IR-device, set the token, and the THING is shown as ONLINE. But how to edit/add the actions?

these channels are marked as advanced, hence you need to do one more click in the paperUI to make them visible (the “SHOW MORE” button next to the channels definition in the thing edit,)

I just realized, that this is part of the control-tab in PaperUI … I tried to find it in the config-tab
thanks for your help. So finally i got it working. I can trigger the IR-Remote from rules. Thanks for the help!

it works flawless with the signals for my Sony-TV but the learned signals for the Yamaha AVR don’t work. could it be necesarry to change the “freq” in the miIO.ir_play command?

Edit/Solution:
i tried the app"anymote" for android to control the AVR via my mobile … these signals can be leared by the xiaomi ir whereas the signals from the original yamaha remote did not work