Xiaomi Mi Infrared Remote Control

That would be great. I am on 3.2 and would like to test. :wink:

I am using an ECMA script to learn the codes:

      /// learn
      ///events.sendCommand("Fernbedienungen", 'miIO.ir_learn {"key": "1"}');

      /// read
      ///events.sendCommand("Fernbedienungen", 'miIO.ir_read {"key": "1"}');

      /// play
      events.sendCommand("Fernbedienungen", 'miIO.ir_play {"freq": 38400, "code": "mU3mMwlk4mcwlk0nMwlkzCAA"}');

The ir_read command seems to work:

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

2021-12-06 13:07:54.624 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":4650,"method":"miIO.ir_read","params":{"key":"1"}} -> 192.168.194.82 (Device: 271339092 token: 07DBA65BXXXXXXXXXXXXXXXXB47CD25D Queue: 1).

2021-12-06 13:07:54.843 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for device 102C4E54 type: UNKNOWN, result: null, fullresponse: {"id":4650,"error":{"code":0,"message":"no code for this key"}}

2021-12-06 13:07:54.844 [DEBUG] [internal.handler.MiIoAbstractHandler] - Error received for command '{"id":4650,"method":"miIO.ir_read","params":{"key":"1"}}': {"code":0,"message":"no code for this key"}.

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

2021-12-06 13:07:54.606 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Fernbedienungen' received command miIO.ir_read {"key": "1"}

2021-12-06 13:07:54.607 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Fernbedienungen' predicted to become miIO.ir_read {"key": "1"}

2021-12-06 13:07:54.609 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Fernbedienungen' changed from {"id":4647,"result":["ok"]} to miIO.ir_read {"key": "1"}

The ir_play command works as well, the ir signal is send. But I donโ€™t get any code by using ir_learn. Normally, the device leds should start blinking after that command, until it receives a signal. It does not start blinking, only if I send the ir_learn several times.

2021-12-06 13:12:28.984 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":4655,"method":"miIO.ir_learn","params":{"key":"1"}} -> 192.168.194.82 (Device: 271339092 token: 07DBA65BXXXXXXXXXXXXXXXXB47CD25D Queue: 1).

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

2021-12-06 13:12:28.977 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'Fernbedienungen' received command miIO.ir_learn {"key": "1"}

2021-12-06 13:12:28.978 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Fernbedienungen' predicted to become miIO.ir_learn {"key": "1"}

2021-12-06 13:12:28.980 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Fernbedienungen' changed from miIO.ir_read {"key": "1"} to miIO.ir_learn {"key": "1"}

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

2021-12-06 13:12:29.204 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for device 102C4E54 type: UNKNOWN, result: ["ok"], fullresponse: {"id":4655,"result":["ok"]}

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

2021-12-06 13:12:29.206 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Fernbedienungen' changed from miIO.ir_learn {"key": "1"} to {"id":4655,"result":["ok"]}