Any Support for Midea A/C?

along with the same lines above, it gets initial updates but after few successful fetches fails.

Update for climate.midea_10995116286482 fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/climate/midea.py”, line 80, in update
self._device.refresh()
File “/config/deps/lib/python3.6/site-packages/midea/device.py”, line 82, in refresh
data = self._cloud_client.appliance_transparent_send(self.id, data)
File “/config/deps/lib/python3.6/site-packages/midea/cloud.py”, line 124, in appliance_transparent_send
‘applianceId’: id
File “/config/deps/lib/python3.6/site-packages/midea/cloud.py”, line 62, in api_request
raise ValueError(response[‘errorCode’], response[‘msg’])
ValueError: (‘3106’, ‘invalidSession’)

Apologies for all the issues. It seems that my attempts to split the device class into the air_conditioning_device and the dehumidifier_device caused some mistakes. Additionally, the “InvalidSession” issue is due to the way HA tries and updated each device, in parallel.

The Midea server hates having 2 things happen at the same time with 1 account. Its so bad :frowning: I can see why the app is so unstable as well, a lot of people on the app stores are complaining about the app not being able to control their AC reliably. To mitigate this, I have made the update call async in HA, and added retry for the calls that fail. I’ve been using the component now since last night, and it seems a lot more stable.

Unfortunately a recovery from these errors require a whole restart. I will look into fixing this properly, its not nice having automations fail when this component breaks!

Dear NeoArcheron,

I opened an issue here:

https://github.com/NeoAcheron/midea-ac-py/issues/9

Can you helpme?

best regards

@NeoAcheron thank you for this plugin.
I tryed it but sometimes I got this error:

    Retrying API call: 'appliance/transparent/send'

    Restarting session due to: '9999' - 'system error'

    Retrying API call: 'appliance/transparent/send'

    Restarting session due to: '9999' - 'system error' 

Only HA restart helps

Mostly its happening when i try to use the Midea app and after it the app and the HomeAssistant is not able to log in. Is it normal?
thanks

@kbenni I’m still ironing out some issues, but using the app while home assistant is trying to access the API does seem to cause major problems. The Midea cloud service does not support multiple session with the same user account. There isn’t much I can do to support this. The messages you see there aren’t errors, its the system trying to log out and log back into the Midea API due to the error 9999.

Currently the Midea HA component is still pretty unstable, I’m fixing issues as I see them crop up, but unfortunately it still makes HA crash a lot. If you aren’t testing the Midea component, I wouldn’t recommend it for daily use just yet.

Than you for the feedback though, this helps me debug this API.

@gian.salvati Appliances that are using the old Nethome app are not supported, only apps based on the NetHome Plus app is supported at this point. I wouldn’t know how to add support for the Nethome app, my AC’s do not work with it, there is no way for me to effectively test.

The way I implemented this library was with a whole lot of testing and trial an error, without the hardware, it would be next to impossible to use the same approach.

If there’s anyone that knows how to write python and has those appliances, please let me know if you are willing to contribute!

Great work, happy to found this thread before trying to make something myself! :slight_smile:

First of all thank you for this painfully awsome work! :smiley:

I’m using and off branded midea A/c system sold in Portugal called Uplive and using Nethome Plus, If you need I can send you some specs.

I’ve followed your instructions on the wiki and came to these errors.

I’m fairly new to Home Assistant and i am no coder xD

Any thought?

Thu Dec 20 2018 17:49:48 GMT+0000 (Hora padrão da Europa Ocidental)

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 44, in async_setup_platform
from midea.client import client as midea_client
ModuleNotFoundError: No module named ‘midea’

Also, this is my configuration.yaml code:

climate:
- platform: midea
app_key: 3742e9e5842d4ad59c2db887e12449f9
username: [email protected]
password: mypass

Thanks for all the help and keep up the good work!

Hi there ozzypt!

Thanks for trying out the library. Home Assistant seems to have a few issues when dealing with external dependencies on custom components and my Wiki on installing it is slightly wrong. Can you please try placing the library files that should go into /config/deps/midea/ in a directory called /config/deps/lib/python3.6/site-packages/midea/ instead?

Alternatively, if you have python installed, you can also get the latest library by using pip:
pip install midea -t /config/deps/lib/python3.6/site-packages/

The error you’re encountering is because custom components do not get treated like the built in ones where they can download the library files from PyPi directly. Its probably for the best in terms of security, but it sucks for custom components that aren’t merged yet.

I’ll update the Wiki to reflect the setup properly, there is a much nicer way to set this up as well when using the custom_updater component as well, which also tracks updates directly from the Git repository. Instructions to follow on a Wiki page.

