mac-zhou / midea-ac-py

Home Assistant Custom Integration for Midea Group(Hualing, Senville, Klimaire, AirCon, Century, Pridiom, Thermocore, Comfee, Toshiba, Carrier, Goodman, Friedrich, Samsung, Kenmore, Trane, Lennox, LG and much more) Air Conditioners via LAN.
MIT License
519 stars 101 forks source link

Recursion error #221

Open Nuki89 opened 10 months ago

Nuki89 commented 10 months ago

Describe the bug (描述一下问题) Hello, i am getting resursion error, when trying to search for ac conditioner with the right command.

Screenshots / Logs / Pcap File(屏幕截图/日志/抓包文件) INFO:msmart.cli:msmart version: 0.2.5 Currently only supports ac devices, only support MSmartHome and 美的美居 APP. INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/bin/midea-discover", line 8, in sys.exit(discover()) ^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/cli.py", line 51, in discover found_devices = loop.run_until_complete(discovery.get_all() if ip == '' else discovery.get(ip)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/scanner.py", line 193, in get_all await self._process_tasks(tasks) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/scanner.py", line 199, in _process_tasks [self.result.add(task.result()) for task in tasks] File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/scanner.py", line 199, in [self.result.add(task.result()) for task in tasks] ^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/scanner.py", line 50, in support_test _device = await self.support_testv3(account, password) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/scanner.py", line 65, in support_testv3 token, key = await loop.run_in_executor(None, gettoken, udpid, account, password) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/scanner.py", line 255, in gettoken Client.login() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/cloud.py", line 143, in login self.get_login_id() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/cloud.py", line 132, in get_login_id response = self.api_request( ^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/cloud.py", line 121, in api_request return self.api_request(endpoint, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/cloud.py", line 121, in api_request return self.api_request(endpoint, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/msmart/cloud.py", line 123, in api_request raise RecursionError() RecursionError

Versions (版本信息)

mill1000 commented 10 months ago

Duplicate of #217.

I've got this fixed in my fork if you want to check it out. (#220)

YoMan12 commented 9 months ago

Hi @mill1000 , in my case it seems to not work as well:

root@debian:/home/jacek# msmart-ng discover
INFO:msmart.cli:Discovering all devices on local network.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
Traceback (most recent call last):
  File "/usr/local/bin/msmart-ng", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/msmart/cli.py", line 188, in main
    _run(parser.parse_args())
  File "/usr/local/lib/python3.9/dist-packages/msmart/cli.py", line 119, in _run
    asyncio.run(args.func(args))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/dist-packages/msmart/cli.py", line 21, in _discover
    devices = await Discover.discover(account=args.account, password=args.password, discovery_packets=args.count)
  File "/usr/local/lib/python3.9/dist-packages/msmart/discover.py", line 188, in discover
    devices = await asyncio.gather(*protocol.tasks)
  File "/usr/local/lib/python3.9/dist-packages/msmart/discover.py", line 401, in _get_device
    await Discover.connect(dev)
  File "/usr/local/lib/python3.9/dist-packages/msmart/discover.py", line 409, in connect
    success = await Discover._authenticate_device(dev)
  File "/usr/local/lib/python3.9/dist-packages/msmart/discover.py", line 359, in _authenticate_device
    cloud = await Discover._get_cloud()
  File "/usr/local/lib/python3.9/dist-packages/msmart/discover.py", line 225, in _get_cloud
    async with cls._lock:
  File "/usr/lib/python3.9/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/usr/lib/python3.9/asyncio/locks.py", line 120, in acquire
    await fut
RuntimeError: Task <Task pending name='Task-3' coro=<Discover._get_device() running at /usr/local/lib/python3.9/dist-packages/msmart/discover.py:401>> got Future <Future pending> attached to a different loop
root@debian:/home/jacek#

My devices are midea-products under brand MDV

mill1000 commented 9 months ago

Hey @YoMan12, sorry you're having trouble. I've created an issue to track this here: https://github.com/mill1000/midea-msmart/issues/74

Could you reply in the above issue with your Python and msmart-ng version? e.g. python --version and msmart-ng --version?

YoMan12 commented 9 months ago

Hey @YoMan12, sorry you're having trouble. I've created an issue to track this here: mill1000/midea-msmart#74

Could you reply in the above issue with your Python and msmart-ng version? e.g. python --version and msmart-ng --version?

Python 3.9.2, msmart 2023.9.4