Any Support for Midea A/C?

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.

A known implementation is done in Ruby:

Documented and explained. Shows how to interact with Midea’s server (https://mapp.appsmb.com/v1) and the way the the ar condictioner midea commands are generated and how they are encrypted as if we had a known API.
I would be seeking advice on how to convert this to Python.

I’ve used the Broadlink IR climate component as mentioned by cheynespc above. Mine appears to be ancient so does not support any IP interface.

Hi there!

I’ve had limited success making a ruby “server” app from the midea-air-condition gem. I made a new app that would listen to commands from Home Assistant over MQTT using the MQTT-HVAC component. It worked well, until a change in the Midea cloud service messed with it and on top of that it was quite difficult to manage, I had to run the server on a separate machine due to the lack of ruby on Hassio (And adding Ruby to Hassio is beyond my skillset).

After a long time of fiddling with ruby and this API, I started porting the code to Python, and in the last week I got pretty far.
Currently I have the following parts working:

  • Logging in
  • Listing devices
  • Sending a transparent status request to the device (Air Conditioner) and receiving the response

What’s remaining is the parts to decode the raw data from the AC into a nice usable class object and the classes to build the “Set” commands in order to change the operation of the AC.

The whole protocol and the way encryption works is particularly horrible, but it is working!
Its not very pretty yet, but I’m still working on it, and I will be converting the code into a home assistant plugin once it’s all there.

The code is currently on my github account: https://github.com/NeoAcheron/midea-ac-py

You are welcome to use this as you please! Happy hacking! :grin:

4 Likes

I just added the device data decoding class. It was quite simple to convert to Python, and I made it part of the main example. I will see if I can do the rest in this week, and feedback here if there is success.

1 Like

I’ll set myself to test it along the week. Once you have finished the first complete set I am up to buy you a coffee :slight_smile:

1 Like

Does this works with OSK102 module and “Nethome Plus” (https://play.google.com/store/apps/details?id=com.midea.aircondition) and “Midea Air” (https://play.google.com/store/apps/details?id=com.midea.aircondition.obm&rdid=com.midea.aircondition.obm) apps?

How can I help?

1 Like

Hi there pniaps,

Yes, it works with the OSK102 module. I have a Carrier AC with the module in, and it works with the Nethome Plus app, the Carrier app, and a whole bunch of other rebranded apps for vendors that use the same WiFi module.

I’m in the process of neatening things up, if things go well I will push it tonight and have a component ready for Home Assistant tomorrow evening.

I’m going to need a list of supported AC vendors (and possibly models) in order to make decent documentation once its working in HA.

On a side note, I’ve been trying to capture local packet data when the Carrier app communicates locally, but without success. I wouldn’t mind some help there, my router is not allowing me to capture the packets I need to decode that local protocol. It would make the set up a lot faster, the cloud services are horribly slow.

2 Likes

I can try to capture some packets. Exactly which Carrier app has local control? I have an ECOX unit but I assume it won’t care.

I’m using this one https://play.google.com/store/apps/details?id=com.midea.carrier

It’s noticeably faster than the cloud API when selecting a temperature or a mode. It was updated recently, I think that faster control was added recently, it used to be as slow as the cloud service. I did see UDP broadcasts made by the app to port 6445, but I wasn’t able to decipher them. There has to be something I’m not seeing.

In the meantime, I’m busy creating the component for HA. It’s the first time I’m creating one, and my internet connection is limited at the moment due to a fibre break in the area, so things are going more slowly than I would have hoped…

Hi everyone!

Great news, I have a working component in Home Assistant with full control via my library. You can get instruction on how to use it at the moment.

I’m going to need some advice on the dependency resolution in HA, its weird and doesn’t seem to be working for me. I’m missing something, and its not clear what.

As a workaround though, simply copying the dependencies into the config/deps/ directory, seems to do the trick.

Please let me know your thoughts! Its been a busy few days, but I think it has paid off! :smiley:

Thanks!

I am seeing an error. I think I set it up properly, but maybe not.

2018-12-02 13:05:55 ERROR (MainThread) [homeassistant.components.climate] Error while setting up platform midea
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant-0.84.0.dev0- py3.5.egg/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.5/asyncio/tasks.py", line 400, in wait_for
    return fut.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/root/.homeassistant/custom_components/climate/midea.py", line 41, in async_setup_platform
    from midea.client import client
  File "/root/.homeassistant/deps/lib/python3.5/site-packages/midea/client.py", line 16
    self._devices: Dict[str, device] = {}
                 ^
SyntaxError: invalid syntax

Thank you for your efforts to create this component, Hi tested this using hassio 0.83.2 , i get the following error :

Error while setting up platform midea
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/local/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/config/custom_components/climate/midea.py”, line 50, in async_setup_platform
entities = [MideaClimateDevice(device, temp_step) for device in devices]
File “/config/custom_components/climate/midea.py”, line 50, in
entities = [MideaClimateDevice(device, temp_step) for device in devices]
File “/config/custom_components/climate/midea.py”, line 66, in init
device.refresh()
File “/config/deps/lib/python3.6/site-packages/midea/device.py”, line 82, in refresh
self.update(response)
File “/config/deps/lib/python3.6/site-packages/midea/device.py”, line 108, in update
self._swing_mode = swing_mode_enum(res.swing_mode)
File “/usr/local/lib/python3.6/enum.py”, line 291, in call
return cls.new(cls, value)
File “/usr/local/lib/python3.6/enum.py”, line 533, in new
return cls.missing(value)
File “/usr/local/lib/python3.6/enum.py”, line 546, in missing
raise ValueError(“%r is not a valid %s” % (value, cls.name))
ValueError: 48 is not a valid swing_mode_enum

any thoughts ?

It seems that your AC has swing modes that’s not in the library. Mine only supports a vertical swing mode at one speed.

If you look at the midea/device.py the swing_mode_enum has only two values at the moment, if you wish you can add another value with 48, or 0x30

I’ll try looking for all possible values in the decompiled APK later this week.

The Python version you are using is newer than mine (3.5.3) but with a few changes it is working now.

i figured this out , the app and the aircon i am using (invmate ii) has a button for horizontal swing i will look how can i circumvent this, thank you for your great work.

can you please tell me what changes you did ?