wuwentao / midea_ac_lan

Auto-configure and then control your Midea M-Smart devices (Air conditioner, Fan, Water heater, Washer, etc) via local area network.
MIT License
371 stars 17 forks source link

Can't get available token for this device #219

Closed mengxiang2020aa closed 4 months ago

mengxiang2020aa commented 4 months ago

HA版本

2024.7.1

集成版本

2024.06.2

设备类型及型号

Air Conditioner 22012615 (0)

使用的App

美的美居

问题详细描述

使用0.5.0版本,无法添加美的空调设备,提示“Can't get available token for this device”,日志有显示获取到token,手动配置依然不行,日志如下:

2024-07-09 22:40:55.316 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.smartmidea.net/mas/v5/app/proxy?alias=/v1/iot/secure/getToken, data: {'udpid': '4a18a602ae874fd7fc7e7df9febbd8d2', 'reqId': '7b95d8bd94a9459934ff2fec151fe456', 'stamp': '20240709144055'}, response: b'{"msg":"\xe8\xb0\x83\xe7\x94\xa8\xe4\xb8\x9a\xe5\x8a\xa1\xe7\xb3\xbb\xe7\xbb\x9f\xe5\xbc\x82\xe5\xb8\xb8(\xe8\xae\xbf\xe9\x97\xae\xe5\x9c\xb0\xe5\x9d\x80\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8) [no Route matched with those values]","code":40404}' 2024-07-09 22:40:55.316 DEBUG (MainThread) [midealocal.cloud] Response from get_keys() for appliance_id 210006728402011 with method 1: None 2024-07-09 22:40:55.353 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.smartmidea.net/mas/v5/app/proxy?alias=/v1/iot/secure/getToken, data: {'udpid': 'dc2fdf5ddb6dba82169610d941acdfb0', 'reqId': '5471fcf700918369fb745985df04f0fa', 'stamp': '20240709144055'}, response: b'{"msg":"\xe8\xb0\x83\xe7\x94\xa8\xe4\xb8\x9a\xe5\x8a\xa1\xe7\xb3\xbb\xe7\xbb\x9f\xe5\xbc\x82\xe5\xb8\xb8(\xe8\xae\xbf\xe9\x97\xae\xe5\x9c\xb0\xe5\x9d\x80\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8) [no Route matched with those values]","code":40404}' 2024-07-09 22:40:55.354 DEBUG (MainThread) [midealocal.cloud] Response from get_keys() for appliance_id 210006728402011 with method 2: None 2024-07-09 22:40:55.354 DEBUG (MainThread) [midealocal.device] [210006728402011] Connecting to 192.168.50.57:6444 2024-07-09 22:40:55.483 DEBUG (MainThread) [midealocal.device] [210006728402011] Connected 2024-07-09 22:40:55.484 DEBUG (MainThread) [midealocal.device] [210006728402011] Handshaking 2024-07-09 22:40:55.543 DEBUG (MainThread) [midealocal.device] [210006728402011] Authentication failed 2024-07-09 22:40:55.543 DEBUG (MainThread) [midealocal.device] [210006728402011] Status update: {'available': False} 2024-07-09 22:40:55.543 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] connect device using method 99 token/key failed 2024-07-09 22:40:55.543 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] Unable to connect device with all the token/key 2024-07-09 22:40:55.544 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] Can't get valid token with input account in 美的美居 server 2024-07-09 22:40:58.301 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': '20240709144055', 'platformId': '1', 'deviceId': '2625df98eed17b6f', 'reqId': '97190a00b14e042f0b042156788c9db7', 'uid': None, 'clientType': '1', 'appId': '1010', 'userType': '0', 'userName': 'c414e631394b8639@outlook.com'}, response: b'{"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","emsIdAdapt":"132097"}}'

The logs

homeassistant_logs-debug-0709.txt

wuwentao commented 4 months ago

你的debug log,刚好把你所有设备的具体型号信息都给删除了.....可以把自己的账号信息处理一下即可(下一个版本会自动强行处理),所以这样就有点失去了debug log的意义,后面都是报错的信息了

所以具体是美的哪个系列的空调?具体型号等信息呢?是近期新买的?之前也从未成功添加过?

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Your debug log has just deleted the specific model information of all your devices... The meaning of the debug log has been lost, and all the subsequent information is error messages.

