midea-ac-py icon indicating copy to clipboard operation
midea-ac-py copied to clipboard

midea-discover returns code 3004 "value is illegal"

Open Xe138 opened this issue 1 year ago • 10 comments

Describe the bug (描述一下问题) Running midea-discover fails with "RecursionError" after multiple cloud POST attempts.

Screenshots / Logs / Pcap File(屏幕截图/日志/抓包文件)

midea-discover -a [ACCOUNT] -p [PASSWORD] -d -i 192.168.20.60
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.2.5 Currently only supports ac devices, only support MSmartHome and 美的美居 APP.
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Message sent
DEBUG:msmart.scanner:Midea Local Data 192.168.20.60 837000c8200f00005a5a0111b8007a80000000005e9102001f071714190303000089000000000000000001800000000078a086a57bf11b616c0f9552b7deec477ee2c11fcfdeee58ef906e0fa5170bf12eef680226f3bea7639f92c9f6331c9860f4e458b57fcd0408fbfcb52b0c7594f60080bf6a2220ddeb9bf244cdc41334aa50fed3be676d17ed6fb38c2691b88546cc8a3f287d37a7e9fdd547194fd8ad0bb19369bf0317b24d3a4de9e6a131067e2b1bd8453878df33b1624510779f83d8320d16b42dde320b144364a850c433
DEBUG:msmart.scanner:Decrypt Reply: 192.168.20.60 3c14a8c02c19000030303030303050303030303030305131414339334334313738373830303030300b6e65745f61635f383738300000870002000000000000000000ac00acac00000000ac93c41787801500230821220003005d548a309eb8592407e030b90905f70f0000000000000000000000000000000000
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
DEBUG:msmart.cloud:Response: {"code":"3004","msg":"value is illegal."}
DEBUG:msmart.cloud:Error ignored: '3004' - 'value is illegal.'
DEBUG:msmart.cloud:Retrying API call: '/v1/user/login/id/get'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
DEBUG:msmart.cloud:Response: {"code":"3004","msg":"value is illegal."}
DEBUG:msmart.cloud:Error ignored: '3004' - 'value is illegal.'
DEBUG:msmart.cloud:Retrying API call: '/v1/user/login/id/get'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
DEBUG:msmart.cloud:Response: {"code":"3004","msg":"value is illegal."}
DEBUG:msmart.cloud:Error ignored: '3004' - 'value is illegal.'
DEBUG:msmart.cloud:Retrying API call: '/v1/user/login/id/get'
Traceback (most recent call last):
  File "/home/bballou/.local/bin/midea-discover", line 8, in <module>
    sys.exit(discover())
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/bballou/.local/lib/python3.10/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 "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 205, in get
    await self._process_tasks([task])
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 199, in _process_tasks
    [self.result.add(task.result()) for task in tasks]
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 199, in <listcomp>
    [self.result.add(task.result()) for task in tasks]
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 50, in support_test
    _device = await self.support_testv3(account, password)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 65, in support_testv3
    token, key = await loop.run_in_executor(None, gettoken, udpid, account, password)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 255, in gettoken
    Client.login()
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 143, in login
    self.get_login_id()
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 132, in get_login_id
    response = self.api_request(
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 121, in api_request
    return self.api_request(endpoint, args)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 121, in api_request
    return self.api_request(endpoint, args)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 123, in api_request
    raise RecursionError()
RecursionError

Versions (版本信息)

  • Home Assistant version: 2023.7.3
  • Midea msmart version: 0.2.5

Xe138 avatar Jul 31 '23 22:07 Xe138

Does it work if you don't specify an account and password?

mill1000 avatar Aug 01 '23 01:08 mill1000

Does it work if you don't specify an account and password?

Same result

midea-discover -d -i 192.168.20.60
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.2.5 Currently only supports ac devices, only support MSmartHome and 美的美居 APP.
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Message sent
DEBUG:msmart.scanner:Midea Local Data 192.168.20.60 837000c8200f00005a5a0111b8007a8000000000544d0e0201081714190303000089000000000000000001800000000078a086a57bf11b616c0f9552b7deec477ee2c11fcfdeee58ef906e0fa5170bf12eef680226f3bea7639f92c9f6331c9860f4e458b57fcd0408fbfcb52b0c7594f60080bf6a2220ddeb9bf244cdc41334f62b1d8bb9e5c25dba7bf8e0cc4c77944bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a1310679713337f1d8aa3071e0b68f082982f2d8320d16b42dde320b144364a850c433
DEBUG:msmart.scanner:Decrypt Reply: 192.168.20.60 3c14a8c02c19000030303030303050303030303030305131414339334334313738373830303030300b6e65745f61635f383738300000870002000000000000000000ac00acac00000000ac93c4178780150023082122000300000000000000000000000000000000000000000000000000000000000000000000
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias= False
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
DEBUG:msmart.cloud:Response: {"code":"3004","msg":"value is illegal."}
DEBUG:msmart.cloud:Error ignored: '3004' - 'value is illegal.'
DEBUG:msmart.cloud:Retrying API call: '/v1/user/login/id/get'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
DEBUG:msmart.cloud:Response: {"code":"3004","msg":"value is illegal."}
DEBUG:msmart.cloud:Error ignored: '3004' - 'value is illegal.'
DEBUG:msmart.cloud:Retrying API call: '/v1/user/login/id/get'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/user/login/id/get HTTP/1.1" 200 41
DEBUG:msmart.cloud:Response: {"code":"3004","msg":"value is illegal."}
DEBUG:msmart.cloud:Error ignored: '3004' - 'value is illegal.'
DEBUG:msmart.cloud:Retrying API call: '/v1/user/login/id/get'
Traceback (most recent call last):
  File "/home/bballou/.local/bin/midea-discover", line 8, in <module>
    sys.exit(discover())
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/bballou/.local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/bballou/.local/lib/python3.10/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 "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 205, in get
    await self._process_tasks([task])
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 199, in _process_tasks
    [self.result.add(task.result()) for task in tasks]
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 199, in <listcomp>
    [self.result.add(task.result()) for task in tasks]
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 50, in support_test
    _device = await self.support_testv3(account, password)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 65, in support_testv3
    token, key = await loop.run_in_executor(None, gettoken, udpid, account, password)
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/scanner.py", line 255, in gettoken
    Client.login()
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 143, in login
    self.get_login_id()
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 132, in get_login_id
    response = self.api_request(
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 121, in api_request
    return self.api_request(endpoint, args)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 121, in api_request
    return self.api_request(endpoint, args)
  File "/home/bballou/.local/lib/python3.10/site-packages/msmart/cloud.py", line 123, in api_request
    raise RecursionError()
RecursionError

Xe138 avatar Aug 01 '23 02:08 Xe138

Confirmed the same behavior on my end. Maybe Midea has changed their API or something

mill1000 avatar Aug 01 '23 02:08 mill1000

I believed I've fixed this in my fork: mill1000/midea-ac-py

mill1000 avatar Aug 03 '23 22:08 mill1000

Tested and working well on my side. Thanks!

jkfoong avatar Aug 04 '23 03:08 jkfoong

I believed I've fixed this in my fork.

You can update msmart with pip like so

pip install git+https://github.com/mill1000/midea-msmart.git

Thank you! How do Install your version? I am not sure how this work in Home Assistant

TopoTop1 avatar Nov 29 '23 19:11 TopoTop1

Thank you! How do Install your version? I am not sure how this work in Home Assistant

My fork is now a default in HACs. You can either search for "Midea Smart AC" or click the link here: https://github.com/mill1000/midea-ac-py/#install-via-hacs

Edit: Or if you're just looking for an updated tool to discover tokens & keys see this fork: https://github.com/mill1000/midea-msmart

mill1000 avatar Nov 29 '23 20:11 mill1000

Yes sir, thanks for doing this BTW. I just found it, installed it and am working through it but it will not discover my Midea Cube Dehumes. The original AC LAN one from the other guy does discover them. I used that version to get my ID’s, and then used yours to try to install. Your fork will not auto discover so I went manually and input the IDs, IP Addressees and used the default port but the error I get is here. Thoughts?:  Sent from Mail for Windows From: Tucker KernSent: Wednesday, November 29, 2023 2:02 PMTo: mac-zhou/midea-ac-pyCc: TopoTop1; CommentSubject: Re: [mac-zhou/midea-ac-py] midea-discover returns code 3004 "value is illegal" (Issue #217) Thank you! How do Install your version? I am not sure how this work in Home AssistantMy fork is now a default in HACs. You can either search for "Midea Smart AC" or click the link here: https://github.com/mill1000/midea-ac-py/#install-via-hacs—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: ***@***.***> 

TopoTop1 avatar Nov 29 '23 20:11 TopoTop1

My integration only supports air conditioning type devices. You should continue to use georgezhao2010/midea_ac_lan integration with your dehumidifiers.

mill1000 avatar Nov 29 '23 20:11 mill1000

Ok bummer. Thanks.

His is broken and won't login to the cloud.

Yours looks great. I hope ypu decide to add dehumes as your install is cleaner, UI experience is easier.

Keep up the great work!

On Wed, Nov 29, 2023, 2:23 PM Tucker Kern @.***> wrote:

My integration only supports air conditioning type devices. You should continue to use georgezhao2010's midea_ac_lan https://github.com/georgezhao2010/midea_ac_lan integration with your dehumidifiers.

— Reply to this email directly, view it on GitHub https://github.com/mac-zhou/midea-ac-py/issues/217#issuecomment-1832645529, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEKNA43QE6B242KHNTS2XA3YG6KSJAVCNFSM6AAAAAA264LJBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZSGY2DKNJSHE . You are receiving this because you commented.Message ID: @.***>

TopoTop1 avatar Nov 29 '23 20:11 TopoTop1