Any Support for Midea A/C?

I have the same problem. Can’t control my AC from HA. Android apps (NetHome Plus and Midea Air) works locally only if I am connected to home WiFi

Same error here.

how do I get the api key? is it generic? reading is fundamental

1 Like

I got tired of their server going down so I replaced the WiFi dongle with a Zigbee CC2531 dongle from China.

It’s pretty hacky but if there is interest I could try to get it up on GitHub.

4 Likes

Yes, yes please! :slight_smile:

I have an OlympiaSplendid system from Italy that is basically a Media A/C. Apps are the same and IIRC correctly, somewhere inside I saw a sign from Media.

Long story short, I don’t like it to need the Internet to control my a/c, so I want to do that local. I haven’t investigated myself, because my idea was to simulate something like the Midea server.

But if it works with a CC2531, that would be AWESOME! :smiley:

hello everyone, you can try my project.
This is a library to allow communicating to a Midea AC via the Local area network.


and This is a custom component for Home Assistant to integrate the Midea Air Conditioners via the Local area network.
4 Likes

YOU @mac_zhou , are my official hero of the month! :slight_smile: Thank you so much, this is exactly what I needed! :slight_smile: I installed it, works great, not one hickup during installation or first tries!

Thanks a lot, really, you made my day (and my wifes and dogs)! I just made a small donation via PayPal, I’m sorry it’s not more, I hope situation gets more comforting over the year, than I’ll def. make another one! :slight_smile:

Thank you! :slight_smile:

1 Like

Yes :slight_smile: At last I can control my devices with HA- automations, scripts, conditions etc!
Timing is always awful for me it seems (Murphys Law I guess) - just a week ago finished a clean install of workaround (both hardware with WAF and software) - and a super one-works also like a treat:
Midea IR MQTT
So now I have 2 working instances and my little home is a little more smarter!
Keep on going…
BTW as with cloud do not change settings too frequently- may temporarily get out of sync- max 5 seconds…
And another- get Your device ID in decimal not HEX…
Best, JR

Hi paddy 0174, i am not sure how to got the deviceID can you plase provide some info aboute it?

Sure, no problem. :slight_smile: In my case, I’m on android, so these are the steps:

  1. Install the OlimpiaSplendid or Midea app on your android phone.
  2. Get your account with Midea or OlimpiaSplendid.
  3. Setup the app, so it works with your A/C. Check if you can control your A/C with the app. That’s important, as sometimes the app won’t work with your A/C and you have to try another app (there are a few out there :wink: ) Leave the app open on your phone.
  4. Get adbLink for your computer. Every AndroidDebugBridge will do. You can use the full package from Google (adb is included in the full SDK package). or other tools. As I said, for me the small and easy package adbLink does the trick.
  5. Open adbLink on your computer.
  6. Open the settings on your phone and search, where your system info is stored. There you look for “Build-number”. This will likely take you a while, as every manufacturer has it’s own idea, where to put that build number. Nevertheless every android phone (tablet/tv) has this, so if you don’t find it on the first run, look again, it is somewhere. Push the build number seven times, it will tell you something “only 3 times and you are a developer”, “only 2 times and you are a developer”… In the end it will tell you, you are a developer now and you can use the developer settings.
  7. Go into the new “developer settings”, this as well is somewhere in your settings, but where depends on the manufacturer. You will find it. Enable “USB-Debugging”.
  8. Connect your phone with an usb cable to your computer. If it is the first time you connect it, there will be a popup on your phone right away. Check the box in this popup and allow it.
  9. In adbLink there is a button “ADB Shell”. Click it.
  10. A new terminal window should open, there you paste in logcat | grep -i deviceid and press enter. The log should show instantly and there you can find the deviceid.
  11. Copy the deviceid and close adbLink, the app on your phone, the settings, you get the idea. :slight_smile:

Hope this is detailed enough, if not, let me know. :slight_smile:

1 Like

@paddy0174, excellent and very detailed procedure, thanks alot for your effort.

Will it be available in HACS too??
And how to get the device ID in iOS??
Is it the same as the terminal barcode?

If I may jump in. :slight_smile: The first steps for HACS are already visible in the repository, I’m sure, it will happen in the near future. :slight_smile:

I don’t know iOS, as I don’t own an apple device. My recommendation in these cases is normally: get an android phone from a friend, and get the necessary data that way. In most cases you’re done with the whole setup in less than ten minutes, so not a big deal. :slight_smile: Android seems way easier with all that stuff. Or you can get an android phone on Aliexpress for less than $20. :slight_smile:

I know, it’s not the ideal help, sorry… :wink:

On the other hand, the instructions don’t sound to complicated? Do you have a mac?

Did it work for you? :slight_smile:

Hmm, Im I the only one unable to see any deviceid when using adb?
I did however run a wireshark session and captured “SessionId” but that just result in an error in HA

