Xiaomi Remote Learning & Sending Commands for AC

I think you got Xiaomi Remote 2nd Edition, so I recommend you use raw, I set up from Home Assistant Integration Manual

I wish you succeed this setup

Thanks @minsuke that’s the guide I have followed with no luck :frowning:

should be “command”, not “comand”.

edit: my reply was to the error “failed to call service remote/send_command. required key not provided @ data[‘comand’]”

Hello @clyra, @minsuke let me summaries;

I am trying to connect my Mitsubishi AC (and LG TV but not main focus). I have used the integration @minsuke listed above (and advise here) to try and complete this setup;

remote.xiaomi_miio_learn_command
This command was used inside HA ‘Developer Tools’ > 'Services to learn the raw codes below.
Note: pronto hex codes were found online for a closely matching AC model for triail only.

configuration.yaml

logger:
  default: warn
  logs:
    homeassistant.components.remote.mi_remote: debug

# XIAOMI MI REMOTE v2:
remote:
  - platform: xiaomi_miio
    name: mi_remote
    host: 192.168.x.xxx
    token: <token>
    commands:
      ac_turn_off:
        command: 
          - raw:mc0mMwlkxm0ymEsmk2AIKZAGkARkzm4A/gQeAx4IXgM+Bl4GXgM+Az4EPgMeAx4DHgD+AP4A/gDpOQBymgC/gD+AP4A/gD+AP4A/gD+Gx4EHgD+Bx4HHgD+AOUAA
      tv_turn_off:
        command: 
          - raw:nMwm8wlk0mkzmEsm0ymEsmswAHaYgDrMZsAQwDEAD+APwGEAc+Az4BHgaeAP4EHhUcAPAFHgEeBF4BHgEbMIAA==

script.yaml

ac_turn_off:
  alias: Turn off AC
  sequence:
  - service: remote.send_command
    entity_id: 'remote.mi_remote' 
    data:
      command:
        - 'ac_turn_off'
        
tv_turn_off:
  alias: Turn off AC
  sequence:
  - service: remote.send_command
    entity_id: 'remote.mi_remote' 
    data:
      command:
        - 'tv_turn_off'

off_test2:
  alias: Test remote 2
  sequence:
  - service: remote.send_command
    entity_id: 'remote.mi_remote' 
    data:
      command:
        - raw:mc0mMwlkxm0ymEsmk2AIKZAGkARkzm4A/gQeAx4IXgM+Bl4GXgM+Az4EPgMeAx4DHgD+AP4A/gDpOQBymgC/gD+AP4A/gD+AP4A/gD+Gx4EHgD+Bx4HHgD+AOUAA
        
off_test3:
  alias: Test Remote 3
  sequence:
  - service: remote.send_command
    entity_id: 'remote.mi_remote' 
    data:
      command:
        - pronto:0000 006C 0000 006A 0000 004C 0000 001C 0000 001C 0000 001C 0000 001C 0000 004B 0000 001C 0000 001C 0000 004B 0000 004B 0000 004B 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 004B 0000 001C 0000 001C 0000 001C 0000 004B 0000 004B 0000 001C 0000 001C 0000 004B 0000 004B 0000 004B 0000 004B 0000 004B 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 0169 0000 004C 0000 001C 0000 001C 0000 001C 0000 001C 0000 004B 0000 001C 0000 001C 0000 004B 0000 004B 0000 004B 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 004B 0000 001C 0000 001C 0000 001C 0000 004B 0000 004B 0000 001C 0000 001C 0000 004B 0000 004B 0000 004B 0000 004B 0000 004B 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 001C 0000 0192

entity-button error:: There is no error when i call scripts.

entity-button

entity: remote.mi_remote
hold_action:
  action: more-info
name: Turn Off AC
show_icon: true
show_name: true
tap_action:
  action: call-service
  service: remote.send_command
  data:
    command:
      - ac_turn_off
type: entity-button

entity-button error:

failed to call service remote/send_command. required key not provided @ data[‘command’]

hm… I may have made a wrong assumption. When you call the script directly (using developers tools) it works, but using the entity button not? If the later, maybe the entity button has a bug. I dont use to use entity button as I use hadashboard to build my remotes.

I have played around with it more.

TV works by calling the script.
AC does NOT work calling script. I am assuming this is a problem with the raw code, not sure how to resolve this…

After doing some more testing today, I have use the learn command while sending the instruction from the Mi Home App which correctly activated the AC unit as well as receiving the command inside HA.

My assumption is the AC unit takes multiple commands for example when on turning on the following is set;
Turn On / Temperature = 20deg / Auto = On / Mode = Heating.

My assumption is that “/” splits those commands? (I could be wrong, I havn’t researched it yet).

example learnings

mc0nMwlkxm04mEsAISZTQAjpmAyc2ADKZAH1MwIDAMIBjwGMmMyAROagBlMQU7AUOYADqBkgDFzGZAXGCIU0CG8I/wdoAYgFRACzBtwBhwhqCocGNwD4AjMA9wpXA3oGDwR/BH8EfwR8EW8BjwYPFh8XrwKPB58YDwQGCS+YzCAA

mc1mMwlkxm04mEsmgAZTGZTUAgpyAQc0AIWZgMnMwAyAPsCmAGPAYuYzIBUppNgAymQKfgVGAx4BEgOnMAj/CP8HZwGPAY8BjwqJBjcA9AqjAPMG4xECCl8EfwR/BHgA9wR/BH8KjwGPBg8GCxFEC1gCjw0aBZUHpwNCmMym4GPiB/MIAA==

I did try splitting them into individual commands no luck, maybe this is an integration limitation?

