Any Support for Midea A/C?

Hi,

Does anyone have the issue where the midea python module automaticaly turns your AC on every X mintues on 17 degrees and in fan-mode?
it seems that when my AC is OFF, and the python module tries to read it out, the midea cloud returns 17 degrees, fanmode, ON as “default” by which the python module actualy activates this mode because it thinks it’s already in that state.

Kind off ruins everything for me …

Any help would be appreciated!

Kind regards

Hi Josh!

Your fork works great and does not turn on AC every 60 second however it does not update state if you turn on AC with remote or app.
Great work!

1 Like

I have 3 Midea Blanc A/Cs in the house with wifi modules. They seem to be slightly different models.
I can confirm that after adding the HACS integration to my hass.io setup on RPI3B+ I get similar initial results - the A/C in the living room was already started with remote however in HA it is not shown as active while in the Midea app it shows up properly (I’m using this app: https://play.google.com/store/apps/details?id=com.midea.aircondition.obm).

For the A/C in the office I had to do a new pairing via the Midea app and after this was done it went from unavailable to showing the external temperature properly (the other 2 A/Cs are just showing 17 C).

I would be happy to do some more testing to make this work better, more reliable.

One thing I’m missing from HA is the ECO button (this is available in the app and on the remotes as well for all 3 systems), I usually run the A/Cs set to 24 C and ECO enabled when cooling the house.

Edit: while writing this post I lost control of the office A/C as well… I’m new to HA but I’m open to any suggestions on how to make this work!

Edit2: correction, I did not loose control, rather the command to turn it on took much longer than expected - by the time I finished my first edit the office A/C started up. Now I turned it off and it takes more than 10 seconds for the command to go through! Compared to the IR remote and the app this is more than I expected!

This is in my config file:

logger:
  default: info
  logs:
    midea: debug
climate:
  platform: midea
  app_key: 3742e9e5842d4ad59c2db887e12449f9
  username: [email protected]
  password: ZZZ

This seems to be looping in the log:

2019-08-20 19:28:40 WARNING (MainThread) [homeassistant.components.climate] Updating midea climate took longer than the scheduled update interval 0:01:00
2019-08-20 19:28:42 DEBUG (SyncWorker_17) [midea.cloud] Error ignored: '3176' - 'The asyn reply does not exist '
2019-08-20 19:28:42 DEBUG (SyncWorker_17) [midea.cloud] Retrying API call: 'appliance/transparent/send'
2019-08-20 19:28:42 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.midea_1XXXXXXXXXXXX1 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 249, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 417, in async_device_update
    await self.async_update()
  File "/config/custom_components/midea/climate.py", line 111, in async_update
    await self.hass.async_add_executor_job(self._device.refresh)
  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/midea/device.py", line 146, in refresh
    data = self._cloud_service.appliance_transparent_send(self.id, data)
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 173, in appliance_transparent_send
    'applianceId': id
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 93, in api_request
    return self.api_request(endpoint, args)
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 93, in api_request
    return self.api_request(endpoint, args)
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 95, in api_request
    raise RecursionError()
RecursionError
2019-08-20 19:29:41 DEBUG (SyncWorker_10) [midea.cloud] Sending to 1XXXXXXXXXXXX1: 5a5a01115700200000000000000000000e031214c679000000050a00000000000000000002000000aa1eac00000000000302408100ff03ff00300000000000000000000003bb8100000000000000000000000000000000
2019-08-20 19:29:41 DEBUG (SyncWorker_6) [midea.cloud] Sending to 1XXXXXXXXXXXX3: 5a5a01115700200000000000000000000e031214c679000000050a00000000000000000002000000aa1eac00000000000302408100ff03ff00300000000000000000000003bb8100000000000000000000000000000000
2019-08-20 19:29:41 DEBUG (SyncWorker_18) [midea.cloud] Sending to 1XXXXXXXXXXXX8: 5a5a01115700200000000000000000000e031214c679000000050a00000000000000000002000000aa1eac00000000000302408100ff03ff00300000000000000000000003bb8100000000000000000000000000000000
2019-08-20 19:29:51 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.midea_1XXXXXXXXXXXX1 is taking over 10 seconds
2019-08-20 19:29:51 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.midea_1XXXXXXXXXXXX3 is taking over 10 seconds
2019-08-20 19:29:51 WARNING (MainThread) [homeassistant.helpers.entity] Update of climate.midea_1XXXXXXXXXXXX8 is taking over 10 seconds
2019-08-20 19:29:52 DEBUG (SyncWorker_18) [midea.cloud] Error ignored: '3176' - 'The asyn reply does not exist '
2019-08-20 19:29:52 DEBUG (SyncWorker_18) [midea.cloud] Retrying API call: 'appliance/transparent/send'
2019-08-20 19:29:52 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.midea_1XXXXXXXXXXXX8 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 249, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 417, in async_device_update
    await self.async_update()
  File "/config/custom_components/midea/climate.py", line 111, in async_update
    await self.hass.async_add_executor_job(self._device.refresh)
  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/midea/device.py", line 146, in refresh
    data = self._cloud_service.appliance_transparent_send(self.id, data)
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 173, in appliance_transparent_send
    'applianceId': id
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 95, in api_request
    raise RecursionError()
RecursionError

I’ve got a router with OpenWrt and I installed tcpdump on it.
I connected one of the ACs and my Android phone via its WiFi signal and started looking at packet captures.

What I’m seeing is that the phone and the AC are communicating with each other, the port used by the AC is TCP 6444 and UDP 6445, the port used by the Android application is TCP 43160 and UDP 48880.

There seem to be 2 sessions, there is 2-way communication between AC:6444 and phone:43160 and one-way communication between AC:6445 and phone:48880 so I’m assuming that the first is the control channel while the second is providing status updates.

Also initially AC:6445 tries to talk to phone:42041 but that does not seem to work.

The AC is also talking to the Midea servers hosted at Amazon Web Services, the source port from AC is TCP 1025, the cloud servers are listening on destination port TCP 28870.

I’ll try to find some time in the coming days to do a full packet capture after a power cut.

1 Like

Hi,

I have updated mine to use @andersonshatch version on Github and it is working pretty good.
In the past with @NeoAcheron version I would have to reload the instance every day as after a couple hours it will hang the state and any command will not do anything.

The only issue I have at this moment is that it seems the library is not prepared for the device to be offline as it will raise an error:

2019-09-10 11:42:06 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.midea_xxxxxxxxxxxxxxx fails
Traceback (most recent call last):
   File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
     await self.async_device_update()
   File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 439, in async_device_update
     await self.async_update()
   File "/home/homeassistant/.homeassistant/custom_components/midea/climate.py", line 111, in async_update
     await self.hass.async_add_executor_job(self._device.refresh)
   File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
   File "/srv/homeassistant/lib/python3.6/site-packages/midea/device.py", line 146, in refresh
     data = self._cloud_service.appliance_transparent_send(self.id, data)
   File "/srv/homeassistant/lib/python3.6/site-packages/midea/cloud.py", line 173, in appliance_transparent_send
     'applianceId': id
   File "/srv/homeassistant/lib/python3.6/site-packages/midea/cloud.py", line 88, in api_request
     self.handle_api_error(int(response['errorCode']), response['msg'])
   File "/srv/homeassistant/lib/python3.6/site-packages/midea/cloud.py", line 224, in handle_api_error
     handler()
   File "/srv/homeassistant/lib/python3.6/site-packages/midea/cloud.py", line 209, in throw
     raise ValueError(error_code, message)
 ValueError: (3123, 'the appliance is off line.')

Maybe it should just generate a WARNING that the device is offline.

Sounds great.
So, you don’t have “use_fan_only_workaround: true” configured?
And does it update the state? (So, for example when you set something with the IR remote control, does HA reflect the changes in the state?)

No workaround, just regular configuration.

If I set 22 Celsius on HA and after that I use the IR remote to set 24 it will update back HA after a while, in my case it took around 9 minutes but it will also change the mode to Automatic, and I have initially set to Cool as you can see below:
image

Also, how can I change the card to remove some of the modes below the dial and inside the card parameters? My AC does not have horizontal swing or heat modes.

Thank you!

1 Like

I can not install the component for Home Assistant
0.99.2 installed on Windows. I read the whole topic, tried all the options, nothing works. Is there somebody succesfully runing on 0.99.2?

P.S. Just installed it from HACS and everything worked fine!

Work fine… And include ECO and Boost mode.

1 Like

Please add some Paypal payment way, I want to buy you some beers.

1 Like

Thanks! the fan-mode-workaround fixed my issues.
Hopefully the root cause can be fixed later on aswell.

Hi, anyone having issues with Midea custom component today, only works intermittently. So if I restart it sometimes loads and sometimes not…

Logs:

Thu Nov 28 2019 12:20:19 GMT+0200 (SAST)

Update for climate.midea_XXXXX fails
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 270, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 448, in async_device_update
await self.async_update()
File “/config/custom_components/midea/climate.py”, line 111, in async_update
await self.hass.async_add_executor_job(self._device.refresh)
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/midea/device.py”, line 146, in refresh
data = self._cloud_service.appliance_transparent_send(self.id, data)
File “/usr/local/lib/python3.7/site-packages/midea/cloud.py”, line 173, in appliance_transparent_send
‘applianceId’: id
File “/usr/local/lib/python3.7/site-packages/midea/cloud.py”, line 88, in api_request
self.handle_api_error(int(response[‘errorCode’]), response[‘msg’])
File “/usr/local/lib/python3.7/site-packages/midea/cloud.py”, line 224, in handle_api_error
handler()
File “/usr/local/lib/python3.7/site-packages/midea/cloud.py”, line 209, in throw
raise ValueError(error_code, message)
ValueError: (3123, ‘the appliance is off line.’)

1 Like

Hi,
I was reading almost all posts here, and it seems that some are able to discover their ACs, other not even that and others, like me, are able to discover the devices but not able to control them.

The steps I did:

  • Repository installed using HACS
  • Renamed the repository from ./custom_components/midea to ./custom_components/climate
  • In these directory I have: init.py, climate.py, manifest.json and a directory pycache
  • Copy ./custom_components/midea to ./deps/lib/python3.6/site-packages/midea

My configuration is:

- platform: midea
  app_key: 3742e9e5842d4ad59c2db887e12449f9
  username: '[email protected]'
  password: !secret midea_password

then I have the following errors:

2019-12-05 16:25:38 ERROR (MainThread) [homeassistant.helpers.entity] Update for climate.midea_16492674450766 fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 270, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 448, in async_device_update
    await self.async_update()
  File "/config/custom_components/climate/climate.py", line 107, in async_update
    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/midea/device.py", line 168, in apply
    data = self._cloud_service.appliance_transparent_send(self.id, data)
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 173, in appliance_transparent_send
    'applianceId': id
  File "/usr/local/lib/python3.7/site-packages/midea/cloud.py", line 95, in api_request
    raise RecursionError()
RecursionError

I hope someone can help me, and my steps also help others to understand where they are too :slight_smile:

My humble 2 cents on this everlasting issue:

  1. Checked all available repositories including not only Python but also written in Ruby- all end with the infamous error 3176 recursion :joy:. I started to wonder if it simply related to user’s equipment locale, language and/or time/date settings. So could people who have this component working (even sporadically) chime in and publish their system locale etc. settings?
  2. Despite of many negative reviews on Midea integration into Google Home/Assistant it works rather perfectly if set up correctly. Maybe with help of HA cloud and/or IFTTT we can script this component to be working as all things in separate DO WORK… or is it a bad idea?
    For those who are interested I attach my humble compilation of Midea voice commands for Google Home/Assistant.

Download Nethome Plus app, register and do all the stuff for app working :-)
If app works OK then:
In your Google Assistant/Home app link Nethome Plus -if OK do note 3 to sync devices.

