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

OSK103 - midea discover error #187

Open
krzysztofbalana2 opened this issue Aug 1, 2022 · 4 comments
Open

OSK103 - midea discover error #187

krzysztofbalana2 opened this issue Aug 1, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@krzysztofbalana2
Copy link

krzysztofbalana2 commented Aug 1, 2022

Describe the bug (描述一下问题)
After entering midea-discover -d I'm getting this error:

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:Broadcast message sent: 1
DEBUG:msmart.scanner:Midea Local Data 192.168.50.168 837000b8200f04145a5a0111a8007a80000000000000000000000000275800000012000000000000000000000000000017b4a5125592b3622931514d1ff1d1770f85a48e1574b35652f11f11700acc308fe622f19bd8c4b45ab5fa11114080c3fdd392323475fbdacf45594a337fd438526d3ee9804964045d28c587b491fa8d1fca94541303884c52e880ddefc03190f31443d17c3aac03a7656614ae1dca44dd9b2a6d97629fd172771e6c2216f3476f7bd6472e63d20feb4655edbf3fc639
DEBUG:msmart.scanner:Decrypt Reply: 192.168.50.168 a832a8c02c19000030303030303050303030303030305131353032444242354145373638303030300b6e65745f61635f453736380000000001000000040000000000ac00000000000000502dbb5ae768069fcd0300080103000000000000000000000000000000000000000000
DEBUG:msmart.scanner:Midea Local Data 192.168.50.82 837000b8200f041f5a5a0111a8007a80000000000000000000000000b95d0000001300000000000000000000000000004b47ef31539d37d9c3b01873c3f2a7b30f85a48e1574b35652f11f11700acc30639d1becbd4aca3e6bce13fc8e321b66e0a5c04c358d62b9e1607b40d021f3252322e0e2a98aaee0b4c957971fee2af71fca94541303884c52e880ddefc03190f31443d17c3aac03a7656614ae1dca44f4c93140283968e51a3b0b19d14317c05e126cef4685cfc286aa6bdc0cb7a3d0
DEBUG:msmart.scanner:Decrypt Reply: 192.168.50.82 5232a8c02c19000030303030303050303030303030305131353032444242354143373244303030300b6e65745f61635f433732440000000001000000040000000000ac00000000000000502dbb5ac72d069fcd0300080103000000000000000000000000000000000000000000
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 77
DEBUG:msmart.cloud:Response: {"code":"0","msg":"ok","data":{"loginId":"3f7e28ee-a889-45ba-8135-5488ccc8"}}
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=/mj/user/login HTTP/1.1" 200 867
DEBUG:msmart.cloud:Response: {"code":0,"msg":"成功","data":{"randomData":"85eac9ea21c3e0c915f4ee9f4f491a8612b05a48ac624e4edbeb31169d9e396d","uid":"93d06a9f1cb9d91dc10f13e72093db55","accountId":"3276838999","nickname":"midea_is_best@outlook.com","mdata":{"tokenPwdInfo":{"tokenPwd":"7c667b658d364b658a79181e6223d93d","expiredDate":1661981839744,"createDate":1659389839744},"userInfo":{"sourceId":"mj_12345","empId":"4732773915458560","address":"","gender":"0","mobile":"midea_is_best@outlook.com","userDeptInfoList":null,"extras":null,"nameEn":null,"employeeNumber":null,"headPhoto":null,"uid":"93d06a9f1cb9d91dc10f13e72093db55","name":"midea_is_best@outlook.com","email":null},"doDeviceBind":null,"accessToken":"T1c0kb9v9slc1gebz","signUnlockEnabled":null},"accessToken":"fd3c52ce357f185cb3466977a153c9cd34aada1f4504ef4c522206e148da1a8e","userId":"5496469","email":"midea_is_best@outlook.com"}}
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/iot/secure/getToken HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","code":"0","data":{"tokenlist":[{"udpId":"6f7bd6472e63d20feb4655edbf3fc639","key":"3480186913064DCB8F04956497AA9A08A62FAEC242FD410B9935153030017F6E","token":"E4A96264D39480D98BB6446D36FEB606AB4D71F0EAFD10EDF1DD45D32CEEA955C06C6C0046F1EC936B608798C1906B6D96ABE9CD077FBE4FBF7363E199616659"}]}}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mp-prod.appsmb.com:443
DEBUG:msmart.lan:Attempting new connection to 192.168.50.168:6444
DEBUG:msmart.lan:Socket 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 0.0 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 0.0 message: 8370004020000000e4a96264d39480d98bb6446d36feb606ab4d71f0eafd10edf1dd45d32ceea955c06c6c0046f1ec936b608798c1906b6d96abe9cd077fbe4fbf7363e199616659
DEBUG:msmart.lan:Recv 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 0.34 Response: 8370004020010000201d7a2228a57da1e0b92474270c53c4f831d0ca24859d030540312871b1b8ab2f4eb41b6b6ef09ac32a5b3fba7dd6bfc613158f358323bc89f94668b89ecf67
INFO:msmart.lan:Got TCP key for 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 0.34 tcp_key: 3f5494a9d3b44428a9531f85540e92e81679a7238092c9ea62e31dd1f24b778f
DEBUG:urllib3.connectionpool:https://mp-prod.appsmb.com:443 "POST /mas/v5/app/proxy?alias=/v1/iot/secure/getToken HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"ok","code":"0","data":{"tokenlist":[{"udpId":"5e126cef4685cfc286aa6bdc0cb7a3d0","key":"3025C405F9814DF39B519214541C1ADC85DE0150144D4004B506A0C18B8CE38B","token":"DF0F34BCB5B59A74FE13883719628DD66464E7775271970A028FCB73A8C93AF0A1DD3B6A2F2D39F68CC84833EEB49734158549226423DC9C930DAF224E918341"}]}}
DEBUG:msmart.lan:Attempting new connection to 192.168.50.82:6444
DEBUG:msmart.lan:Socket 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 0.0 tcp_key: None
DEBUG:msmart.lan:Sending 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 0.0 message: 8370004020000000df0f34bcb5b59a74fe13883719628dd66464e7775271970a028fcb73a8c93af0a1dd3b6a2f2d39f68cc84833eeb49734158549226423dc9c930daf224e918341
DEBUG:msmart.lan:Recv 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 0.46 Response: 837000402001000081673f8b568a55889bea65b2e4d9bbcba3376e265c8b2ae99227fe3155e4114fa5276eaa9bb7d79dc75d291082faf87ac20e2061e4a3cae13fd4427a43874aa9
INFO:msmart.lan:Got TCP key for 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 0.46 tcp_key: 9b1bd4dcd563d51feb700ffce713033698301ab8e8f459ed9ecfb829502e7a63
DEBUG:msmart.base_command:Frame data: aa21ac8d000000000003418100ff03ff000200000000000000000000000003016971
DEBUG:msmart.device.base:pkt_builder: 192.168.50.168:6444 len: 104 data: 5a5a0111680020000000000015162516010816142758000000120000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b12486e10c552981b23022cb71ea0fc54dc25ecfa0ce55888ac57fc42a7eacc3285d37d85ba135a3e4815e357ca0233e9eb25a
DEBUG:msmart.lan:Socket 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 1.35 tcp_key: 3f5494a9d3b44428a9531f85540e92e81679a7238092c9ea62e31dd1f24b778f
DEBUG:msmart.lan:Sending 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 1.35 message: 8370008e206625574924acb4cce74dd818101c1cc2c7c32a2d95a4b0f0bd5b6c98296b2fe66e3321541e863d72541afaa5d86e3d11b6dbf685c9cd9c0f04e5fd02b90ca59ecaa0c11f8115a721ef251a0136dde98c8cc9d292f3edab3d55a15a19e5ed343c528a837bf26757729c1281e413f364b3b881a7b0398ebf63466bfa6e8c3ed3dd7717f2337e131298dc5148456df8fd43d7
DEBUG:msmart.lan:Recv 192.168.50.234:33446 -> 192.168.50.168:6444 retries: 0 time: 1.83 Response: 8370007e20635f215168d0f75cbf87a9e3c761d43112051f7ecb13364d6b26b1710df4cd424682eaef33f0d9b4ed45739665b8effebbe4f5ac770bcea0727165d9720bbc1a5768098801593dd4aad09527560227a4dc48218887f44615d522668510273b2e014fd115c33086bf787dd3cd7b6b982ca29e3f18fd5bf2aea2c5a342bdb3848ef9
DEBUG:msmart.lan:Got responses len: 134
DEBUG:msmart.device.base:Got responses from 192.168.50.168:6444 Version: 3 Count: 1 Spend time: 0.49
DEBUG:msmart.device.base:Update from 192.168.50.168:6444 aa1eac00000000000003c00068667f7f00000000006556000000000000b933
ERROR:msmart.device.AC.command:Payload 'c00068667f7f00000000006556000000000000b9' failed CRC. Received: 0xB9, Expected: 0x98.
DEBUG:msmart.base_command:Frame data: aa21ac8d000000000003418100ff03ff000200000000000000000000000003028b4e
DEBUG:msmart.device.base:pkt_builder: 192.168.50.82:6444 len: 104 data: 5a5a011168002000000000005a16251601081614b95d000000130000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b1248672946460bceafc6eae86e4200896522a734e1faa37ce959a047497632b36c8a8dbabbeba34843bf51d80a1b00f94007f
DEBUG:msmart.lan:Socket 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 1.46 tcp_key: 9b1bd4dcd563d51feb700ffce713033698301ab8e8f459ed9ecfb829502e7a63
DEBUG:msmart.lan:Sending 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 1.46 message: 8370008e206654bc20599deb0a26919718c81eb4bef617f093b6159d86b35f68b106a37c123418ac29c574da5f55204a24312fa83c2d7f8e5c60ea23678cafe92d5da44139b7b4771df594bc2e29b7039cfda1c5b7a2ccb0f800b5df0b41f03ebdf864b4b1224b04ff4f6ce3aef7d46e3a46185dd20ff2a890c872bb88239e2b46e1b1afa145073d7d45ed7681d9a3ed5e345b3b8cba
DEBUG:msmart.lan:Recv 192.168.50.234:44442 -> 192.168.50.82:6444 retries: 0 time: 1.95 Response: 8370007e206365b33d9f5bac7ae873fa14b8be203c789886b4b07351ed41878263c7301dbf0e939a6c4634bc47ffa619f3ca197e18947f5ed2ca996988d17b0b4dd8b02f9ecaa5edd4441b64c6a8b043fa8178021da700077957827c255e8c5e18d0ac7f48fe7a48afdff0f0e43b93f6646fa4aae4d98d8a5a5b041ad37a75c16af8cf0ac51c
DEBUG:msmart.lan:Got responses len: 134
DEBUG:msmart.device.base:Got responses from 192.168.50.82:6444 Version: 3 Count: 1 Spend time: 0.49
DEBUG:msmart.device.base:Update from 192.168.50.82:6444 aa1eac00000000000003c00089667f7f000000000066560000000000009733
ERROR:msmart.device.AC.command:Payload 'c00089667f7f0000000000665600000000000097' failed CRC. Received: 0x97, Expected: 0x8A.
Traceback (most recent call last):
  File "/home/krzysztof/.local/bin/midea-discover", line 8, in <module>
    sys.exit(discover())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/krzysztof/.local/lib/python3.9/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.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/scanner.py", line 193, in get_all
    await self._process_tasks(tasks)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/scanner.py", line 199, in _process_tasks
    [self.result.add(task.result()) for task in tasks]
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/scanner.py", line 199, in <listcomp>
    [self.result.add(task.result()) for task in tasks]
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/scanner.py", line 55, in support_test
    await loop.run_in_executor(None, _device.refresh)
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/appliance.py", line 109, in refresh
    self._send_cmd(cmd)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/appliance.py", line 114, in _send_cmd
    self._process_response(response)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/appliance.py", line 124, in _process_response
    if response.id == ResponseId.State:
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/command.py", line 206, in id
    return self._id
