Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSD40THR风扇控制错误 #321

Closed
xiasi0 opened this issue Sep 23, 2024 · 73 comments
Closed

FSD40THR风扇控制错误 #321

xiasi0 opened this issue Sep 23, 2024 · 73 comments
Labels
bug Something isn't working

Comments

@xiasi0
Copy link

xiasi0 commented Sep 23, 2024

HA版本

2024.9.2

集成版本

0.5.9

之前可正常使用的集成版本

0.5.9

设备类型及型号

实际型号:FSD40THR,HA显示型号:Fan 56011CB4 (0)

使用的App

美的美居

问题详细描述

0.5.9版本之前开关控制还正常,0.5.9版本中开关变成了瞬时开关点击打开后立马就关闭了。摇头控制也不正常不能打开摇头,摇头控制在所有版本中都不正常。模式选择在所有版本中也不正常。产品的SN:0000FA51156011CB43C161102252D3J8
希望您有时间能修复一下!谢谢

The logs

home-assistant_midea_ac_lan_2024-09-23T02-48-54.705Z.log

@xiasi0 xiasi0 added the bug Something isn't working label Sep 23, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Title: FSD40THR fan control error

HA version

2024.9.2

Integrated version

0.5.9

Integrated version that worked normally before

0.5.9

Equipment type and model

Actual model: FSD40THR, HA display model: Fan 56011CB4 (0)

App used

Beautiful Mercure

Detailed description of the problem

Before version 0.5.9, the switch control was normal. In version 0.5.9, the switch became a momentary switch and turned off immediately after clicking on it. The shaking head control is also abnormal and the shaking head cannot be turned on. The shaking head control is not normal in all versions. Mode selection also works incorrectly in all versions. Product SN:0000FA51156011CB43C161102252D3J8
Hope you have time to fix it! Thanks

The logs

home-assistant_midea_ac_lan_2024-09-23T02-48-54.705Z.log

@wuwentao
Copy link
Owner

问题大概看了看,应该还是超时导致的问题,控制命令没有发送成功,我明后天先修复一下

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


After a rough look at the problem, it seems that it is still a problem caused by timeout. The control command was not sent successfully. I will fix it tomorrow.

@wuwentao
Copy link
Owner

@xiasi0

是否可以在发布之前,先协助测试一下是否解决了问题?

