nbogojevic / homeassistant-midea-air-appliances-lan

This Home Assistant custom component adding support for controlling Midea air conditioners and dehumidifiers on local network.
MIT License
331 stars 32 forks source link

Comfee Smartcool 7000 Failed to get TCP key #75

Closed marcohald closed 10 months ago

marcohald commented 2 years ago

Version of the custom_component

0.8.11

Describe the bug

This Error occurs when I try to add a Comfee Smartcool 7000 with the Wizard. If a network trace or anything else is needed, I'm happy to provide it.

Debug log


2022-07-29 11:15:29 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP request /v1/multicloud/platform/user/route: {'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': '5b32216a5175f269dda0a69b7eabbfd7676047ed32a747166e2f9eb11226afaa', 'secretVersion': '1', 'random': '1659086129', 'version': '2.22.0', 'systemVersion': '8.1.0', 'platform': '0', 'Accept-Encoding': 'identity', 'Content-Type': 'application/json'} {'appId': 1010, 'format': 2, 'clientType': 1, 'language': 'en_US', 'src': 1010, 'stamp': '20220729111529', 'userName': 'comfee@*******', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': '8468ad14c7696bb69439513f524bd504', 'retryCount': '3', 'uid': '', 'userType': '0'}
2022-07-29 11:15:30 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn't connect to 192.168.178.216:5555.  TcpTimeoutException: Connecting to 192.168.178.216:5555 timed out (1.0 seconds)
2022-07-29 11:15:32 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
2022-07-29 11:15:41 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response text: {"msg":"ok","code":0,"data":{"masUrl":"https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=","sseUrl":"https://sse.msmartlife.net","idAdapt":"131329","countryCode":"HK"}}
2022-07-29 11:15:41 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response: {'msg': 'ok', 'code': 0, 'data': {'masUrl': 'https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=', 'sseUrl': 'https://sse.msmartlife.net', 'idAdapt': '131329', 'countryCode': 'HK'}}
2022-07-29 11:15:41 DEBUG (SyncWorker_3) [midea_beautiful.cloud] using key='data', result={'masUrl': 'https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=', 'sseUrl': 'https://sse.msmartlife.net', 'idAdapt': '131329', 'countryCode': 'HK'}
2022-07-29 11:15:42 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
2022-07-29 11:15:50 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response: *** REDACTED ***
2022-07-29 11:15:50 DEBUG (SyncWorker_3) [midea_beautiful.cloud] using key='data', result=*** REDACTED ***
2022-07-29 11:15:50 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP request /mj/user/login: {'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': 'fa9657d710404efd3a7a925eb3470a8581efabb3b3a0895eaae4293ac982dec7', 'secretVersion': '1', 'random': '1659086150', 'version': '2.22.0', 'systemVersion': '8.1.0', 'platform': '0', 'Accept-Encoding': 'identity', 'Content-Type': 'application/json'} {'data': {'appKey': 'ac21b9f9cbfe4ca5a88562ef25e2b768', 'appVersion': '2.22.0', 'osVersion': '8.1.0', 'platform': '2'}, 'iotData': {'appId': '1010', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientType': 1, 'clientVersion': '2.22.0', 'format': 2, 'language': 'en_US', 'iampwd': '****************************************************************', 'loginAccount': 'comfee@*******', 'password': '****************************************************************', 'pushToken': 'pTR8Y6JBqRGJiAwg0yTPSxClLKLXFLPq-LWqYYZW1KpUHzVV6F4pvfagfsWo4f8XWalC2o3-RcSNmQnURhKSoWQl92HgYctnFmX_zFnfPgOiHOI6sDZP5_dNN5sKqVitrF5W2ziBXRzV2SDiEgE5Vsrn3KdN7U1w', 'pushType': '4', 'reqId': '38fe956ce0d8474296f453a8a1a6928b', 'retryCount': '3', 'src': '10', 'stamp': '20220729111550'}, 'reqId': 'fa0885579730cf09b2fce8982fccd550', 'stamp': '20220729111550'}
2022-07-29 11:15:52 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
2022-07-29 11:16:02 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response: *** REDACTED ***
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful.cloud] using key='data', result=*** REDACTED ***
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful.cloud] UID=ee45b1def57349270e3dc3ef912ea625
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful] Library version=0.9.14
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful] Scanning for midea dehumidifier appliances via ['255.255.255.255', '192.168.179.130']
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful.scanner] Starting LAN discovery
2022-07-29 11:16:06 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP request /v1/appliance/user/list/get: {'uid': '********************************', 'accessToken': '*****************', 'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': '7609d085364c169e35e2677adad4a383317b75c6a068c41b0834d3e4ba719c50', 'secretVersion': '1', 'random': '1659086166', 'version': '2.22.0', 'systemVersion': '8.1.0', 'platform': '0', 'Accept-Encoding': 'identity', 'Content-Type': 'application/json'} {'appId': 1010, 'format': 2, 'clientType': 1, 'language': 'en_US', 'src': 1010, 'stamp': '20220729111606', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': '53872fb3d5f56b0be7070afd6de3f253', 'retryCount': '3', 'uid': '********************************', 'userType': '0'}
2022-07-29 11:16:12 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response text: {"code":"0","msg":"ok","data":{"list":[{"id":"144036023278063","userId":null,"wifiVersion":"150029092122","sn":"f1a03c04c2d075e22d9f74bc800fe923e54f9cbb7d5652bfc9f85c28501b2230d41b751232461a79ecb8b6f54b95dba0","onlineStatus":"1","type":"0xAC","modelNumber":"44204","name":"Klimaanlage","des":"","activeStatus":"1","userType":"1","homegroupId":null,"homegroupNumber":null,"homegroupCreateUserId":null,"tsn":null,"mac":null,"registerTime":"Tue Jul 26 06:28:46 UTC 2022","uid":"********************************","existTemplate":0,"templateOfTSL":null}]}}
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response: {'code': '0', 'msg': 'ok', 'data': {'list': [{'id': '144036023278063', 'userId': None, 'wifiVersion': '150029092122', 'sn': 'f1a03c04c2d075e22d9f74bc800fe923e54f9cbb7d5652bfc9f85c28501b2230d41b751232461a79ecb8b6f54b95dba0', 'onlineStatus': '1', 'type': '0xAC', 'modelNumber': '44204', 'name': 'Klimaanlage', 'des': '', 'activeStatus': '1', 'userType': '1', 'homegroupId': None, 'homegroupNumber': None, 'homegroupCreateUserId': None, 'tsn': None, 'mac': None, 'registerTime': 'Tue Jul 26 06:28:46 UTC 2022', 'uid': '********************************', 'existTemplate': 0, 'templateOfTSL': None}]}}
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.cloud] using key='data', result={'list': [{'id': '144036023278063', 'userId': None, 'wifiVersion': '150029092122', 'sn': 'f1a03c04c2d075e22d9f74bc800fe923e54f9cbb7d5652bfc9f85c28501b2230d41b751232461a79ecb8b6f54b95dba0', 'onlineStatus': '1', 'type': '0xAC', 'modelNumber': '44204', 'name': 'Klimaanlage', 'des': '', 'activeStatus': '1', 'userType': '1', 'homegroupId': None, 'homegroupNumber': None, 'homegroupCreateUserId': None, 'tsn': None, 'mac': None, 'registerTime': 'Tue Jul 26 06:28:46 UTC 2022', 'uid': '********************************', 'existTemplate': 0, 'templateOfTSL': None}]}
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.cloud] Midea appliance list results=[{'id': '14403602327****', 'name': 'Klimaanlage', 'sn': '000000P0000000Q17086CE21********', 'type': '0xAC', 'modelNumber': '44204'}]
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.scanner] Broadcast attempt 1 of max 3
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.scanner] Broadcasting to 255.255.255.255
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.scanner] UDP broadcast 255.255.255.255:6445 b'ZZ\x01\x11H\x00\x92\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7fu\xbdk>O\x8bv.\x84\x9cnW\x8de\x90\x03n\x9dCB\xa5\x0f\x1fV\x9e\xb8\xec\x91\x8e\x92\xe5'
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.scanner] Broadcasting to 192.168.179.130
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.scanner] UDP broadcast 192.168.179.130:6445 b'ZZ\x01\x11H\x00\x92\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x7fu\xbdk>O\x8bv.\x84\x9cnW\x8de\x90\x03n\x9dCB\xa5\x0f\x1fV\x9e\xb8\xec\x91\x8e\x92\xe5'
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.scanner] Reply from address=192.168.179.130 payload=b'\x83p\x00\xc8 \x0f\x00\x00ZZ\x01\x11\xb8\x00z\x80\x00\x00\x00\x007\x90\x10\t\x1d\x07\x16\x14\xef\x99\x00\x00\x00\x83\x00\x00\x00\x00\x00\x00\x00\x00\x01\x80\x00\x00\x00\x00\xba\xd2Ht\x98\xd7=\xa0!\xf7\xde\xcc3\xb2\x87\xe4\x8b\xbf~\xd2\xf0\x92u0\x06\xc3\xb2\xd8\xbf\x12\x85\x15)\xef\xa9\xb1}\xc7\xdf\xfa\x9eV\x1d\xa3Y!\x05\xa3C\x8b3\x1el;\x93>\xcc\x06\x15\xc2\xb8\x9c\xba\x1b.\xda\ndP\x1cY\xde.GB!\xbf\x81\x8e\x98\x16\xc6\xd7\x07\x17h\x82\xc8\x0e\xb8\x92-{\x8bKrK\xdf\xb3\xe1n3\xd8\x87h\xccL=\x06X\x93}\x0b\xb1\x93i\xbf\x03\x17\xb2M:M\xe9\xe6\xa11\x06*\x18;k\xbaH\x06\x04\x88?\x8c\xf4J\x99\xbd\x1c\x14\x80x\xfc\xfcp\x02C\xfb\xa2\xd2\xb5\xe0\xde\x18\xcb'
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.lan] From 192.168.17***** decrypted reply=b'\x82\xb3\xa8\xc0,\x19\x00\x00000000P0000000Q17086CE21********\x0bnet_ac_F350\x00\x00\x87\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\x00\xac\xac\x00\x00\x00\x00p\x86\xce!\xf3P\x15\x00)\t!"\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.appliance] Creating AirConditionerAppliance 14403602327****
2022-07-29 11:16:16 DEBUG (SyncWorker_3) [midea_beautiful.lan] Descriptor data '{id=14403602327****, address=192.168.17*****, port=6444, version=3, name=14403602327****, online=True, type=0xac, subtype=acac, flags=0, extra=2, reserved=87, mac=7086ce2*****, ssid=net_ac_F350, udp_version=0, protocol=150029, version=9.33.34, sn=000000P0000000Q17086CE21********, state=[Air conditioner]{id=14403602327****, type=0xac mode=0, running=False, turbo=False, fan_speed=40, turbo_fan=False, purifier=False, dryer=False, target_temperature=0, indoor_temperature=2.2250738585072014e-308, outdoor_temperature=2.2250738585072014e-308, vertical_swing=False horizontal_swing=False comfort_sleep=False, error_code=0, prompt=False, supports={}}}'
2022-07-29 11:16:19 DEBUG (SyncWorker_3) [midea_beautiful.scanner] Finished broadcast collection
2022-07-29 11:16:19 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP request /v1/iot/secure/getToken: {'uid': '********************************', 'accessToken': '*****************', 'x-recipe-app': '1010', 'Authorization': 'Basic ********************************************************', 'sign': '2d26d7949e39338d132f561d25d3bc99e814f370d9128c93a0396775f0921fc8', 'secretVersion': '1', 'random': '1659086179', 'version': '2.22.0', 'systemVersion': '8.1.0', 'platform': '0', 'Accept-Encoding': 'identity', 'Content-Type': 'application/json'} {'appId': 1010, 'format': 2, 'clientType': 1, 'language': 'en_US', 'src': 1010, 'stamp': '20220729111619', 'udpid': '684f6346c9ffa8f0bc20bfa2b0d70d7e', 'appVNum': '2.22.0', 'appVersion': '2.22.0', 'clientVersion': '2.22.0', 'platformId': '1', 'reqId': '2a0556576e1f9e1acaddad521e8df2c7', 'retryCount': '3', 'uid': '********************************', 'userType': '0'}
2022-07-29 11:16:22 WARNING (MainThread) [homeassistant.components.binary_sensor] Updating ping binary_sensor took longer than the scheduled update interval 0:00:05
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.cloud] HTTP response: *** REDACTED ***
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.cloud] using key='data', result=*** REDACTED ***
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.lan] token='7C7C7EAC17EA94B23266813ACABC8600A5117F2D7C529DB3953E4680C03EDBC7****************************************************************' key='4ABE9267103143C596A8DAEDCDE5F5F5********************************' for sn=000000P0000000Q17086CE21******** id=14403602327**** address=192.168.17***** version=3
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.lan] Attempting new connection to sn=000000P0000000Q17086CE21******** id=14403602327**** address=192.168.17***** version=3
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.lan] Sending to sn=000000P0000000Q17086CE21******** id=14403602327**** address=192.168.17***** version=3, message=b'\x83p\x00@ \x00\x00\x00||~\xac\x17\xea\x94\xb22f\x81:\xca\xbc\x86\x00\xa5\x11\x7f-|R\x9d\xb3\x95>F\x80\xc0>\xdb\xc7{Xd\xdf\xde\xc2\x91\xb1\xbe \xe8"\x9b\xe1\xec\xf3P5m/\xfb\xa7\x8b\x9ej\xc6&p\xc3\x1eJ~'
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.lan] From sn=000000P0000000Q17086CE21******** id=14403602327**** address=192.168.17***** version=3, message=b'\x83p\x00\x05 \x0f\xa5\xa5ERROR'
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.lan] handshake_response=b'\x83p\x00\x05 \x0f\xa5\xa5ERROR' for sn=000000P0000000Q17086CE21******** id=14403602327**** address=192.168.17***** version=3
2022-07-29 11:16:29 DEBUG (SyncWorker_3) [midea_beautiful.lan] Token check failed for udp_id=684f6346c9ffa8f0bc20bfa2b0d70d7e, Failed to get TCP key for 000000P0000000Q17086CE21********, cause Authentication failed - error packet
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/midea_beautiful/lan.py", line 517, in _get_tcp_key
    tcp_key = self._security.tcp_key(response, binascii.unhexlify(self.key))
  File "/usr/local/lib/python3.10/site-packages/midea_beautiful/crypto.py", line 409, in tcp_key
    raise AuthenticationError("Authentication failed - error packet")
midea_beautiful.exceptions.AuthenticationError: Authentication failed - error packet

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/midea_beautiful/lan.py", line 736, in _get_valid_token
    self._authenticate()
  File "/usr/local/lib/python3.10/site-packages/midea_beautiful/lan.py", line 513, in _authenticate
    self._get_tcp_key(response)
  File "/usr/local/lib/python3.10/site-packages/midea_beautiful/lan.py", line 528, in _get_tcp_key
    raise AuthenticationError(
midea_beautiful.exceptions.AuthenticationError: Failed to get TCP key for 000000P0000000Q17086CE21********, cause Authentication failed - error packet
github-actions[bot] commented 10 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.