Any Support for Midea A/C?

@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:

Could somebody help me out here. Im trying to get the device_id for my airco unit so that I can use it with hassio.
As im using an iPhone and MacBook, I figured to use a console window to log the activity of the iPhone which works but If I filter for device id or applianceid for all message with Midea in it I get nothing.

Do I need to do something different hereā€¦

If anybody could help me, that would be much appreciated.

Thanks

1 Like

I had to tap Share device (or similar) using Midea App for it to show up in the log on Android.

05-23 13:03:38.178 5939 5939 W ShareDeviceActivity: jsObject=={"userId":"123123","deviceId":"12345678912345"};

I missed that, but that souds great!

During Corona timeā€¦ Iā€™m not seeing anyoneā€¦ :wink: so getting a device from a friend will be a hassleā€¦

And the Aliexpress idea is a good oneā€¦ but you know also that I can than try in 2 months or so :wink: :smiley:
Iā€™m thinking to use the android emulator softwareā€¦

And yes, I own a Mac, did I miss an option for that one??

But I dont see any of that no userid no device even after tapping share device in de Midea App.
When I filter messages to show userid, device or applianceid I get zero messages

Iā€™m glad to have helped.
Youā€™re too enthusiastic.
Thank you for your sponsorship.

hello everyone, it is available in HACS now.
Attention: In order not to conflict with the @andersonshatch Integrations (a library to allow communicating to a Midea appliance via the Midea cloud), please search the HACS Store for midea_ac

Iā€™m getting this error when adding midea_ac from HACS store (it worked when I manualy added component)

Platform error climate.midea_ac - cannot import name 'ClimateEntity' from 'homeassistant.components.climate' (/usr/src/homeassistant/homeassistant/components/climate/__init__.py)

you must update home assistant version >= 0.110.2

Thankā€™s gonna try, just waiting for some addons to be updated for 0.110

Hi, great news on the local library. Does this support simple dehumidifiers as well as full AC units ?

My mistake, Fallback now, you can try it .
there is warning log in the new version(0.102.2), but it is better to let more people use it.
the new version is 411e9e3

support the old version AC device.
I do not know how to confirm device use old version local protocol, the only way is you need to try.

@mac_zhou How to get the device_id?
Iā€™m using ios and macos.

I did a terminal to the ios device, filter on deviceid, device-id, device_id. no results.

Please help ā€œusā€

you can try filter applianceId and please see the readme file https://github.com/mac-zhou/midea-ac-py/blob/411e9e3f1ea9bae7683ff781b7e98c10a5f9c260/README.md

I have no more ways to get applianceId or device_id.
iā€™m in china and use ā€œē¾Žēš„ē¾Žå±…ā€ app.

It workā€™s now, but I have a strange issueā€¦
If I turn on AC on ā€˜AUTOā€™, i cannot switch modes (cool, dry, heatā€¦) Also cannot turn device off.
Same thing if I star ac on any different mode. It does turn on, but cannot switch modes.

1 Like