Closed seppe912 closed 1 year ago
Hi,
Thanks for trying the project. I've seen that error once or twice and figured it was just some transient error, but looks like you and another use have encountered it. (https://github.com/mill1000/midea-ac-py/issues/22)
Does the issue persist if you try to discover again with 2023.9.0?
I think I've got a fix here: #39
Care to try it out?
everytime i discover, its not working. I´ve tested your new code, but its still the same:
29.08 20:33 asyncio DEBUG Using selector: EpollSelector
29.08 20:33 discover.py INFO Sending Device Scan Broadcast...
29.08 20:33 msmart.discover DEBUG Discovery sent to 255.255.255.255:6445.
29.08 20:33 msmart.discover DEBUG Discovery sent to 255.255.255.255:20086.
29.08 20:33 msmart.discover DEBUG Waiting 5 seconds for responses...
29.08 20:33 msmart.discover DEBUG Discovered 0 devices.
29.08 20:33 asyncio DEBUG Using selector: EpollSelector
29.08 20:33 discover.py INFO Sending Device Scan Broadcast...
29.08 20:33 msmart.discover DEBUG Discovery sent to 255.255.255.255:6445.
29.08 20:33 msmart.discover DEBUG Discovery sent to 255.255.255.255:20086.
29.08 20:33 msmart.discover DEBUG Waiting 5 seconds for responses...
29.08 20:33 msmart.discover DEBUG Discovery response from 192.168.178.80: 837000b8200f040b5a5a0111a8007a80000000000000000000000000a99100000012000000000000000000000000000003ed0628a5844485ef4501f937db456f370e9e5f4f939ce754af13b17d3d951c5bba106fb18ae0300ff40910de5101216d2257804fe941f9f3b7bda6c8256507f13e7784445e5328eb483a660cc2da361fca94541303884c52e880ddefc03190f31443d17c3aac03a7656614ae1dca44cce568b2ac09aeb62be232e568e8516d21bfb84f560d393142677f8172711b3b
29.08 20:33 msmart.discover DEBUG Decrypted data from 192.168.178.80: 50b2a8c02c19000030303030303050303030303030305131463043394431433137383033303030300b6e65745f61635f373830330000000001000000040000000000ac00000000000000f0c9d1c17803069fcd0300080103000000000000000000000000000000000000000000
29.08 20:33 msmart.cloud INFO Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
29.08 20:33 httpx DEBUG load_ssl_context verify=True cert=None trust_env=True http2=False
29.08 20:33 httpx DEBUG load_verify_locations cafile='/opt/loxberry/bin/plugins/Midea2Lox/venv/lib/python3.9/site-packages/certifi/cacert.pem'
29.08 20:33 httpcore.connection DEBUG connect_tcp.started host='mp-prod.appsmb.com' port=443 local_address=None timeout=5.0 socket_options=None
29.08 20:33 httpcore.connection DEBUG connect_tcp.complete return_value=
29.08 20:33 httpcore.connection DEBUG start_tls.started ssl_context= server_hostname='mp-prod.appsmb.com' timeout=5.0
29.08 20:33 httpcore.connection DEBUG start_tls.complete return_value=
29.08 20:33 httpcore.http11 DEBUG send_request_headers.started request=
29.08 20:33 httpcore.http11 DEBUG send_request_headers.complete
29.08 20:33 httpcore.http11 DEBUG send_request_body.started request=
29.08 20:33 httpcore.http11 DEBUG send_request_body.complete
29.08 20:33 httpcore.http11 DEBUG receive_response_headers.started request=
29.08 20:33 httpcore.http11 DEBUG receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'', [(b'Server', b'nginx/1.17.5'), (b'Date', b'Tue, 29 Aug 2023 18:33:16 GMT'), (b'Content-Type', b'application/json'), (b'Content-Length', b'77'), (b'Connection', b'keep-alive'), (b'X-Kong-Upstream-Latency', b'6'), (b'X-Kong-Proxy-Latency', b'285'), (b'Via', b'kong/2.0.2')])
29.08 20:33 httpx INFO HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/user/login/id/get "HTTP/1.1 200 "
29.08 20:33 httpcore.http11 DEBUG receive_response_body.started request=
29.08 20:33 httpcore.http11 DEBUG receive_response_body.complete
29.08 20:33 httpcore.http11 DEBUG response_closed.started
29.08 20:33 httpcore.http11 DEBUG response_closed.complete
29.08 20:33 msmart.cloud DEBUG API response: {"code":"0","msg":"ok","data":{"loginId":"a6bb0fe2-9af4-40a9-b0c3-31117858"}}
29.08 20:33 httpcore.connection DEBUG close.started
29.08 20:33 httpcore.connection DEBUG close.complete
29.08 20:33 msmart.cloud DEBUG Received loginId: a6bb0fe2-9af4-40a9-b0c3-31117858
29.08 20:33 httpx DEBUG load_ssl_context verify=True cert=None trust_env=True http2=False
29.08 20:33 httpx DEBUG load_verify_locations cafile='/opt/loxberry/bin/plugins/Midea2Lox/venv/lib/python3.9/site-packages/certifi/cacert.pem'
29.08 20:33 httpcore.connection DEBUG connect_tcp.started host='mp-prod.appsmb.com' port=443 local_address=None timeout=5.0 socket_options=None
29.08 20:33 httpcore.connection DEBUG connect_tcp.complete return_value=
29.08 20:33 httpcore.connection DEBUG start_tls.started ssl_context= server_hostname='mp-prod.appsmb.com' timeout=5.0
29.08 20:33 httpcore.connection DEBUG start_tls.complete return_value=
29.08 20:33 httpcore.http11 DEBUG send_request_headers.started request=
29.08 20:33 httpcore.http11 DEBUG send_request_headers.complete
29.08 20:33 httpcore.http11 DEBUG send_request_body.started request=
29.08 20:33 httpcore.http11 DEBUG send_request_body.complete
29.08 20:33 httpcore.http11 DEBUG receive_response_headers.started request=
29.08 20:33 msmart.discover DEBUG Discovered 1 devices.
29.08 20:33 httpcore.http11 DEBUG receive_response_headers.failed exception=ReadTimeout(TimeoutError())
29.08 20:33 httpcore.http11 DEBUG response_closed.started
29.08 20:33 httpcore.http11 DEBUG response_closed.complete
29.08 20:33 msmart.cloud WARNING Request to https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/mj/user/login timed out.
29.08 20:33 httpcore.connection DEBUG connect_tcp.started host='mp-prod.appsmb.com' port=443 local_address=None timeout=5.0 socket_options=None
29.08 20:33 httpcore.connection DEBUG connect_tcp.complete return_value=
29.08 20:33 httpcore.connection DEBUG start_tls.started ssl_context= server_hostname='mp-prod.appsmb.com' timeout=5.0
29.08 20:33 httpcore.connection DEBUG start_tls.complete return_value=
29.08 20:33 httpcore.http11 DEBUG send_request_headers.started request=
29.08 20:33 httpcore.http11 DEBUG send_request_headers.complete
29.08 20:33 httpcore.http11 DEBUG send_request_body.started request=
29.08 20:33 httpcore.http11 DEBUG send_request_body.complete
29.08 20:33 httpcore.http11 DEBUG receive_response_headers.started request=
29.08 20:33 httpcore.http11 DEBUG receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'OK', [(b'Server', b'nginx/1.17.5'), (b'Date', b'Tue, 29 Aug 2023 18:33:23 GMT'), (b'Content-Type', b'application/json;charset=UTF-8'), (b'Content-Length', b'86'), (b'Connection', b'keep-alive'), (b'Access-Control-Allow-Headers', b'access-token,x-auth-token,content-type,X-Requested-With,XMLHttpRequest'), (b'Access-Control-Allow-Methods', b'POST,GET,PUT,OPTIONS,DELETE'), (b'Access-Control-Allow-Origin', b'*'), (b'Access-Control-Max-Age', b'3600'), (b'Cache-Control', b'no-cache, no-store, max-age=0, must-revalidate'), (b'Expires', b'0'), (b'Pragma', b'no-cache'), (b'X-Application-Context', b'muc-application:7272'), (b'X-Content-Type-Options', b'nosniff'), (b'X-Frame-Options', b'DENY'), (b'X-Xss-Protection', b'1; mode=block'), (b'X-Kong-Upstream-Latency', b'1860'), (b'X-Kong-Proxy-Latency', b'284'), (b'Via', b'kong/2.0.2')])
29.08 20:33 httpx INFO HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/mj/user/login "HTTP/1.1 200 OK"
29.08 20:33 httpcore.http11 DEBUG receive_response_body.started request=
29.08 20:33 httpcore.http11 DEBUG receive_response_body.complete
29.08 20:33 httpcore.http11 DEBUG response_closed.started
29.08 20:33 httpcore.http11 DEBUG response_closed.complete
29.08 20:33 msmart.cloud DEBUG API response: {"code":3144,"msg":"login failed, login ID is empty, please login again.","data":null}
29.08 20:33 httpcore.connection DEBUG close.started
29.08 20:33 httpcore.connection DEBUG close.complete
29.08 20:33 msmart.discover ERROR Failed to login to cloud. Error: Code: 3144, Message: login failed, login ID is empty, please login again.
29.08 20:33 msmart.discover ERROR Could not establish cloud connection.
29.08 20:33 discover.py INFO *** Found a device: {'ip': '192.168.178.80', 'port': 6444, 'id': 19791209337257, 'online': False, 'supported': False, 'type': , 'name': 'net_ac_7803', 'sn': '000000P0000000Q1F0C9D1C178030000', 'key': None, 'token': None}
Hm..you sure you installed from PR? Does midea-discover
report a version like 2023.9.1.dev2+g29593f4
?
Yes
midea-discover
INFO:msmart.cli:msmart version: 2023.9.1.dev2+g29593f4
INFO:msmart.cli:Only supports AC devices. Only supports MSmartHome and 美的美居.
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
WARNING:msmart.cloud:Request to https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/mj/user/login timed out.
ERROR:msmart.discover:Failed to login to cloud. Error: Code: 3144, Message: login failed, login ID is empty, please login again.
ERROR:msmart.discover:Could not establish cloud connection.
INFO:msmart.cli:Found 1 devices.
INFO:msmart.cli:Found device:
{'ip': '192.168.178.80', 'port': 6444, 'id': 19791209337257, 'online': False, 'supported': False, 'type': <DeviceType.AIR_CONDITIONER: 172>, 'name': 'net_ac_7803', 'sn': '000000P0000000Q1F0C9D1C178030000', 'key': None, 'token': None}
2023.08 works witohut any problems:
midea-discover
INFO:msmart.cli:msmart version: 2023.8.0 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
INFO:msmart.lan:Got TCP key for 192.168.178.46:54978 -> 192.168.178.80:6444 retries: 0 time: 0.45 tcp_key: 6529c2c604aa5b793171a6faf961284052a60fed7aa6d09c953df90fe5c9a255
INFO:msmart.cli:*** Found a device: {'name': 'net_ac_7803', 'ssid': 'net_ac_7803', 'ip': '192.168.178.80', 'port': 6444, 'id': 19791209337257, 'version': 3, 'token': 'FDEADD6F4B4680B40E983A832E6012EC539A583112069F4359C77BA1BA6576DC4D9A17705111D39C75875465BAF71AEDFBABDA40BB11728C5F50DE88FABCE34B', 'key': '1e5cda01f99840b78b00343580b33b8b0895982641044755bfaf6cc67f53379d', 'type': 'ac', 'sn': '000P0000000Q1F0C9D1C178030000', 'model': '00Q1F', 'support': True, 'run_test': True}
Ok yeah, thanks.
I am able to recreate this issue if I run in a codespace in the Europe West region. Seems to work ok in the USA West and Southeast Asia regions.
Push a change to that PR to increase the timeout. Let me know if that helps.
works.
Closed via #39 and released in 2023.9.1
Hello,
i´ve been updating my Script Midea2Lox with msmart in it. I´ve updated to msmart-ng 2023.9.0 Trying to import the new discover module, and run devices = await Discover.discover() but get an error, login is empty:
Log:
when i try the same with midea-discover on shell, i geht this output:
with msmart-ng 2023.8.0 it works:
thanks for your work!