Any Support for Midea A/C?

I am looking for it too! I think I will make a reverse Engineering on the network protocol

1 Like

I too would like support for Midea wifi A/C units.

Xiaomi and Midea have paired up. I believe that it would be easier using xiaomi gateway.

http://en.miui.com/thread-120953-1-1.html

For the mobile app I read that it is unencrypted (it only encodes the password with SHA 256 in the string request).

I am also interested in some kind of control.

Midea A/C cannot be controlled via local access ( For my AC ).
It communicate with server on Internet using JSON.
I unpacked A/C controller files and find out how JSON data has been composed.
Data transmission is using builtin function which I think it should send data to server. ( I haven’t decompress app)
The key question is:
If A/C is listening from server, it will be hard to simulate.
If server is sending to A/C, it will be easier to simulate.

I can’t capture packages through the router. Dose someone else do that please?

Source code for A/C controller:


Fully commented with Chinese, Thanks to Midea’s programmers!

Ac_Msg.Js defines the protocol, comments are very helpful.

1 Like

I can try to decrypt the packages in one of the next weekends. Meanwhile, as alternative, I also ordered the Xiaomi infrared controller which may be used as an alternative.

Gents, I have implemented a control using the xiaomi Infrared gateway. Code:

customize:

script.ligar_ac_17:
  friendly_name: Ligar AC Full Auto 17º
  icon: mdi:air-conditioner

script.ligar_ac_18:
  friendly_name: Ligar AC Full Auto 18º
  icon: mdi:air-conditioner

script.ligar_ac_19:
  friendly_name: Ligar AC Full Auto 19º
  icon: mdi:air-conditioner

script.ligar_ac_20:
  friendly_name: Ligar AC Full Auto 20º
  icon: mdi:air-conditioner

script.ligar_ac_21:
  friendly_name: Ligar AC Full Auto 21º
  icon: mdi:air-conditioner

script.ligar_ac_22:
  friendly_name: Ligar AC Full Auto 22º
  icon: mdi:air-conditioner

script.ligar_ac_23:
  friendly_name: Ligar AC Full Auto 23º
  icon: mdi:air-conditioner

script.ligar_ac_24:
  friendly_name: Ligar AC Full Auto 24º
  icon: mdi:air-conditioner

script.ligar_ac_25:
  friendly_name: Ligar AC Full Auto 25º
  icon: mdi:air-conditioner

script.ligar_ac_26:
  friendly_name: Ligar AC Full Auto 26º
  icon: mdi:air-conditioner

script.ligar_ac_27:
  friendly_name: Ligar AC Full Auto 27º
  icon: mdi:air-conditioner

script.ligar_ac_28:
  friendly_name: Ligar AC Full Auto 28º
  icon: mdi:air-conditioner

script.ligar_ac_29:
  friendly_name: Ligar AC Full Auto 29º
  icon: mdi:air-conditioner

script.ligar_ac_30:
  friendly_name: Ligar AC Full Auto 30º
  icon: mdi:air-conditioner

script.desligar_ac:
  friendly_name: Desligar AC
  icon: mdi:fan-off

remote:

  • platform: xiaomi_miio
    name: “GatewayIR”
    host: 192.168.1.XXX
    token: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    slot: 1
    timeout: 30
    hidden: false
    commands:
    ac_on_17:
    command:
    - raw:Z6XHABoCAABVBgAAQxEAAGoUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAAAAAEAAAABAQEBAAEBAQMCIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAAAAAQAAAAEBAQEAAQEBAA
    ac_on_18:
    command:
    - raw:Z6XHABkCAABWBgAANhEAAFERAABrFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAAAAQEAAAABAQEAAAEBAQQDIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAAABAQAAAAEBAQAAAQEBAA
    ac_on_19:
    command:
    - raw:Z6XHABgCAABaBgAARBEAAG0UAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAABAQEAAAABAQAAAAEBAQMCIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAAEBAQAAAAEBAAAAAQEBAA
    ac_on_20:
    command:
    - raw:Z6XHABwCAABNBgAAQxEAAGgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAABAAEAAAABAQABAAEBAQMCIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAAEAAQAAAAEBAAEAAQEBAA
    ac_on_21:
    command:
    - raw:Z6XHAB8CAABHBgAANhEAAFMRAABnFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAEBAAEAAAABAAABAAEBAQQCMQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAQEAAQAAAAEAAAEAAQEBAA
    ac_on_22:
    command:
    - raw:Z6XHABoCAABVBgAANREAAFMRAABoFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAEBAQEAAAABAAAAAAEBAQQDIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAQEBAQAAAAEAAAAAAQEBAA
    ac_on_23:
    command:
    - raw:Z6XHABsCAABSBgAARBEAAGgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAAEAAQEAAAABAAEAAAEBAQMCIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAAAAQABAQAAAAEAAQAAAQEBAA
    ac_on_24:
    command:
    - raw:Z6XHABwCAABPBgAARBEAAGcUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAQEBAAEBAQMCIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAABAAAAAQAAAAABAQEAAQEBAA
    ac_on_29:
    command:
    - raw:Z6XHABoCAABWBgAANREAAFMRAABqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAQABAAEAAAAAAQABAAEBAQQDIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAABAAEAAQAAAAABAAEAAQEBAA
    ac_on_30:
    command:
    - raw:Z6XHABYCAABfBgAAGxEAAG0RAACGFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAyEAAQEAAAEAAAEAAAEBAAEAAAABAQEBAQEBAQAAAAAAAQABAQEAAAAAAQAAAAEBAQQDIQABAQAAAQAAAQAAAQEAAQAAAAEBAQEBAQEBAAAAAAABAAEBAQAAAAABAAAAAQEBAA
    ac_off:
    command:
    - raw:Z6XHABsCAABTBgAARBEAAGoUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiEAAQEAAAEAAAEAAAEBAAEAAQEBAQABAQEAAAAAAQAAAQEBAAAAAAAAAAABAQEBAQMCIQABAQAAAQAAAQAAAQEAAQABAQEBAAEBAQAAAAABAAABAQEAAAAAAAAAAAEBAQEBAA
    script:
    ligar_ac_17:
    sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_17’
      ligar_ac_18:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_18’
      ligar_ac_19:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_19’
      ligar_ac_20:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_20’
      ligar_ac_21:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_21’
      ligar_ac_22:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_22’
      ligar_ac_23:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_23’
      ligar_ac_24:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_24’
      ligar_ac_25:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_25’
      ligar_ac_26:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_26’
      ligar_ac_27:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_27’
      ligar_ac_28:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_28’
      ligar_ac_29:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_29’
      ligar_ac_30:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_on_30’
      desligar_ac:
      sequence:
    • service: remote.send_command
      entity_id: ‘remote.GatewayIR’
      data:
      command:
      - ‘ac_off’