AttributeError: 'state_response' object has no attribute '_id'
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='Task-3' coro=<scandevice.support_test() done, defined at /home/krzysztof/.local/lib/python3.9/site-packages/msmart/scanner.py:47> exception=AttributeError("'state_response' object has no attribute '_id'")>
Traceback (most recent call last):
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/scanner.py", line 55, in support_test
    await loop.run_in_executor(None, _device.refresh)
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/appliance.py", line 109, in refresh
    self._send_cmd(cmd)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/appliance.py", line 114, in _send_cmd
    self._process_response(response)
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/appliance.py", line 124, in _process_response
    if response.id == ResponseId.State:
  File "/home/krzysztof/.local/lib/python3.9/site-packages/msmart/device/AC/command.py", line 206, in id
    return self._id
AttributeError: 'state_response' object has no attribute '_id'

Screenshots / Logs / Pcap File(屏幕截图/日志/抓包文件)
If applicable, add screenshots or your home-assistant log file or pcap file to help explain your problem.
请提交相关截图,日志,抓包让开发者能够更快的解决问题

Versions (版本信息)

  • Home Assistant version: irrelevant
  • Midea msmart version: latest, downloaded 02.08.2022
@krzysztofbalana2 krzysztofbalana2 added the bug Something isn't working label Aug 1, 2022
@krzysztofbalana3
Copy link

krzysztofbalana3 commented Aug 5, 2022

Reverting to msmart-0.2.3 version did the thing, but issue remains.

@mill1000
Copy link

mill1000 commented Aug 5, 2022

What do you mean "did the thing"? Same issue?

@krzysztofbalana3
Copy link

I apologise. From the time perspective I see that my answer wasn't much obvious to understand. I've meant that reverting to 0.2.3 made devices to be discovered without any issues. But on 0.2.5 problem still remains.

@mill1000
Copy link

Well 0.2.3 doesn't have this problem because it doesn't check the CRC of received messages.

In v0.2.5+ we could either:
A. Ignore failed CRCs (without throwing), and hope we get good data later
B. Remove CRC checks entirely
C. Find out why the CRC differs. New CRC algorithm? Incorrect packet length?

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