wuwentao / midea_ac_lan

Auto-configure and then control your Midea M-Smart devices (Air conditioner, Fan, Water heater, Washer, etc) via local area network.
MIT License
350 stars 16 forks source link

C3 Heat pump - Problems since version 0.5.9 #319

Closed erikgieseler closed 1 month ago

erikgieseler commented 1 month ago

HA core version

2024.9.2

Current integration version

0.5.9

Last known working integration version

0.5.7

Device type and model

C3 - Heat Pump Wi-Fi Controller 171H120F

Working mobile app

Smart Home

The description of problem

Unfortunately, I have to say that adjustments in version 0.5.9 (probably adjustments in midea-local) have meant that 0.5.9 is no longer reliably usable for me.

For example, when I activate the heating curve, the command is apparently not transmitted to the heat pump in some cases or the status in the HA is not updated correctly.

I have an automation (summer mode) that switches zone 1 heating and the heating curve on and off based on the outside temperature. This no longer works reliably with 0.5.9. Sometimes zone 1 heating is activated correctly (switch in HA is switched on) but not the heating curve (switch in HA is switched off).

With version 0.5.7 it works without any problems.

Here is a log from version 0.5.7 and 0.5.9 where I switch off zone 1 heating and the heating curve a few times.

home-assistant_0_5_9.log home-assistant_0_5_7.log

The logs

No response

wuwentao commented 1 month ago

thanks for your bug report. just did a simple checks, seems there is no any c3 device releated changes from v0.5.7 to v0.5.9. so I still think this is a socket timeout issue, and caused the status sync delay or error, and I also found some error with current code, but not confirmed it for your error reason, please don't worry, new bug will always exist when we do some new feature changes.I will check and confirm it with you later. then we can quickly fix it.

erikgieseler commented 1 month ago

No problem, I'll stay on 0.5.7 until then. I suspect that the problem is caused by some change in https://github.com/rokam/midea-local/pull/296. Normally this is the only change that could cause the problem.

wuwentao commented 1 month ago

No problem, I'll stay on 0.5.7 until then. I suspect that the problem is caused by some change in rokam/midea-local#296. Normally this is the only change that could cause the problem.

yes, you are right, it just fixing some other socket and exception/connection issus, and may still have new issue, but I will continue monitor it and improve it step by step. and also expected to become stable in 2-3 new release later, as we don't have enough time to fix all in 1 release, and also can't cover all the user scenrio in 1 release. I will collect some bug and issue with it, and commit new changes these days.

wuwentao commented 1 month ago

@erikgieseler

could you help to test with the changes? just want to confirm whether it fix current bug before publish a fix.

test methdod: replace device.py in midea-local lib with latest changes in this URL https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py

detail steps:

  1. if you are using HAOS, you should install Add-on [Advanced SSH & Web Terminal] and disable [Protected Mode], once it done, you can ssh to your HAOS, and enter docker in HAOS docker exec -it homeassistant /bin/bash, contiune the step to check midea-local install path
  2. if you not using HAOS, just check midea-local install path as the next step
  3. get midea-local install path with command pip show midea-local, it will show info for you, for example, my location is Location: /usr/local/lib/python3.12/site-packages
  4. then we can replace local /usr/local/lib/python3.12/site-packages/midealocal/device.py with the latest code changes from the URL https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py i just using vi to delete the full file and paste the content to it vi /usr/local/lib/python3.12/site-packages/midealocal/device.py , once the file is opend, the bottom will show you 1/690 0%, 1 mean line 1, and 690 mean total 690 lines(based on your local installed version), you can press 690 + dd to delete all the content in this file, once it deleted, you will see [[Modified] 1/1 100%] at the bottom, press i to insert mode, copy the file content and paste all the content to it (from your ssh Terminal app), finally, press :wq to save and exit
    1. reboot HA and test with it, confirm whether it fix your bug

If the testing process is too complicated, just ignore it and we will publish a fix in future. the main purpose is replace the device.py with latest code and test it before publish

erikgieseler commented 1 month ago

I have made the adjustments and tested again: Unfortunately, the problem persists. Here is a new log.

home-assistant.log

wuwentao commented 1 month ago

@erikgieseler thank you very much for your test result update. I can't reproduce with my AC device, could you help to test the latest changes and update the result and debug log to me.

the latest changes is : https://github.com/rokam/midea-local/blob/f0b25dc271aa7de45746d76165e3c7b76d078cf3/midealocal/device.py

replace the file and reboot HA to confirm with it. thanks

erikgieseler commented 1 month ago

With the adjustments, midea_ac_lan is unfortunately no longer loaded in HA. Error in the log file. home-assistant.log

ajcorrea commented 1 month ago

I´m having same issue with AC devices.

Feedback to or from devices not been updated. Example:

Turn on AC using integration, AC is turned ON, status on HA is ON but a few seconds later, shows OFF (but AC still ON). This happens to other functions like temperature and wind speed.

With @wuwentao instructions, i get into HA CORE, replaced device.py with https://github.com/rokam/midea-local/blob/f0b25dc271aa7de45746d76165e3c7b76d078cf3/midealocal/device.py

And seems to be solved.

wuwentao commented 1 month ago

With the adjustments, midea_ac_lan is unfortunately no longer loaded in HA. Error in the log file. home-assistant.log

this should be file content paste error, maybe you can retry. seems it should fix AC and most of the device error, but I'm still not sure with your C3 device, maybe still not work. and I can't reproduce it in my local env, so still need more info to confirm the reason for it.

wuwentao commented 1 month ago

I´m having same issue with AC devices.

Feedback to or from devices not been updated. Example:

Turn on AC using integration, AC is turned ON, status on HA is ON but a few seconds later, shows OFF (but AC still ON). This happens to other functions like temperature and wind speed.

With @wuwentao instructions, i get into HA CORE, replaced device.py with https://github.com/rokam/midea-local/blob/f0b25dc271aa7de45746d76165e3c7b76d078cf3/midealocal/device.py

And seems to be solved.

thanks for your confirmation, it should works for AC device. the reason is refresh_interval, default is 30 seconds, and after you changed the device status like power on/off, the refresh interval not catch this 30 seconds interval, so it will wait for some times, once it finished the refresh, status will be sync. the latest changes force refresh status after HA status changes. but if you set the status from Midea official app, it still have some delay less than 30 seconds.

erikgieseler commented 1 month ago

With the adjustments, midea_ac_lan is unfortunately no longer loaded in HA. Error in the log file. home-assistant.log

this should be file content paste error, maybe you can retry. seems it should fix AC and most of the device error, but I'm still not sure with your C3 device, maybe still not work. and I can't reproduce it in my local env, so still need more info to confirm the reason for it.

It was apparently really a mistake when inserting. My problems have been solved with the adjustment. The status is now updated correctly again. Thank you very much!

wuwentao commented 1 month ago

@erikgieseler thank you very much for your confirmation. there is still a small issue still waiting to confirm for B6 device, once it done, I will publish a new release for this fix.

erikgieseler commented 1 month ago

Version 0.6.1 works perfectly for me. Thank you very much!