1 Like

Would be nice wrapping this in a custom components which would make life easier but I failed with ac component for xiaomi :confused:

1 Like

My coding skills are very limited but it seems this two github repositories have useful information:

https://github.com/midea-sdk-org/ios-sdk

Do any of you have it working in HA? if so, please elaborate.

Hi, how you get this raw commands? i would like get more raw commands with different modes, because here the weather is cold and when i try the command ac_on_26 its not heating, is cooling.
Thanks for sharing.

Hello Virualdo,
That is because I have used the “automatic” temperature, meaning that your A/C may decide to cool.
I have used the xiaomi learning to create the comands. It is possible to learn the commands for heating/cooling/automatic/dry. Each command will be different.
I’d like to implement something better (with a scrool bar for the temperature) on the interface but no time to do that so far.

Hi jfamaral.
Have you used Mi home app or xiaomi_miio remote HASS component to learn commands? because learn the MIDEA raw command using Xiaomi_miio remote component generate shorter raw commands and dont works for me…

I can share you my scroll bar configuration for temperature:

input_number:
  aire_acondicionado:
    name: AC Temp
    initial: 24
    min: 17
    max: 30
    step: 1
    icon: mdi:snowflake

Automation:
- alias: AC cambia
  trigger:
    platform: state
    entity_id: input_number.aire_acondicionado
  action:
    service: script.turn_on
    entity_id: script.poner_aire

Script:
  poner_aire:
    sequence:
      - service: remote.send_command
        data_template:
          entity_id: 'remote.livingroomirremote'
          command: >
           {%if is_state("input_number.aire_acondicionado", "17.0") %} ac_on_17
           {%-elif is_state("input_number.aire_acondicionado", "18.0") %} ac_on_18
           {%-elif is_state("input_number.aire_acondicionado", "19.0") %} ac_on_19
           {%-elif is_state("input_number.aire_acondicionado", "20.0") %} ac_on_20
           {%-elif is_state("input_number.aire_acondicionado", "21.0") %} ac_on_21
           {%-elif is_state("input_number.aire_acondicionado", "22.0") %} ac_on_22
           {%-elif is_state("input_number.aire_acondicionado", "23.0") %} ac_on_23
           {%-elif is_state("input_number.aire_acondicionado", "24.0") %} ac_on_24
           {%-elif is_state("input_number.aire_acondicionado", "25.0") %} ac_on_25
           {%-elif is_state("input_number.aire_acondicionado", "26.0") %} ac_on_26
           {%-elif is_state("input_number.aire_acondicionado", "27.0") %} ac_on_27
           {%-elif is_state("input_number.aire_acondicionado", "28.0") %} ac_on_28
           {%-elif is_state("input_number.aire_acondicionado", "29.0") %} ac_on_29
           {%-elif is_state("input_number.aire_acondicionado", "30.0") %} ac_on_30
           {% endif %}
1 Like

Buenos dias VIrualdo.
I have used the learning feature inside hassio.
I can try to learn the commands and then share them with you.
You need all the temperatures for heating and cooling, right?
João

Bom dia Joao

No, i just need from 17 to 24 for cooling and from 24 to 30 for heating.
Thanks!

Hello Virualdo:

Have a look:
https://github.com/vpnmaster/homeassistant-custom-components/blob/master/broadlink_climate_codes/midea.ini

1 Like

Hi, I have an air midea, with the wifi module. I would like to use it with home assistant, so I read it can not be true?

Is it possible to get it one day, or is it not worth it and must it be controlled by infrared?

1 Like

I have a Midea ac and use a broadlink rm mini 3 to control it I used the following custom component. I Purchased the broadlink ir rm3 mini. $25AUD. It works great to control all your ir remotes. It will capture the commands so u can use them as switches. Great device it really made my smart home complete. ( sound like an advert ha )

https://github.com/vpnmaster/homeassistant-custom-components

1 Like

I’m fairly new to Home Assistant, can you tell how you configured for it to work with the AC?
Did the Broadlink had to “learn” the commands or just setting up as mentioned in the github is enough?
I’m thinking about buying a couple of broadlinks if they’re not that hard to setup :pensive:

The one from GitHub worked for me. I ended up adding the fan mode to it, should add that to that repository if I remember.

Hello Callifo.
How have you integrated this with hass.io?
Can you share?
Thanks.