So which series of Midea air conditioners is it specifically? What about the specific model and other information? Bought new recently? Never added successfully before?

CrashLT commented 4 months ago

Had same issue today, managed to solve it by turning off the AC through the nethome plus app after which it got past that point, kept getting some errors in the next steps, but got through all of them by just retrying the steps.

mengxiang2020aa commented 4 months ago

你的debug log,刚好把你所有设备的具体型号信息都给删除了.....可以把自己的账号信息处理一下即可(下一个版本会自动强行处理),所以这样就有点失去了debug log的意义,后面都是报错的信息了

所以具体是美的哪个系列的空调?具体型号等信息呢?是近期新买的?之前也从未成功添加过?

抱歉 美的省电星系列,去年购买 型号:KFR-35G/BDN8Y-DH400(3)A 、KFR-26G/BDN8Y-DH400(3)A、KFR-26G/BDN8Y-DH400(3)A,之前从未在在这个插件添加过,在smart_ac那个添加上一个,其他两个不行

具体log如下: 2024-07-09 22:40:44.773 DEBUG (MainThread) [midealocal.discover] All addresses for broadcast: ['192.168.50.255', '172.30.233.255', '172.30.33.255'] 2024-07-09 22:40:44.820 DEBUG (MainThread) [midealocal.discover] Received response from ('192.168.50.57', 6445): 837000c8200f00005a5a0111b8007a8000000000500a2916090718145b64720000bf0000000000000000018000000000c3c6ad31adbac414575b3ffa5ed95f290a42975ae6aa14a88e06f5a086923fb9248c11fa30e9e55b28e6ecc7050afd79e7fbb7da143d0b696265ee00ef62c1ea71f54371635407a0b0d1a697fec4d47ed5e0041df782d40de66c4033ce14648a4bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e78928755ce05cf7bf59275c3a4038d9389bb6ba7d4ddbf211fb9b325468285c71 2024-07-09 22:40:44.820 DEBUG (MainThread) [midealocal.discover] Declassified reply: 3932a8c02c19000030303030303035313132323031323631373338303630353230383834303030300d6d696465615f61635f303838340000830002000000000000000000ac00acac00000000a8407dc3c708150014032118000300000000000000000000000000000000000000000000000000000000000000000000 2024-07-09 22:40:44.820 DEBUG (MainThread) [midealocal.discover] Found a supported device: {'device_id': 210006728402011, 'type': 172, 'ip_address': '192.168.50.57', 'port': 6444, 'model': '22012617', 'sn': '00000051122012617380605208840000', 'protocol': 3} 2024-07-09 22:40:44.825 DEBUG (MainThread) [midealocal.discover] Received response from ('192.168.50.51', 6445): 837000c8200f00005a5a0111b8007a8000000000c1c9291609071814ac557a0000c00000000000000000018000000000bda406c89b9f7eca971d90d855793c04efd6342098195a52548dea0c563ce2666074cffab717495f894a37429ef9a2381a47fd0904de5a9e895f54f4e1639b0dea269bfe4c4705bb08036d39d16c0e7d8f93e7ebe52c85a63a460d1b70ba08ad4bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e7e7a9394c518006692d3b6a630a5ccc364a18a602ae874fd7fc7e7df9febbd8d2 2024-07-09 22:40:44.826 DEBUG (MainThread) [midealocal.discover] Declassified reply: 3332a8c02c19000030303030303035313132323031323631353338313630383431323030303030300d6d696465615f61635f313230300000830002000000000000000000ac00acac00000000a8407dae6c23150014032017000301000000000000000000000000000000000000000000000000000000000000000000 2024-07-09 22:40:44.826 DEBUG (MainThread) [midealocal.discover] Found a supported device: {'device_id': 211106240550316, 'type': 172, 'ip_address': '192.168.50.51', 'port': 6444, 'model': '22012615', 'sn': '00000051122012615381608412000000', 'protocol': 3} 2024-07-09 22:40:44.829 DEBUG (MainThread) [midealocal.discover] Received response from ('192.168.50.44', 6445): 837000c8200f00005a5a0111b8007a80000000002b98291609071814af8b720000be0000000000000000018000000000a67785077a9dc0e7942694cb4773dbf70a42975ae6aa14a88e06f5a086923fb930b22924c7cdf1e66ce08bb91f145eb972f90fd709920eb7c48bbfe93d238eeab516b0a18987029887f9b12708e5f6a1da84cad3a2d513048729ba83452b8dad4bdfb3e16e33d88768cc4c3d0658937d96fbcce99f70c976413c2f05f60f82e773a89b8d4522a29413c92298e96eaa1f9b5adf63e8946961faa7d38d6e3d006b 2024-07-09 22:40:44.829 DEBUG (MainThread) [midealocal.discover] Declassified reply: 2c32a8c02c19000030303030303035313132323031323631373338303630353230383330303030300d6d696465615f61635f303833300000830002000000000000000000ac00acac00000000a8407d83363c150014032017000300000000000000000000000000000000000000000000000000000000000000000000 2024-07-09 22:40:44.829 DEBUG (MainThread) [midealocal.discover] Found a supported device: {'device_id': 208907216784303, 'type': 172, 'ip_address': '192.168.50.44', 'port': 6444, 'model': '22012617', 'sn': '00000051122012617380605208300000', 'protocol': 3} 2024-07-09 22:40:53.475 DEBUG (MainThread) [custom_components.midea_ac_lan.config_flow] user input login matched