具体的测试方法:
需要更新mide-local这个python库, 使用修改后的device.py替换你本地安装的device.py,操作流程

  1. 如果你是HAOS安装,需要ssh登录HAOS(安装Advanced SSH & Web Terminal这个【加载项】(英文叫Add-on),同时关闭其中的【保护模式】
    然后就可以ssh登录HAOS,或者直接用这个加载项的网页版登录HAOS了。然后在ssh中执行docker exec -it homeassistant /bin/bash即可登录docker,就可以继续后面查找和修改midea-local的流程。。。。
  2. 如果不是HAOS,使用的其他模式,只需要查找midea-local这个python库安装在哪里即可。
  3. 查找midea-local的安装路径: pip show midea-local 显示信息会有安装路径,例如我的显示Location: /usr/local/lib/python3.12/site-packages
  4. 修改midea-local源码: 使用 https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py 这个文件的内容替换你本地安装的device.py文件即可。
    方法可能特别多,例如可以使用scp或者其他文件替换法,我自己一般直接使用vi修改,例如: vi /usr/local/lib/python3.12/site-packages/midealocal/device.py 打开以后,最底下会显示类似1/690 0%,说明当前在文件第一行,文件总共有690行(以你的为准,实际行数根据你安装的版本相应修改即可),先按数字690然后紧接着快速按二个dd,即可删除整个文件的所有内容,删除成功后最底下会显示[[Modified] 1/1 100%], 然后按字母i键进入插入模式,复制https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py这个文件的完整内容,ssh终端软件里面点右键,粘贴,即可,默认显示在最后一行是return ret即可,然后先按ESC退出插入模式(如有错误,重复执行xxx数字加dd重来),最后必须按:wq来保存退出即可。
    HAOS的修改麻烦一些,其他安装模式可能可以直接使用root用户或者其他工具替换文件即可,修改完成以后,只需要重启HA就行了,验证修改是否解决了当前存在的问题。

如果认为流程太麻烦,实在搞不定就算了,随后等review/approve以后,发布新版再测试吧。
或者想尝试,反馈具体不会操作的地方和遇到的问题,再沟通解决也行,总之目的就是用新的device.py替换目前安装的device.py即可。
在发布之前,先测试一下是否解决了所有问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@xiasi0

Can you help test whether the problem is solved before publishing?

Specific test methods:
You need to update the mid-local python library. Use the modified device.py to replace your locally installed device.py. Operation process

  1. If you are installing HAOS, you need to log in to HAOS via ssh (install the [Add-on] Advanced SSH & Web Terminal (called Add-on in English), and turn off the [Protected Mode] at the same time)
    Then you can log in to HAOS via ssh, or directly log in to HAOS using the web version of this add-on. Then execute docker exec -it homeassistant /bin/bash in ssh to log in to docker, and then continue the process of finding and modifying midea-local. . . .
  2. If it is not HAOS and other modes are used, you only need to find where the midea-local python library is installed.
  3. Find the installation path of midea-local: pip show midea-local The displayed information will have the installation path, for example, mine shows Location: /usr/local/lib/python3.12/site-packages
  4. Modify the midea-local source code: Use https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py to replace your locally installed device.py file with the contents of this file. Can.
    There may be many methods, for example, you can use scp or other file replacement methods. I usually use vi to modify it directly, for example: vi /usr/local/lib/python3.12/site-packages/midealocal/device.py After opening , something like 1/690 0% will be displayed at the bottom, indicating that it is currently on the first line of the file, and the file has a total of 690 lines (based on yours, the actual number of lines can be modified accordingly according to the version you installed), press first Number 690 and then quickly press dd twice to delete all the contents of the entire file. After the deletion is successful, [[Modified] 1/1 100%] will be displayed at the bottom, and then press the letter i Press the key to enter insert mode, copy the complete content of the file https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py, right-click in the ssh terminal software, and paste, that's it. Default The last line displayed is return ret, then press ESC to exit the insert mode (if there is an error, repeat the xxx number plus dd to start again), and finally press :wq to save and exit.
    Modification of HAOS is more troublesome. In other installation modes, you may directly use the root user or other tools to replace files. After the modification is completed, you only need to restart HA to verify whether the modification solves the current problem.

If you think the process is too cumbersome and you really can't figure it out, forget it. Then wait for review/approval and release a new version before testing.
Or if you want to try it, you can provide feedback on the specific areas that you don’t know how to operate and the problems you encounter, and then communicate and solve them. In short, the purpose is to replace the currently installed device.py with the new device.py.
Before publishing, test to see if all issues are resolved

@xiasi0
Copy link
Author

xiasi0 commented Sep 24, 2024

好的,我会配合测试

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


OK, I will cooperate with the test

@xiasi0
Copy link
Author

xiasi0 commented Sep 24, 2024

https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py
更新了这个文件,还是一样呢
开关是瞬时的,打开后立马关闭,摇头只能关不能开。模式没有一个是正确的😂
这是日志请查看:
home-assistant_midea_ac_lan_2024-09-24T23-28-29.279Z.log
@wuwentao

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


https://github.com/rokam/midea-local/blob/20488c7bb7fd7e747d54ad4541e9ff63349b1d61/midealocal/device.py
Updated this file, still the same thing
The switch turns on momentarily and then turns off immediately. Shaking your head can only turn it off but not on. None of the patterns are correct😂
This is the log please view:
home-assistant_midea_ac_lan_2024-09-24T23-28-29.279Z.log

@wuwentao
Copy link
Owner

@xiasi0
还请帮忙再次验证一下,操作流程相同,但是使用当前最新的修改:
https://github.com/rokam/midea-local/blob/f0b25dc271aa7de45746d76165e3c7b76d078cf3/midealocal/device.py

如果还有其他error log,也请帮忙提供一下完整的debug log,这个问题是修改其他bug引入的,希望能一并解决其他问题。
我这边的AC设备无法复现这个问题,所以只能麻烦帮忙测试一下,并反馈结果和debug log,感谢

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@xiasi0
Please help to verify it again. The operation process is the same, but the latest modifications are used:
https://github.com/rokam/midea-local/blob/f0b25dc271aa7de45746d76165e3c7b76d078cf3/midealocal/device.py

If there are other error logs, please help provide a complete debug log. This problem was introduced by modifying other bugs. I hope other problems can be solved together.
The AC equipment here cannot reproduce this problem, so I can only help you test it and provide feedback on the results and debug log. Thank you.

@xiasi0
Copy link
Author

xiasi0 commented Sep 26, 2024

不行呢。f0b25dc271aa7de45746d76165e3c7b76d078cf3这个739行的复制进去重启后集成直接挂了加载不上去集成,这是开启调试的内核完整日志
home-assistant_2024-09-26T13-56-00.172Z.log

重新复制进去20488c7bb7fd7e747d54ad4541e9ff63349b1d61这个690行的也不能恢复了,集成依然是挂掉的加载不上。这是690行的完整日志。
home-assistant_2024-09-26T14-05-49.546Z.log
@wuwentao

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It doesn’t work. After copying the 739 line of f0b25dc271aa7de45746d76165e3c7b76d078cf3 and restarting, the integration directly hangs and cannot be loaded. This is the complete log of the kernel with debugging enabled.
home-assistant_2024-09-26T13-56-00.172Z.log


After re-copying 20488c7bb7fd7e747d54ad4541e9ff63349b1d61, line 690 cannot be restored, and the integration is still hung and cannot be loaded. This is the complete log of 690 lines.
home-assistant_2024-09-26T14-05-49.546Z.log
@wuwentao

@xiasi0
Copy link
Author

xiasi0 commented Sep 26, 2024

2024-09-26 22:18:18.542 ERROR (ImportExecutor_0) [homeassistant.loader] Unexpected exception importing platform custom_components.midea_ac_lan.config_flow
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1296, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/midea_ac_lan/__init__.py", line 33, in <module>
from midealocal.device import DeviceType, MideaDevice, ProtocolVersion
File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 686
"""Attributes."""
^
SyntaxError: unterminated triple-quoted string literal (detected at line 690)
2024-09-26 22:18:18.545 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to import_module with args ('custom_components.midea_ac_lan.config_flow',) inside the event loop by integration 'config' at homeassistant/components/config/config_entries.py, line 179: return await super()._post_impl(request, data) (offender: /usr/src/homeassistant/homeassistant/loader.py, line 1296: return importlib.import_module(f"{self.pkg_path}.{platform_name}")), please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+config%22
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 462, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 537, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
response = await handler(request)
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
result = await handler(request, **request.match_info)
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 81, in with_admin
return await func(self, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
return await method(view, request, data, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 172, in post
return await self._post_impl(request, data)
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 179, in _post_impl
return await super()._post_impl(request, data)
2024-09-26 22:18:18.546 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform custom_components.midea_ac_lan.config_flow
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 1264, in _load_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 1296, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "/config/custom_components/midea_ac_lan/__init__.py", line 33, in <module>
from midealocal.device import DeviceType, MideaDevice, ProtocolVersion
File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 686
"""Attributes."""
^
SyntaxError: unterminated triple-quoted string literal (detected at line 690)
2024-09-26 22:18:18.546 ERROR (MainThread) [homeassistant.config_entries] Error occurred loading flow for integration midea_ac_lan: Exception importing custom_components.midea_ac_lan.config_flow

完了卸载重新安装也不行了,集成都添加不了了😂😂😂😂

@wuwentao
Copy link
Owner

wuwentao commented Sep 26, 2024

@xiasi0 这个错误应该是粘贴时格式出问题了。
文件本身没问题,我确认是好的,其他人也今天测试过解决了AC设备的刷新问题,但是FA设备我还不确定,所以需要进一步验证一下。

另外,你这个错误的核心原因是粘贴的py文件有点问题,应该删除一下内容,重新粘贴,重启即可。
不会影响HA 之外的其他集成。
所以,这个device.py重新删除,复制粘贴再试试重启。

或者你试试下载这个raw的文件源码,然后替换文件的方案也行。
粘贴的时候会出现格式问题,我也遇见过,重新删除内容,复制粘贴,重启就行,不必着急,这个是粘贴内容太多了,格式出问题了,而python又是空格敏感的语言,所以就导致报错了,问题不大。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@xiasi0 This error should be caused by a formatting problem when pasting.
There is nothing wrong with the file itself. I confirm that it is good. Others have also tested and solved the refresh problem of the AC device today, but I am not sure about the FA device yet, so I need to further verify it.

In addition, the core reason for your error is that there is something wrong with the pasted py file. You should delete the content, paste it again, and restart.
Does not affect other integrations outside of HA.
Therefore, delete this device.py again, copy and paste and try to restart.

@xiasi0
Copy link
Author

xiasi0 commented Sep 26, 2024

我再试试哈,先别走哈@wuwentao😁

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I'll try again, don't leave yet @wuwentao😁

@xiasi0
Copy link
Author

xiasi0 commented Sep 26, 2024

重新替换后可以了,但是添加设备提示验证失败呢
image
没有提示让我登录美的账号呢
删除登录缓存也不行呢

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It works after replacing it again, but when adding a device, it prompts that the verification failed.
image
There is no prompt for me to log in to my Midea account.

@wuwentao
Copy link
Owner

wuwentao commented Sep 26, 2024

cd /config/.storage/midea_ac_lan
ls
rm -rf ./*.json   # 或者修改为删除xxx.json

这里会缓存你设备的配置信息,你可以删除里面的xxx.json,然后重新添加就可以了。
也可以从首页readme加入discord chat聊天群组沟通

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


ls```
The configuration information of your device will be cached here. You can delete the xxx.json inside and then add it again.
You can also join the discord chat group from the homepage readme to communicate.  
      

@xiasi0
Copy link
Author

xiasi0 commented Sep 26, 2024

不用进容器吧

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


No need to put it in a container

@xiasi0
Copy link
Author

xiasi0 commented Sep 26, 2024

cd /config/.storage/midea_ac_lan
ls
rm -rf ./*.json   # 或者修改为删除xxx.json

这里会缓存你设备的配置信息,你可以删除里面的xxx.json,然后重新添加就可以了。 也可以从首页readme加入discord chat聊天群组沟通

抱歉,我过不去墙,能不过就不过。抱歉哈🤣

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


cd /config/.storage/midea_ac_lan
ls
rm -rf ./*.json # Or modify to delete xxx.json

The configuration information of your device will be cached here. You can delete the xxx.json inside and then add it again. You can also join the discord chat group from the homepage readme to communicate.

Sorry, I can't get over the wall. If I can, I can't. Sorry 🤣

@wuwentao
Copy link
Owner

不用进容器吧
删除不需要,容器里面,外面都可以,容器里面也会自动映射

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


No need to put it in the container
Deletion is not necessary, it can be done inside or outside the container, and it will be automatically mapped inside the container.

@wuwentao
Copy link
Owner

不用着急,慢慢试试就行,目前已通过其他人测试,确认这个修改已经解决了AC设备,C3设备等问题,等你最终的FA设备测试结果。
如果还有相关的未解决的问题,争取都尽快解决掉,再发布一个新版本即可。
后面就基本慢慢稳定了。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@xiasi0 If the addition is unsuccessful, I will look at it later. First, solve the problem of status synchronization:
It seems that your FA fan device refreshes its status slowly after executing the command, so HA cannot obtain it immediately.
For example, if an AC air conditioner is successfully added, there should be no problem and it can be refreshed quickly. This is most likely caused by the slow response of the FA fan device itself.

I simply added a time.sleep(0.5) and temporarily waited for 0.5 seconds after executing the command to see if I can get the accurate status.
You can try replacing it directly with this modified file (note that it may not start after pasting, just try again).
device.py.zip

Test method:

  1. Unzip the device.py.zip and replace it directly with the default one. See if the default sleep of 0.5 seconds can solve the status refresh problem.
  2. If it doesn’t work, search for time.sleep(0.5) yourself, and then change 0.5 to 0.8 or 1, or 2 to see which value is more appropriate, because this value affects all other devices and causes the status of other devices The refresh is also delayed, so try to choose a reasonable and smaller value. (Note: When you click on the power of the fan to turn it on or off, you only need to click it once. There is no need to click it multiple times, and then observe the result. If it is unsuccessful, it will automatically refresh in 30 seconds, so try to avoid clicking it multiple times. It is currently in debug mode, which is convenient for viewing logs)
  3. If the default 0.5 seconds can correctly refresh the status, then help try to reduce this value, such as 0.3/0.2/0.1, etc., and see which minimum value can be used.
  4. Please help with feedback on the results.

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

time.sleep(0.5)

现在风扇开关不会出现打开后立马关闭的情况(但是前端卡片无法使用不会同步任何风扇状态,也不能控制开关)。然后就是在设备页面点击开或者关左下角都会出现参数报错。请查看

日志记录器: homeassistant.components.websocket_api.http.connection
来源: components/websocket_api/commands.py:245
集成: Home Assistant WebSocket API ([文档](https://www.home-assistant.io/integrations/websocket_api), [问题](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
首次出现: 22:14:06 (2 次总计出现)
上次记录: 22:14:17

[139724611687984] Unexpected exception
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 996, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1068, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 430, in async_handle_turn_on_service
    await self.async_turn_on(percentage, preset_mode, **kwargs)
  File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 439, in async_turn_on
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midea_ac_lan/fan.py", line 165, in turn_on
    self._device.turn_on(fan_speed=fan_speed, mode=preset_mode)
  File "/usr/local/lib/python3.12/site-packages/midealocal/devices/fa/__init__.py", line 335, in turn_on
    self.build_send(message)
  File "/usr/local/lib/python3.12/site-packages/midealocal/device.py", line 364, in build_send
    now = time.time(0.5)
          ^^^^^^^^^^^^^^
TypeError: time.time() takes no arguments (1 given)
无法执行动作“fan/turn_off” 。 time.time() takes no arguments (1 given)

@wuwentao
Copy link
Owner

@xiasi0
你这是自己改过代码了,然后改错了……
请仔细看一下,是修改time.sleep(0.5),而且是只修改这个0.5数字,其他都不变。
不是修改now=time.time() 而且也不是把中间加上0.5
我用提供的文件替换,或者基于这个文件修改。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@xiasi0
You have modified the code yourself, and then you made a mistake...
Please take a closer look, you are modifying time.sleep(0.5), and only modifying the 0.5 number, leaving everything else unchanged.
It’s not about modifying now=time.time() nor adding 0.5 in the middle.
I replace it with the provided file, or modify it based on this file.

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

好的,马上尝试重新修改

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


OK, try to modify it again immediately

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

测试从0.5-2没有延迟明显改善。是否还需要增加数值?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Tested from 0.5-2 with no noticeable improvement in latency. Do I still need to increase the value?

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

1:03
1:33
1:30
设备已生效,实际同步到HA用时。这是三次测试。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


1:03
1:33
1:30
The device has taken effect and the actual time it took to synchronize to HA. These are three tests.

@wuwentao
Copy link
Owner

@xiasi0 多谢反馈,那就是time.sleep(1)是否就行?降低到0.8或者0.5不行?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@xiasi0 Thanks for the feedback. Is time.sleep(1) sufficient? Can't it be lowered to 0.8 or 0.5?

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

不是的,我测试0.5、0.8、1、1.5、2四个数值。均没有明显改善。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


No, I tested four values: 0.5, 0.8, 1, 1.5, and 2. There was no significant improvement.

@wuwentao
Copy link
Owner

1:03 1:33 1:30 设备已生效,实际同步到HA用时。这是三次测试。

这个时间是什么意思?没看懂,是说30秒自动刷新了?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


1:03 1:33 1:30 The device has taken effect, and the actual time it takes to synchronize to HA. These are three tests.

What does this time mean? I don’t understand. Does it mean it refreshes automatically in 30 seconds?

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

我点击开关后风扇立即打开,但是同步到HA实体需要等到1分钟后才会显示开启状态。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The fan turns on immediately after I click the switch, but it takes 1 minute to synchronize to the HA entity before it shows the on status.

@wuwentao
Copy link
Owner

状态刷新默认是30秒自动刷新一次,如果超过30秒那不对,那就不正常了。

如果time.sleep(2)还不行,那还再看看其他办法。
时间太长不能这么干等,得用其他形式解决了,我再看看怎么修改吧。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


By default, the status refresh is automatically refreshed every 30 seconds. If it exceeds 30 seconds, it is wrong and abnormal.

If time.sleep(2) doesn't work, then look at other methods.
It's too long to wait like this. It has to be solved in other ways. I'll see how to modify it.

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

好的。谢谢
#323 我看其他人也有类似情况。风扇部分我看在原来的仓库就有好多问题除了延迟情况没有,其它什么情况都有😂。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


OK Thanks
#323 I see other people are in similar situations. Regarding the fan part, I saw that there were many problems in the original warehouse, except for delays, there were other problems 😂.

@xiasi0
Copy link
Author

xiasi0 commented Sep 27, 2024

昨天添加不上去的柜机可以添加上去了。但是跟风扇一样存在延迟。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The cabinets that could not be added yesterday can be added. But there is a delay just like the fan.

@xiasi0
Copy link
Author

xiasi0 commented Sep 28, 2024

可以用discord了。买了一个月流量包

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


You can use discord now. I bought a one month data package

@xiasi0
Copy link
Author

xiasi0 commented Oct 3, 2024

我这测试风扇类开关是没有延迟了。可以关闭了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


When I tested the fan switch, there was no delay. Can be closed

@wuwentao wuwentao closed this as completed Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants