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

Can't get available token for this device - USING SMARTHOME (not meijucloud, unrelated to #275 ?) #395

Open
viny182 opened this issue Nov 24, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@viny182
Copy link

viny182 commented Nov 24, 2024

HA core version

2024.11.3

Current integration version

0.6.5

Last known working integration version

None

Device type and model

Front Loader Washer Dryer Smart Wi-Fi HealthGuard Titanium MF200D110WB - 38124206

image

Working mobile app

SmartHome

The detail description of bug/problem

When trying to add the device model 38124206, I'm getting the error "Can't get available token for this device", but differently from #275 , I'm using SmartHome app and not meijucloud.

Creating a new issue as recommended in this comment -> #275 (comment)

The logs

log_smarthome.txt

@viny182 viny182 added the bug Something isn't working label Nov 24, 2024
@viny182 viny182 changed the title Can't get available token for this device - USING SMARTHOME (not related to #275) Can't get available token for this device - USING SMARTHOME (not meijucloud, unrelated to #275 ?) Nov 24, 2024
@wuwentao
Copy link
Owner

wuwentao commented Nov 27, 2024

from your debug log, seems device don't recv normal auth handshaking response, it's a different error as Meijucloud.

Received auth response len 13 error

2024-11-24 15:57:18.268 DEBUG (MainThread) [midealocal.device] [151732605718514] Connecting to 192.168.182.67:6444
2024-11-24 15:57:18.281 DEBUG (MainThread) [midealocal.device] [151732605718514] Connected
2024-11-24 15:57:18.282 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication handshaking
2024-11-24 15:57:18.356 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response with 13 bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.357 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response len 13 error, bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.357 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication failed
2024-11-24 15:57:18.357 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 1 token/key failed
2024-11-24 15:57:18.365 DEBUG (MainThread) [midealocal.device] [151732605718514] Connecting to 192.168.182.67:6444
2024-11-24 15:57:18.395 DEBUG (MainThread) [midealocal.device] [151732605718514] Connected
2024-11-24 15:57:18.396 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication handshaking
2024-11-24 15:57:18.476 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response with 13 bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.476 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response len 13 error, bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.476 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication failed
2024-11-24 15:57:18.477 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 2 token/key failed
2024-11-24 15:57:18.477 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] Unable to connect device with all the token/key

@a-flash
Copy link

a-flash commented Nov 27, 2024

I have the same problem. The washing machine connects without problems, but the dryer of the same series shows the same error. It seems to me that the problem is in different firmware versions. The washing machine has 3.5.0.20 and the dryer has 1.1.0.7
photo_2024-11-26_18-44-24
photo_2024-11-26_18-44-33

@viny182
Copy link
Author

viny182 commented Nov 27, 2024

from your debug log, seems device don't recv normal auth handshaking response, it's a different error as Meijucloud.

Received auth response len 13 error

2024-11-24 15:57:18.268 DEBUG (MainThread) [midealocal.device] [151732605718514] Connecting to 192.168.182.67:6444
2024-11-24 15:57:18.281 DEBUG (MainThread) [midealocal.device] [151732605718514] Connected
2024-11-24 15:57:18.282 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication handshaking
2024-11-24 15:57:18.356 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response with 13 bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.357 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response len 13 error, bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.357 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication failed
2024-11-24 15:57:18.357 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 1 token/key failed
2024-11-24 15:57:18.365 DEBUG (MainThread) [midealocal.device] [151732605718514] Connecting to 192.168.182.67:6444
2024-11-24 15:57:18.395 DEBUG (MainThread) [midealocal.device] [151732605718514] Connected
2024-11-24 15:57:18.396 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication handshaking
2024-11-24 15:57:18.476 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response with 13 bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.476 DEBUG (MainThread) [midealocal.device] [151732605718514] Received auth response len 13 error, bytes: 83700005200f00004552524f52
2024-11-24 15:57:18.476 DEBUG (MainThread) [midealocal.device] [151732605718514] Authentication failed
2024-11-24 15:57:18.477 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 2 token/key failed
2024-11-24 15:57:18.477 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] Unable to connect device with all the token/key