wuwentao commented 4 months ago

Had same issue today, managed to solve it by turning off the AC through the nethome plus app after which it got past that point, kept getting some errors in the next steps, but got through all of them by just retrying the steps.

thanks, but report with not pass and without debug log is no a useful info for both us and you.... we also need to got debug log to understand the error info and device type/model and the detail, especially for both software and hardware info, there is too many device software and hardware difference, we should have debug output with these info, whatever it pass or failed.

and we should disable you add it with error config and a not working device, if you are using an error config and setting, force add it pass, then report any error bug , it should not a normal case.

wuwentao commented 4 months ago

@mengxiang2020aa 多谢,从你补充的这部分debug log来看,你的三款AC设备,其中二款的model为22012617,一款为22012615,具体哪个成功,哪个失败,以及设备的其他具体信息,实际上还有更详细的信息,都在 debug log里面,从美居登录以后获取更多来辅助添加设备,以及失败以后的其他尝试,都在 debug log中体现。 这样是log拆分成一小段一小段的分别提供了,中间部分仍然还是确实的,刚开始的是结束的报错的部分,这个是开头的部分,debug log中的account信息简单马赛克或者修改一下即可,随后后自动处理掉。 需要的还是完整的log,尤其是错误发生以后,而不仅仅是其中一小段。

当然,有一小部分使用中的错误,可能其中一小段关键错误log就足以解决问题,但是目前添加失败大概率是不行....

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@mengxiang2020aa Thank you. Judging from the debug log you added, of your three AC devices, two of them have models 22012617 and one is 22012615. Which one succeeds and which one fails, as well as other specific information about the device, are actually There is also more detailed information, all in the debug log. After logging in from Mercure, you can get more information to assist in adding devices, as well as other attempts after failure, all of which are reflected in the debug log. In this way, the log is divided into small sections and provided separately. The middle part is still accurate. The beginning is the error reporting part at the end. This is the beginning part. The account information in the debug log can be simply mosaic or modified. , and then automatically processed. What is needed is the complete log, especially after the error occurs, not just a small section.

Of course, there are a small number of errors in use, and a small section of the key error log may be enough to solve the problem, but adding a high probability of failure is currently not possible....

mengxiang2020aa commented 4 months ago

感谢你的帮助

22012615可以添加,但是不能使用。显示不可用,一个设备和一个实体,查看log应该是貌似是使用V2协议

image image image

22012617是无法添加 之前考虑敏感信息 所以没给全 我再次上次上传完整信息,看是否可以得到有用信息

HomeAssistant-0710-19.txt

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Thank you for your help

22012615 can be added, but cannot be used. It shows that it is unavailable, one device and one entity. Looking at the log, it seems that the V2 protocol is used.

image image image

22012617 cannot be added I considered sensitive information before so I didn’t give the complete information. I will upload the complete information again to see if I can get any useful information.

HomeAssistant-0710-19.txt

mengxiang2020aa commented 4 months ago

刚刚再次尝试发现一个的新的错误 image

wuwentao commented 4 months ago