Turn the Air Conditioning On or Off:
	• Turn on/off the Air Conditioning 
	• Switch on/off the Air Conditioning
	• Turn on/off the <Zone Name>
	• Switch on/off the <Zone Name> 
	• Turn on/off all <Zones>
	• Switch on/off all <Zones>

Change the Mode of your Air Conditioning:
	• Set <AC Unit Name> to cool/dry/fan/heat mode					Response: OK, changing <AC...> to <mode>
	• Change <AC Unit Name> to cool/dry/fan/heat mode

Change the Temperature Set Point:
	• Set <Zone Name> to <temperature value in °C>  				Response: sure, setting <AC> to <temperature> degrees
	• Change <Zone Name> to <temperature value in °C>

Increase/Decrease the Temperature: 
	• Cool down/Warm up <Zone Name> by (will change by 3°C)    
	• Increase/Decrease <Zone Name>(will change by 3°C) 
	• Cool down/Warm up <Zone Name> by<temperature value in °C> 
	• Increase/Decrease <Zone Name> by<temperature value in °C> 

Query the Temperature:
	• What is <AC Unit Name/Zone Name> set to?             			Response: <Mode> is set to <Temperature>
	• What is the temperature of <AC Unit Name/Zone Name>? 			Response: <Mode> is set to <Temperature> with the current temperature of <Room temperature>