@wuwentao is there any way to sniff the communication between the device and the App when adding it to check what kind of authentication key they are exchanging?

@viny182
Copy link
Author

viny182 commented Nov 27, 2024

@a-flash I have an all-in-one appliance (washer and dryer), and the firmware looks similar to your washer... Mine is also v3.5.0.20

image

@ChienWeiChek
Copy link

ChienWeiChek commented Dec 15, 2024

home-assistant_midea_ac_lan_2024-12-15T15-00-20.599Z.log
hi i am facing the same issue, unable to re-add the midea ac back. i was remove the ac since it didnt load something and i try to remove it, also remove the json file, since facing an error message that Device auth failed with input config and i follow the this https://github.com/wuwentao/midea_ac_lan/issues/320 to remove the device json

therefore i try to reconfigure again, login to the smarthome account the i face the error message
Can't get available token for this device

@wuwentao
Copy link
Owner

@ChienWeiChek
it's really a bad result...
from the debug log, we can't found error, just found the cloud token can't works for your device.
but most of the cloud token process works well without any error.

2024-12-15 23:00:02.733 DEBUG (MainThread) [midealocal.device] [151732605362845] Connecting to 192.168.100.32:6444
2024-12-15 23:00:02.736 DEBUG (MainThread) [midealocal.device] [151732605362845] Connected
2024-12-15 23:00:02.736 DEBUG (MainThread) [midealocal.device] [151732605362845] Authentication handshaking
2024-12-15 23:00:02.738 DEBUG (MainThread) [midealocal.device] [151732605362845] Connection error
2024-12-15 23:00:02.739 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 1 token/key failed
2024-12-15 23:00:02.740 DEBUG (MainThread) [midealocal.device] [151732605362845] Connecting to 192.168.100.32:6444
2024-12-15 23:00:02.742 DEBUG (MainThread) [midealocal.device] [151732605362845] Connected
2024-12-15 23:00:02.742 DEBUG (MainThread) [midealocal.device] [151732605362845] Authentication handshaking
2024-12-15 23:00:02.744 DEBUG (MainThread) [midealocal.device] [151732605362845] Connection error
2024-12-15 23:00:02.744 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 2 token/key failed
2024-12-15 23:00:02.745 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] Unable to connect device with all the token/key
2024-12-15 23:00:02.745 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] Can't get any available token with device 151732605362845

and for get device info in smarthome, it return none:

2024-12-15 23:00:03.945 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/appliance/user/list/get, data: {'src': '1010', 'format': '2', 'stamp': '20241215150003', 'platformId': '1', 'deviceId': '2625df98eed17b6f', 'reqId': '93c51568c70307b9a65c8d32874832f5', 'uid': '████████████████████████████████', 'clientType': '1', 'appId': '1010'}, response: b'{"code":"0","msg":"ok","data":{"list":[]}}'

anyway ,the code is 0 and msg is ok, only data is none, there should be no error.

maybe some changes in midea server side now, I'm not sure, as this is not a official solution from midea.
and there is no any code comments or document about this process,we are not understand it.

Meiju app in China local, the API already changed about one years ago, and caused more device can't got token, as midea upgrade they API to version 2, so old version 1 api can't works.
I'm not sure with Smarthome API. maybe we need more user to report it and confirm the result.

@ChienWeiChek
Copy link

what is the expected result on the data list? it should show device list?

@a-flash
Copy link

a-flash commented Dec 16, 2024

On my device, the response has content:
2024-12-13 16:34:41.738 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/multicloud/platform/user/route, data: {'src': '1010', 'format': '2', 'stamp': '20241213133441', 'platformId': '1', 'deviceId': '9ab3d3e7797a3056', 'reqId': '████████████████████████████████', 'uid': None, 'clientType': '1', 'appId': '1010', 'userType': '0', 'userName': '██████████████████████'}, response: b'{"msg":"ok","code":0,"data":{"masUrl":"https://ru-eu.appsmb.com/mas/v5/app/proxy?alias=","sseUrl":"https://sse.msmartlife.net","idAdapt":"131329","countryCode":"RU","emsIdAdapt":"131841"}}'
but it also can't connect
log.txt