@mengxiang2020aa 这压根不是一个错误,这是对所有配置强行做了二次检测,以前的版本压根不检查,所有人都在设备添加不成功时,使劲改各种参数,改完添加成功,感觉自己能用了,各种报bug,实际都是使用的是一个错误的配置,基于错误的配置报bug,如何解?

所以新版已经禁止使用此类骚操作,必须保证所有设备信息都是符合实际设备的真实准确的配置,保证添加进去的配置都是准确的 如果你出现这个错误,大概率是:添加设备时手工修改过一些重要的参数

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@mengxiang2020aa This is not a mistake at all. This is a forced secondary check of all configurations. The previous version did not check at all. When the device was unsuccessfully added, everyone tried hard to change various parameters. After the changes were completed, the addition was successful and I felt like I It works, but the various bug reports are actually using an incorrect configuration. How to solve the bug report based on the wrong configuration?

Therefore, the new version has banned the use of such frivolous operations. You must ensure that all device information is in line with the true and accurate configuration of the actual device, and ensure that the added configurations are accurate. If you get this error, the most likely reason is that you manually modified some important parameters when adding the device.

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


So what should I do? 0 reset once?

mengxiang2020aa commented 4 months ago

你好,删除之后重新添加之后,依然加不上,完整日志见附件

home-assistant.log

Issues-translate-bot commented 4 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Hello, after deleting and re-adding, it still cannot be added. Please see the attachment for the complete log. [Uploading home-assistant.log…]()

chemelli74 commented 4 months ago

Link is broken

mengxiang2020aa commented 4 months ago

Thanks for letting me know,the link has been put back up

chemelli74 commented 4 months ago
2024-07-10 20:31:55.426 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.smartmidea.net/mas/v5/app/proxy?alias=/v1/iot/secure/getToken, data: {'udpid': '4a18a602ae874fd7fc7e7df9febbd8d2', 'reqId': '65cc3aa192704b524db28e5345211b49', 'stamp': '20240710123155'}, response: b'{"msg":"\xe8\xb0\x83\xe7\x94\xa8\xe4\xb8\x9a\xe5\x8a\xa1\xe7\xb3\xbb\xe7\xbb\x9f\xe5\xbc\x82\xe5\xb8\xb8(\xe8\xae\xbf\xe9\x97\xae\xe5\x9c\xb0\xe5\x9d\x80\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8) [no Route matched with those values]","code":40404}'
2024-07-10 20:31:55.426 DEBUG (MainThread) [midealocal.cloud] Response from get_keys() for appliance_id 210006728402011 with method 1: None
2024-07-10 20:31:55.463 DEBUG (MainThread) [midealocal.cloud] Midea cloud API url: https://mp-prod.smartmidea.net/mas/v5/app/proxy?alias=/v1/iot/secure/getToken, data: {'udpid': 'dc2fdf5ddb6dba82169610d941acdfb0', 'reqId': 'f2beb147e07a2a38455a06a725c1d1be', 'stamp': '20240710123155'}, response: b'{"msg":"\xe8\xb0\x83\xe7\x94\xa8\xe4\xb8\x9a\xe5\x8a\xa1\xe7\xb3\xbb\xe7\xbb\x9f\xe5\xbc\x82\xe5\xb8\xb8(\xe8\xae\xbf\xe9\x97\xae\xe5\x9c\xb0\xe5\x9d\x80\xe4\xb8\x8d\xe5\xad\x98\xe5\x9c\xa8) [no Route matched with those values]","code":40404}'
2024-07-10 20:31:55.463 DEBUG (MainThread) [midealocal.cloud] Response from get_keys() for appliance_id 210006728402011 with method 2: None

Something not supported in your log.

Which ap are you using ? Which Cloud ?

wuwentao commented 4 months ago

@chemelli74 this is meiju cloud from user input, get_device_info should ok but get_key not available for meiju cloud as no route(no get token api). then rollback to phase 2 use default preset info from msmart cloud, still failed....

some device still can use phase 2 to got a passed token and works well, but some device can't use msmart to got a passed token now.

rokam commented 4 months ago

How do I retrieve keys from Meijucloud? Another API version was released? Can you @wuwentao sniff the protocol?

rokam commented 4 months ago

0.5.4 should fix your issue.