Query the Status of the Air Conditioning:	
	• Is <AC Unit Name/Zone Name> on or off?						Response: <AC...> is on
	• Are <AC Unit Name/Zone Names> on or off?						Response: not understood

Query Fan speed:
	• What is the <AC Unit Name/Zone Name> speed?					Response: <AC> is set to <auto, speed>
	
Set Fan Speed:
	• Lower/raise the <AC...> speed									Response: Sure, decreasing/increasing the <AC> speed to <speed>
	• Make the <AC...> speed lower/higher						    Response: OK, decreasing/increasing <AC> speed to <speed>	
	• Set AC to <high/medium/low>									Response: OK, setting <AC> speed to <speed>

Query <mode>:
	• Did I set <AC...> to <mode>?									Response: <AC> is set to <heat, cool etc.>
	
	
1.  Note for iOS Users: You will need to open the Google Assistant App or use the App widget, when voicing these commands.
2.  <Zone name> would be something meaningful eg. Downstairs, Upstairs etc.
3.  After every change in Google Home/Assistant app issue: "OK Google, sync my devices"
4.  Somehow on my Midea Mission II R32 <increase/decrease> commands are swapped :-( so raise/lower is better...
5.  When you ask Google Assistant to set the temperature of your air conditioner, the following logic applies:
		If the air conditioner is currently OFF:
			Your request will turn on the air conditioner, set the temperature and adjust the mode to either heating or cooling according to your set temperature compared to the room temperature.
			For example, if you ask Google Assistant to set the temperature to 24 degrees, and the actual room temperature is 21 degrees, the air conditioner will adjust automatically to Heating Mode.
		If the air conditioner is currently ON:
			Your request will only adjust the temperature.
6.  Asking for Multiple Requests:
		Google Assistant does support asking some multiple requests in one question. I.e. if you want to set the heat to 21 degrees, you can ask, “Hey Google, set the heat to 21 in the <AC.../Zone>”.
		Otherwise you can ask individual questions like “Hey Google, set the <AC.../Zone> to 21 degrees”, and then “Hey Google, set the <AC/zone> to heat”.
7.  When you ask Google Assistant to turn on your air conditioner, it will switch on to the last setting it was set to (via voice/app/remote).		

Best, JR

1 Like

Hi people,
I have 4 Midea Blanc and one Carrier. I can see all in my hassio but when I try to control Midea blanc’s they enter in FP mode and I have to change it from Midea app.
Anyone who had this issue could make me a patch?

Anyone have problem after you set a temp in home assistant using this integration, it changes the unit display to Celsius? For instance, I set to 72F and now the display on the unit is now 22. I attempted to change TEMP_CELSIUS to TEMP_FAHRENHEIT, but that just resulted in home assistance’s display to also change to Celsius.

Yep, the reverse engineered protocol sets the display to Celsius. There’s probably a bit in the protocol which changes the display, but the hard part is figuring out what bit it is.

Any way to change the thermostat card and only show some of the hvac_modes?

Also, sometimes the AC WiFi will disconnect and stay offline forever, even if they go back online and the app shows it online, I need to restart Home Assistant for it to get back to online inside Home Assistant. Anyway to make it back online as within the app without a restart?