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

midea-discover returns code 3004 "value is illegal" #217

Open
Xe138 opened this issue Jul 31, 2023 · 10 comments · Fixed by mill1000/midea-msmart#17
Open

midea-discover returns code 3004 "value is illegal" #217

Xe138 opened this issue Jul 31, 2023 · 10 comments · Fixed by mill1000/midea-msmart#17
Labels
bug Something isn't working

Comments

@Xe138
Copy link

Xe138 commented Jul 31, 2023

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 Xe138 added the bug Something isn't working label Jul 31, 2023
@mill1000
Copy link

mill1000 commented Aug 1, 2023

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

@Xe138
Copy link
Author

Xe138 commented Aug 1, 2023

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

@mill1000
Copy link

mill1000 commented Aug 1, 2023

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

mill1000 added a commit to mill1000/midea-msmart that referenced this issue Aug 3, 2023
The API recently started requiring this. Close #16, and close mac-zhou/midea-ac-py#217
mill1000 added a commit to mill1000/midea-msmart that referenced this issue Aug 3, 2023
The API recently started requiring this. Close #16, and close mac-zhou/midea-ac-py#217
@mill1000
Copy link

mill1000 commented Aug 3, 2023

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

@jkfoong
Copy link

jkfoong commented Aug 4, 2023

Tested and working well on my side. Thanks!

@TopoTop1
Copy link

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

@mill1000
Copy link

mill1000 commented Nov 29, 2023

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

@TopoTop1
Copy link

TopoTop1 commented Nov 29, 2023 via email

@mill1000
Copy link

mill1000 commented Nov 29, 2023

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

@TopoTop1
Copy link

TopoTop1 commented Nov 29, 2023 via email

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

Successfully merging a pull request may close this issue.

4 participants