Hi everyone, I’ve made some improvements in the last 2 releases that really makes the component behave a lot better. Its been the first time that the component didn’t fail irreversibly or crash Home Assistant (0.84.3) through the night. Performance is also acceptable, seems like when the internet connection is stable, the longest a call takes to get to the AC is 3’ish seconds (failures in the connection or having to log in again extends this time a lot though, can take up to 30 seconds in a worst case scenario). I have a few ideas on how to make this better, but I’m not sure if the complexity at implementing these changes would have a large impact on performance.

This release is version 0.1.7, and it’s holding a lot of promise!

I’ll let it run undisturbed over the next few days. I wont be making changes unless it crashes again. I will continue development in the new year. I’m hoping to add dehumidifier support next, I would however need more help with that when testing, I don’t have a standalone dehumidifier.

Happy holidays to everyone and see you all in the new year!

1 Like

Greate work :slight_smile: thank you ,after you year I will instal the updated version and test it with midea 12hrdn1.

thank you for bringing this amazing component .

Hi anyone else seeing these errors every minute using midea 0.1.7 and HA 0.84.6?
I did not notice this using 0.1.5 and HA 83.x

Updating midea climate took longer than the scheduled update interval 0:01:00

17:46 helpers/entity_platform.py (WARNING)

Hey NeoAcheron!

Thanks for coming back to me, sadly I didn’t had time to fiddle with your solution so far.

I was thinking on putting it on hold until a noobproof version was available lol but…

To my surprise when I was trying to integrate a xiaomi vacuum I got and had the system rebooted what happened?

Suddenly my 3 A/c unites appear on my frontend :smiley: just had to check wich one was wich, so far it looks all of them are working, I stil have to test every mode besides heating and check vertical and horizontal flaps.

Everything is already integrated in lovelace too.

Let me know if you need any description on my units model to add to you project!

Big thanks to you!

Thank you thank you so much for this !
I just checked it out, but i get the following error:

Unsupported device type: 0xa1

I have the EVA II PRO Dehumidifier which is supported by Mideas app and Nethome plus app also.

Is there’s something i can do ?

edit: I think now i understand, i was way too overhyped to read everything, so your code is mainly focused on ACs and that @barbarin is focused on Dehumidifiers. You guys should work together as already suggested.

Hello, I tryed it with midea AC 12hrdn1 and its working good.

Its not working only in case that I open the midea app on mobile phone and then the homeassistant is not able to recover. I have this errors in log
Restarting full: ‘3144’ - ‘login failed, loginId is empty, please login again.’

Retrying API call: ‘user/login’

Restarting full: ‘3144’ - ‘login failed, loginId is empty, please login again.’

Retrying API call: ‘user/login’

Restarting full: ‘3144’ - ‘login failed, loginId is empty, please login again.’

After this try even the midea app is not able to login.

Just some additional information, its working fine for a while but eventual stops responding with the logs flooded with the mention error code, anyone know if its possible to just cycle the add-on and not the whole HA to get back in business?

Just wanted to say thank you for this component.
Works on HTW IX39 WiFi Split AC Unit (rebranded carrier).
I am still testing however there seems to be a problem after a long time (say 24h) the component stops working. Anything I should be looking at to solve this?
After HA restart all is fine again. I am running HASS.IO on a rPi with 0.86.4.

+1 Great component, I was waiting for this for a year, great job developing it!

I have it running with 4x 42MBCA09M5, rebranded Springer. It is working great but as @cliffdude reported, mine stops working after around 24h as well.

And when it stops to work I usually get a couple errors below, which also holds HA to be restarted or stopped, I have to do it multiple times stops to make HA stop/restart:
Feb 04 10:35:35 hassio hass[16853]: Retrying API call: ‘user/login’
Feb 04 10:35:35 hassio hass[16853]: Restarting full: ‘3144’ - ‘login failed, loginId is empty, please login again.’
Feb 04 10:35:35 hassio hass[16853]: Retrying API call: ‘user/login’
Feb 04 10:35:35 hassio hass[16853]: Restarting full: ‘3144’ - ‘login failed, loginId is empty, please login again.’

I’m seeing these errors in log…and climate doesn’t respond to commands.
I have Midea Blanc EU model. Hassio latest installed.
Anyone experienced something simlar?

Update for climate.midea_18691697699339 fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 347, in async_device_update
await self.async_update()
File “/config/custom_components/climate/midea.py”, line 95, in async_update
await self.hass.async_add_executor_job(self._device.apply)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/deps/lib/python3.6/site-packages/midea/device.py”, line 165, in apply
data = self._cloud_service.appliance_transparent_send(self.id, data)
File “/config/deps/lib/python3.6/site-packages/midea/cloud.py”, line 171, in appliance_transparent_send
‘applianceId’: id
File “/config/deps/lib/python3.6/site-packages/midea/cloud.py”, line 91, in api_request
raise RecursionError()
RecursionError