@ChienWeiChek
Copy link

and a good new, add the AC back successfully, and I don't know why

@wuwentao
Copy link
Owner

and a good new, add the AC back successfully, and I don't know why

per my understand, the connection error , will be exist in both client and server side. if you restart HA can't fix it.
you may restart your device, and the connection works well.
so your device error is not related to current github issue, it's a device connection error

@wuwentao
Copy link
Owner

On my device, the response has content: 2024-12-13 16:34:41.738 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=/v1/multicloud/platform/user/route, data: {'src': '1010', 'format': '2', 'stamp': '20241213133441', 'platformId': '1', 'deviceId': '9ab3d3e7797a3056', 'reqId': '████████████████████████████████', 'uid': None, 'clientType': '1', 'appId': '1010', 'userType': '0', 'userName': '██████████████████████'}, response: b'{"msg":"ok","code":0,"data":{"masUrl":"https://ru-eu.appsmb.com/mas/v5/app/proxy?alias=","sseUrl":"https://sse.msmartlife.net","idAdapt":"131329","countryCode":"RU","emsIdAdapt":"131841"}}' but it also can't connect log.txt

from the log, we can found the same error, as auth response error and can't works with clud token.

2024-12-13 16:34:49.707 DEBUG (MainThread) [midealocal.device] [153931628539136] Received auth response len 13 error, bytes: 83700005200f00004552524f52
2024-12-13 16:34:49.707 DEBUG (MainThread) [midealocal.device] [153931628539136] Authentication failed

I'm not sure with the root cause.

@wuwentao
Copy link
Owner

another very important info is :

  1. in china local, using Meiju cloud and app, most of the devices (80-90%) can't get a valid token also is 0xDB device.
  2. in global marking, using SmartHomec cloud and app, our 0xDB device also can't get a valid token.

0xDB device may have new software firmware or new WIFI hardware modlue, and exist mode can't works for it.

@viny182
Copy link
Author

viny182 commented Jan 2, 2025

hello, is there anything that we can do to help troubleshoot this? Is there anyway to debug/sniff the communication between this new firmware/wifi module and the Midea Cloud?

@wuwentao
Copy link
Owner

wuwentao commented Jan 3, 2025

hello, is there anything that we can do to help troubleshoot this? Is there anyway to debug/sniff the communication between this new firmware/wifi module and the Midea Cloud?

sorry, I don't have any good idea now.
per my understand, it's midea cloud api upgrade from v1 to v2, we should consider to upgrade to v2 api,in this mode, most of current design and mode MAY not work or we can got a new method from v2 api.
it's not a easy and simple job to do, I'm not sure with it, so we still need to focus on current supported devices and features now.

@viny182
Copy link
Author

viny182 commented Jan 18, 2025

Hello!

Not much progress, but I'd like to share just that I was able to setup a Hotspot computer gateway running Wireshark and I was able to sniff all the traffic from my Washer while I was adding it to SmartHome app... probably the correct Key/Tokens are somehow encrypted in one of the packets, but my limited knowledge does not let me advance...

I believe the chunk data is the one below, but not sure how to decrypt nor if it's really it...
"5a5a880000000100003530343035373132353137393338353001018000000101640000000000000020a9ede035e0ed2e7224379f12f4a97c2aa1cd82a721bba586210aa1f1c954fcb19022f8daa70c09672e32f06fdcfcddea8323839fe14f0f221f6cf589f7e09a68cb2ec6ae84d836120c75c48d1caa104a8029cf59b99a81ba55d09f214f6223"

Anyway, I'm attaching the full packet capture file in here in case someone more knowleadgeable wants to look at it...

midea_filter.zip

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

4 participants