Good that your TV is now working. I don’t know how to fix the AC unit, but for the entity button why not call the script instead?

@Infineghost yes thanks finally got something working. Since the primary reason was for AC control I am thinking only solution is to go Logitech harmony hub.

Agree the script can be called from entity-button.

Just wish I could get the AC control working.

I’ve read something only about your AC in the following link Reverse engineering the Mitsubishi AC Infrared protocol.

Maybe you can do something with that, seems that the complete settings got send with every command.

Yes you are correct, I did see this project a while back but didn’t have enough time to decipher how to convert this into a raw code…

Unfortunately this was one of the last pieces to do before by wife gives birth and I have just ran out of time to keep working on this. I’ve conceded and bought a Harmony Hub.

Negative Point:

  • Cost AUD$120
  • I have to learn alot of commands, as Logitech don’t have this stored. (as you mentioned every instruction sends all instructions to the AC)

Positive Point:

  • HA configuration is super easy and all commands are imported.
  • I will make scripts to easily call each instruction.
  • Tested and it’s working!!!

I may come back to this later post baby. I appreciate help from @Infineghost @clyra @minsuke.

1 Like

My projector have same crazy ir encode. I try capture raw and I receive different codes for the same button (tv remote works fine). I find pronto code but not work. Can you help me?

commands:
  projector_turn_off:
    command:
      - pronto:0000 006d 0010 0011 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 003c 0014 003c 0014 0014 0014 0014 0014 003c 0014 003c 0014 003c 0014 0014 0014 0014 0014 003c 0014 003c 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 0014 02e6:3

I have the same problem. Did you solve it?

No, but i have idea throught xiaomi home app works good, i bought another Xiaomi IR blaster (waiting for transport) and i will try transmit code from one ir blaster from Mi home app to another connected to Home Assistant. Maybe also it will works with universal IR remote.

Hi!
any news?

Hi All,

I am having the same problem. My Xiaomi remote is configured and working for other devices, but not my A/C.

I got the raw commands using the service: xiaomi_miio.remote_learn_command
Config:

remote:    
  - platform: xiaomi_miio
    host: 10.1.1.47
    name: bedroom_remote
    token: !secret xiaomi_remote_token
    slot: 1
    timeout: 30
    hidden: false
    commands:
      ac_on:
        command:
          - raw:mc0mswlkxm8ymEsmk0ADKYABlMQECmYAhTSZzCWTOcgILNAIDAH8AfwB/AH8AegYFAY8AfwB/BA8KrJjMgqzDEILPwa/AH8AfwB/AH8AfwB/AH8AfwB/AH8AfwB/AH8Afw+OEasd9AECHncDGoAA
      ac_off:
        command:
          - raw:mc0mswlkxm8ymEsmkzADKYABlMQECmYAhAIXNAIDAH8AfwB/AH8AegYPAg8AfwB/BAmYzKcgpeClwDCgh+AP4A/gD+AP4A/gD+AP4A/gD+AP4A/gD+AP4A/iR+BD4A/wAA==

script:

panasonic_ac_off:
  sequence:
    - service: remote.send_command
      entity_id: remote.xiaomi_miio_10_1_1_47
      data:
        command:
          - 'ac_off'

panasonic_ac_on:
  sequence:
    - service: remote.send_command
      entity_id: remote.xiaomi_miio_10_1_1_47
      data:
        command:
          - 'ac_on'

I am having the exact same issue.
i have configured my Android Box, Tv, speakers and all with no issue what so ever.
and the AC unit is giving me a headache.
it works fine in the mi home app, and i learn the command, it just wont send.
i did a little research and the thing is that the AC units send more complex codes with their remotes.
it basically sends 3 or 4 different parameters in one command. but i don’t have a clue on what to do with that information not why it doesn’t work.
so if anyone does have a clue on how to resolve this please be kind to post.

Hi, this is my first post here so Hello Everybody,
I’m fighting with Xiaomi Universal Remote during last week and below are my findings:

  • Important is to check which version Xiaomi IR Remote you have. According to https://www.home-assistant.io/integrations/remote.xiaomi_miio Pronto codes works only with chuangmi.ir.v2 - I have chuangmi.remote.v2 and I received error message when I tried to use Pronto codes.Maybe this will save time for some people which I lost.

  • Token. The easiest way is to install BlueStack (android emulator in PC) and install MI Home 5.4.38. In that version token is available under Remote Control -> three dots -> General Settings -> Network Info. You don’t need search it in internal database, logs or whatever. It is inside the app!

  • I tried to record IR codes using MI Home and find them in logs in the android folder: /data/data/com.xiaomi.smarthome/files/IR_REMOTE_DID_device.json but I couldn’t find them. In many places people mentioned that they should be located in that folder, but I tried to use different version of MI Home like : 5.0.19 and some older with without luck.

  • I found also one weird issue. I tried to record IR codes using MI Home from my A/C remote, I created new device inside the app, but when I tried to turn on/ turn off the device it didn’t work. Air Con created by Mi Home settings working fine. Why ?

  • I have remote Haier V9014557

i have a mitsubishi heavy AC unit, and i cannot get the Xiaomi remote to work with it. i have the Mi remote connected to Home assistant, and i can leave codes by XIAOMI_MIIO.REMOTE_LEARN_COMMAND. i can also control other devices at home with the RAW learned, but i just cant control my AC.

even for the same action on turning on or off my AC with the same settings, the RAW comes back differently each time.

have read some projects on github focusing on decoding AC remote codes, it seems to be a pretty complicated protocol and im not sure about how to translate that into the base64 “raw” code of this plugin.

reference:

https://irforum.analysir.com/viewtopic.php?f=5&t=593

https://github.com/ToniA/arduino-heatpumpir