File "/usr/local/lib/python3.7/site-packages/msmart/command.py", line 129, in power_state return (self.data[0x01] & 0x1) > 0 IndexError: bytearray index out of range 2020-05-23 09:38:28 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.midea_4c1e00000010 fails

@paddy0174, yes i manage to find out the deviceID following you procedure, but I am not able to control the A/C from home assistant i got some timeout error on the home assistant log
timed out Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1288, in _execute_service await handler.func(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service self._platforms.values(), func, call, required_features File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 453, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 597, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 484, in _handle_entity_call await result File "/config/custom_components/midea/climate.py", line 263, in async_set_hvac_mode await self.apply_changes() File "/config/custom_components/midea/climate.py", line 95, in apply_changes await self.hass.async_add_executor_job(self._device.apply) File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.7/site-packages/msmart/device.py", line 192, in apply data = self._lan_service.appliance_transparent_send(data) File "/usr/local/lib/python3.7/site-packages/msmart/lan.py", line 63, in appliance_transparent_send response = bytearray(self.request(data))[40:88] File "/usr/local/lib/python3.7/site-packages/msmart/lan.py", line 38, in request response = sock.recv(256) socket.timeout: timed out
.
@yodi, try the following, during the adb logcat the A/C should be ON using the A/C application, and the app should be open in the phone.

I did manage to get deviceid using another phone and tapping “share” that shows the qr code, but it was the same id as seen with Wireshark so im also stuck since it wont work :frowning:

Some easiest steps to install:

  1. install msmart: pip install msmart
  2. Save this .py script and run (fill in Your AC IP):
from msmart.device import air_conditioning_device as ac
from msmart.device import device as midea_device
device_ip = '192.168.1.xx'
device_id ='17592186057450'


client = midea_device(device_ip, int(device_id))
device = client.setup()

#get AC info
device.refresh()    
print({
    'id': device.id,
    'power_state': device.power_state,
    'audible_feedback': device.prompt_tone,
    'target_temperature': device.target_temperature,
    'operational_mode': device.operational_mode,
    'fan_speed': device.fan_speed,
    'swing_mode': device.swing_mode,
    'eco_mode': device.eco_mode,
    'turbo_mode': device.turbo_mode,
    'indoor_temperature': device.indoor_temperature,
    'outdoor_temperature': device.outdoor_temperature
    })

# Set the state of the device and test
#device.power_state = True
#device.prompt_tone = False
#device.target_temperature = 18
#device.operational_mode = ac.operational_mode_enum.heat
#device.fan_speed = ac.fan_speed_enum.Auto
#device.swing_mode = ac.swing_mode_enum.Off
#device.eco_mode = False
#device.turbo_mode = False
#device.apply()
  1. You get device_id but it is in HEX, convert to DEC online (weekend and I have not even 5 mins :frowning: )
    because HA plugin uses DEC id…
  2. To test functions fill in Your DEC_id and uncomment at the end and read responses
  3. If all works add custom_component and Lovelace climate card- enjoy!
  4. With my Midea Mission II R32 there are some temperature bugs and temporary dropouts, try to figure out next week.
    Hope this helps someone, JR
    Edited as I did not know that device_id had to be of certain length (14 numbers, random at test run, then Yours)- I just typed random beforehand :frowning:
1 Like

Thanks for the reply but it just timeout, so I guess its not understanding the payload/data as it should for some reason, let me know if you want me to capture some data between the Mobile App and the Midea AC and if so what commands you want me to run from the App

DEBUG:msmart.packet_builder:Finalize request data: ab40ac00000000000003410000ff03ff00020..... INFO:msmart.lan:Sending to 172.16.0.83:6444 5a5a01116900200000000000000000000000000072210..... INFO:msmart.lan:Connect the Device 172.16.0.83:6444 TimeOut. Traceback (most recent call last): File "C:\temp\md.py", line 12, in <module> device.refresh() File "C:\Users\micke\AppData\Local\Programs\Python\Python38\lib\site-packages\msmart\device.py", line 173, in refresh data = self._lan_service.appliance_transparent_send(data) File "C:\Users\micke\AppData\Local\Programs\Python\Python38\lib\site-packages\msmart\lan.py", line 69, in appliance_transparent_send response = bytearray(self.request(data))[40:88] TypeError: cannot convert 'NoneType' object to bytearray

Yep it should do so as You have already an active connection to Your AC- Midea allows only 1 AFAIK :frowning: My bad again- this is not the case with LAN connection, this problem was with Midea cloud- app and HA did not work at the same time…
And I see that You already have climate.midea_4c1e00000010 is it Yours or where did You get it? If it is Yours convert it to dec and test with HA.
Best, JR
My bad- seems that msmart needs appropriate length of device_id at startup :slight_smile:
Try something like device_id = '17592186057450' , length is cruical :frowning: